MediaWiki
REL1_34
ResourceLoaderLanguageDataModule.php
Go to the documentation of this file.
1
<?php
28
class
ResourceLoaderLanguageDataModule
extends
ResourceLoaderFileModule
{
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
57
public
function
getScript
(
ResourceLoaderContext
$context
) {
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
}
ResourceLoaderContext
Context object that contains information about the state of a specific ResourceLoader web request.
Definition
ResourceLoaderContext.php:33
ResourceLoaderFileModule
Module based on local JavaScript/CSS files.
Definition
ResourceLoaderFileModule.php:35
ResourceLoaderLanguageDataModule
Module for populating language specific data, such as grammar forms.
Definition
ResourceLoaderLanguageDataModule.php:28
ResourceLoaderLanguageDataModule\supportsURLLoading
supportsURLLoading()
Definition
ResourceLoaderLanguageDataModule.php:75
ResourceLoaderLanguageDataModule\getData
getData(ResourceLoaderContext $context)
Get all the dynamic data for the content language to an array.
Definition
ResourceLoaderLanguageDataModule.php:38
ResourceLoaderLanguageDataModule\$targets
$targets
Definition
ResourceLoaderLanguageDataModule.php:30
ResourceLoaderLanguageDataModule\enableModuleContentVersion
enableModuleContentVersion()
Definition
ResourceLoaderLanguageDataModule.php:68
ResourceLoaderLanguageDataModule\getScript
getScript(ResourceLoaderContext $context)
Definition
ResourceLoaderLanguageDataModule.php:57
$context
$context
Definition
load.php:45
includes
resourceloader
ResourceLoaderLanguageDataModule.php
Generated on Mon Nov 25 2024 16:05:38 for MediaWiki by
1.10.0