Load wgULSCurrentAutonym variable in MakeGlobalVariablesScript hook

The ResourceLoaderGetConfigVars hook is intended for static
variables, not ones that depend on the current request.

Change-Id: I596495bd103e5b7735fb454e3b5f12cd4257ee99
This commit is contained in:
Kunal Mehta
2013-12-17 20:56:41 -08:00
parent 926582452e
commit 091b8a9e02

View File

@@ -271,10 +271,6 @@ class UniversalLanguageSelectorHooks {
$vars['wgULSNoImeSelectors'] = $wgULSNoImeSelectors; $vars['wgULSNoImeSelectors'] = $wgULSNoImeSelectors;
$vars['wgULSNoWebfontsSelectors'] = $wgULSNoWebfontsSelectors; $vars['wgULSNoWebfontsSelectors'] = $wgULSNoWebfontsSelectors;
// An optimization to avoid loading all of uls.data just to get the autonym
$lang = RequestContext::getMain()->getLanguage();
$vars['wgULSCurrentAutonym'] = $lang->fetchLanguageName( $lang->getCode() );
if ( is_string( $wgULSFontRepositoryBasePath ) ) { if ( is_string( $wgULSFontRepositoryBasePath ) ) {
$vars['wgULSFontRepositoryBasePath'] = $wgULSFontRepositoryBasePath; $vars['wgULSFontRepositoryBasePath'] = $wgULSFontRepositoryBasePath;
} else { } else {
@@ -295,6 +291,10 @@ class UniversalLanguageSelectorHooks {
// Place request context dependent stuff here // Place request context dependent stuff here
$vars['wgULSAcceptLanguageList'] = array_keys( $out->getRequest()->getAcceptLang() ); $vars['wgULSAcceptLanguageList'] = array_keys( $out->getRequest()->getAcceptLang() );
// An optimization to avoid loading all of uls.data just to get the autonym
$lang = $out->getLanguage();
$vars['wgULSCurrentAutonym'] = $lang->fetchLanguageName( $lang->getCode() );
return true; return true;
} }