MediaWiki  1.23.12
ResourceLoaderLanguageDataModule.php
Go to the documentation of this file.
1 <?php
29 
30  protected $language;
31  protected $targets = array( 'desktop', 'mobile' );
37  protected function getSiteLangGrammarForms() {
38  return $this->language->getGrammarForms();
39  }
40 
46  protected function getPluralRules() {
47  return $this->language->getPluralRules();
48  }
49 
55  protected function getDigitGroupingPattern() {
56  return $this->language->digitGroupingPattern();
57  }
58 
64  protected function getDigitTransformTable() {
65  return $this->language->digitTransformTable();
66  }
67 
74  protected function getSeparatorTransformTable() {
75  return $this->language->separatorTransformTable();
76  }
77 
85  protected function getData() {
86  return array(
87  'digitTransformTable' => $this->getDigitTransformTable(),
88  'separatorTransformTable' => $this->getSeparatorTransformTable(),
89  'grammarForms' => $this->getSiteLangGrammarForms(),
90  'pluralRules' => $this->getPluralRules(),
91  'digitGroupingPattern' => $this->getDigitGroupingPattern(),
92  );
93  }
94 
99  public function getScript( ResourceLoaderContext $context ) {
100  $this->language = Language::factory( $context->getLanguage() );
101  return Xml::encodeJsCall( 'mw.language.setData', array(
102  $this->language->getCode(),
103  $this->getData()
104  ) );
105  }
106 
111  public function getModifiedTime( ResourceLoaderContext $context ) {
112  return max( 1, $this->getHashMtime( $context ) );
113  }
114 
119  public function getModifiedHash( ResourceLoaderContext $context ) {
120  $this->language = Language::factory( $context->getLanguage() );
121 
122  return md5( serialize( $this->getData() ) );
123  }
124 
128  public function getDependencies() {
129  return array( 'mediawiki.language.init' );
130  }
131 }
ResourceLoaderContext
Object passed around to modules which contains information about the state of a specific loader reque...
Definition: ResourceLoaderContext.php:29
ResourceLoaderLanguageDataModule\getDigitGroupingPattern
getDigitGroupingPattern()
Get the digit groupin Pattern for the site content language.
Definition: ResourceLoaderLanguageDataModule.php:55
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ResourceLoaderLanguageDataModule\getData
getData()
Get all the dynamic data for the content language to an array.
Definition: ResourceLoaderLanguageDataModule.php:85
ResourceLoaderModule\getHashMtime
getHashMtime(ResourceLoaderContext $context)
Helper method for calculating when the module's hash (if it has one) changed.
Definition: ResourceLoaderModule.php:404
ResourceLoaderLanguageDataModule
ResourceLoader module for populating language specific data.
Definition: ResourceLoaderLanguageDataModule.php:28
ResourceLoaderLanguageDataModule\getSeparatorTransformTable
getSeparatorTransformTable()
Get seperator transform table required for converting the .
Definition: ResourceLoaderLanguageDataModule.php:74
ResourceLoaderLanguageDataModule\getScript
getScript(ResourceLoaderContext $context)
Definition: ResourceLoaderLanguageDataModule.php:99
ResourceLoaderLanguageDataModule\$targets
$targets
Definition: ResourceLoaderLanguageDataModule.php:31
Xml\encodeJsCall
static encodeJsCall( $name, $args, $pretty=false)
Create a call to a JavaScript function.
Definition: Xml.php:665
ResourceLoaderLanguageDataModule\getModifiedHash
getModifiedHash(ResourceLoaderContext $context)
Definition: ResourceLoaderLanguageDataModule.php:119
ResourceLoaderLanguageDataModule\getModifiedTime
getModifiedTime(ResourceLoaderContext $context)
Definition: ResourceLoaderLanguageDataModule.php:111
ResourceLoaderLanguageDataModule\getSiteLangGrammarForms
getSiteLangGrammarForms()
Get the grammar forms for the site content language.
Definition: ResourceLoaderLanguageDataModule.php:37
ResourceLoaderLanguageDataModule\getDependencies
getDependencies()
Definition: ResourceLoaderLanguageDataModule.php:128
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
ResourceLoaderContext\getLanguage
getLanguage()
Definition: ResourceLoaderContext.php:143
ResourceLoaderLanguageDataModule\$language
$language
Definition: ResourceLoaderLanguageDataModule.php:30
ResourceLoaderModule
Abstraction for resource loader modules, with name registration and maxage functionality.
Definition: ResourceLoaderModule.php:28
ResourceLoaderLanguageDataModule\getDigitTransformTable
getDigitTransformTable()
Get the digit transform table for the content language.
Definition: ResourceLoaderLanguageDataModule.php:64
Language\factory
static factory( $code)
Get a cached or new language object for a given language code.
Definition: Language.php:184
ResourceLoaderLanguageDataModule\getPluralRules
getPluralRules()
Get the plural forms for the site content language.
Definition: ResourceLoaderLanguageDataModule.php:46