MediaWiki
1.34.0
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
}
ResourceLoaderLanguageDataModule\supportsURLLoading
supportsURLLoading()
Definition:
ResourceLoaderLanguageDataModule.php:75
ResourceLoaderContext
Context object that contains information about the state of a specific ResourceLoader web request.
Definition:
ResourceLoaderContext.php:33
ResourceLoaderLanguageDataModule\getData
getData(ResourceLoaderContext $context)
Get all the dynamic data for the content language to an array.
Definition:
ResourceLoaderLanguageDataModule.php:38
ResourceLoaderLanguageDataModule
Module for populating language specific data, such as grammar forms.
Definition:
ResourceLoaderLanguageDataModule.php:28
ResourceLoaderLanguageDataModule\getScript
getScript(ResourceLoaderContext $context)
Definition:
ResourceLoaderLanguageDataModule.php:57
ResourceLoaderLanguageDataModule\$targets
$targets
Definition:
ResourceLoaderLanguageDataModule.php:30
ResourceLoaderFileModule
Module based on local JavaScript/CSS files.
Definition:
ResourceLoaderFileModule.php:35
ResourceLoaderLanguageDataModule\enableModuleContentVersion
enableModuleContentVersion()
Definition:
ResourceLoaderLanguageDataModule.php:68
$context
$context
Definition:
load.php:45
Language\factory
static factory( $code)
Get a cached or new language object for a given language code.
Definition:
Language.php:217
LanguageCode\getNonstandardLanguageCodeMapping
static getNonstandardLanguageCodeMapping()
Returns a mapping of non-standard language codes used by (current and previous version of) MediaWiki,...
Definition:
LanguageCode.php:143
includes
resourceloader
ResourceLoaderLanguageDataModule.php
Generated on Thu Dec 19 2019 14:54:45 for MediaWiki by
1.8.16