<?php
/**
- * Resource loader module for populating language specific data.
+ * ResourceLoader module for populating language specific data.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*/
class ResourceLoaderLanguageDataModule extends ResourceLoaderModule {
- protected $targets = array( 'desktop', 'mobile' );
+ protected $targets = [ 'desktop', 'mobile' ];
/**
* Get all the dynamic data for the content language to an array.
*/
protected function getData( ResourceLoaderContext $context ) {
$language = Language::factory( $context->getLanguage() );
- return array(
+ return [
'digitTransformTable' => $language->digitTransformTable(),
'separatorTransformTable' => $language->separatorTransformTable(),
'grammarForms' => $language->getGrammarForms(),
'pluralRules' => $language->getPluralRules(),
'digitGroupingPattern' => $language->digitGroupingPattern(),
'fallbackLanguages' => $language->getFallbackLanguages(),
- );
+ ];
}
/**
public function getScript( ResourceLoaderContext $context ) {
return Xml::encodeJsCall(
'mw.language.setData',
- array(
+ [
$context->getLanguage(),
$this->getData( $context )
- ),
+ ],
ResourceLoader::inDebugMode()
);
}
/**
- * @param ResourceLoaderContext $context
- * @return int UNIX timestamp
+ * @return bool
*/
- public function getModifiedTime( ResourceLoaderContext $context ) {
- return max( 1, $this->getHashMtime( $context ) );
+ public function enableModuleContentVersion() {
+ return true;
}
/**
* @param ResourceLoaderContext $context
- * @return string Hash
- */
- public function getModifiedHash( ResourceLoaderContext $context ) {
- return md5( serialize( $this->getData( $context ) ) );
- }
-
- /**
* @return array
*/
- public function getDependencies() {
- return array( 'mediawiki.language.init' );
+ public function getDependencies( ResourceLoaderContext $context = null ) {
+ return [ 'mediawiki.language.init' ];
}
}