MediaWiki REL1_34
ResourceLoaderLanguageDataModule.php
Go to the documentation of this file.
1<?php
29
30 protected $targets = [ 'desktop', 'mobile' ];
31
38 protected function getData( ResourceLoaderContext $context ) {
39 $language = Language::factory( $context->getLanguage() );
40 return [
41 'digitTransformTable' => $language->digitTransformTable(),
42 'separatorTransformTable' => $language->separatorTransformTable(),
43 'minimumGroupingDigits' => $language->minimumGroupingDigits(),
44 'grammarForms' => $language->getGrammarForms(),
45 'grammarTransformations' => $language->getGrammarTransformations(),
46 'pluralRules' => $language->getPluralRules(),
47 'digitGroupingPattern' => $language->digitGroupingPattern(),
48 'fallbackLanguages' => $language->getFallbackLanguages(),
49 'bcp47Map' => LanguageCode::getNonstandardLanguageCodeMapping(),
50 ];
51 }
52
58 return parent::getScript( $context )
59 . 'mw.language.setData('
60 . $context->encodeJson( $context->getLanguage() ) . ','
61 . $context->encodeJson( $this->getData( $context ) )
62 . ');';
63 }
64
68 public function enableModuleContentVersion() {
69 return true;
70 }
71
75 public function supportsURLLoading() {
76 return false;
77 }
78}
Context object that contains information about the state of a specific ResourceLoader web request.
Module based on local JavaScript/CSS files.
Module for populating language specific data, such as grammar forms.
getData(ResourceLoaderContext $context)
Get all the dynamic data for the content language to an array.
$context
Definition load.php:45