diff --git a/UniversalLanguageSelector.hooks.php b/UniversalLanguageSelector.hooks.php index ce7e52ee..cfdf7fdd 100644 --- a/UniversalLanguageSelector.hooks.php +++ b/UniversalLanguageSelector.hooks.php @@ -94,6 +94,16 @@ class UniversalLanguageSelectorHooks { $code = RequestContext::sanitizeLangCode( $code ); return true; } + /** + * Hook: ResourceLoaderGetConfigVars + * @param $vars Array + * @return bool + */ + public static function addConfig( &$vars ) { + global $wgContLang; + $vars['wgULSLanguages'] = Language::fetchLanguageNames( $wgContLang->getCode() ); + return true; + } /** * Add the template for the ULS to the body. @@ -102,11 +112,8 @@ class UniversalLanguageSelectorHooks { * TODO: hardcoded English */ public static function addTemplate( &$data, $skin ) { - global $wgContLang; - $languages = Language::fetchLanguageNames( $wgContLang->getCode() ); - $languageData = htmlspecialchars( FormatJSON::encode( $languages ) ); $data .= " -