From 091b8a9e023065f900c8a1a35aa01354dc6485ec Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Tue, 17 Dec 2013 20:56:41 -0800 Subject: [PATCH] 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 --- UniversalLanguageSelector.hooks.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UniversalLanguageSelector.hooks.php b/UniversalLanguageSelector.hooks.php index 6e2f5638..c53d3af5 100644 --- a/UniversalLanguageSelector.hooks.php +++ b/UniversalLanguageSelector.hooks.php @@ -271,10 +271,6 @@ class UniversalLanguageSelectorHooks { $vars['wgULSNoImeSelectors'] = $wgULSNoImeSelectors; $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 ) ) { $vars['wgULSFontRepositoryBasePath'] = $wgULSFontRepositoryBasePath; } else { @@ -295,6 +291,10 @@ class UniversalLanguageSelectorHooks { // Place request context dependent stuff here $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; }