Get a list of the current user's Accept-Language codes

Change-Id: I2c8742f56e34aed8a368bb5add2cff30fa89ad33
This commit is contained in:
Amir E. Aharoni
2012-08-27 13:59:10 +03:00
committed by Niklas Laxström
parent 7cbaf20937
commit 610cc362ac
2 changed files with 13 additions and 2 deletions

View File

@@ -104,10 +104,20 @@ class UniversalLanguageSelectorHooks {
* Hook: ResourceLoaderGetConfigVars
* @param $vars Array
* @return bool
*/
*/
public static function addConfig( &$vars ) {
global $wgContLang;
$vars['wgULSLanguages'] = Language::fetchLanguageNames( $wgContLang->getCode(), 'mwfile' );
return true;
}
/**
* Hook: MakeGlobalVariablesScript
* @param $vars Array
* @return bool
*/
public static function addVariables( &$vars, OutputPage $out ) {
$vars['wgULSAcceptLanguageList'] = array_keys( $out->getRequest()->getAcceptLang() );
return true;
}
}