Get a list of the current user's Accept-Language codes
Change-Id: I2c8742f56e34aed8a368bb5add2cff30fa89ad33
This commit is contained in:
committed by
Niklas Laxström
parent
7cbaf20937
commit
610cc362ac
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ $wgHooks['BeforePageDisplay'][] = 'UniversalLanguageSelectorHooks::addModules';
|
||||
$wgHooks['PersonalUrls'][] = 'UniversalLanguageSelectorHooks::addTrigger';
|
||||
$wgHooks['ResourceLoaderTestModules'][] = 'UniversalLanguageSelectorHooks::addTestModules';
|
||||
$wgHooks['ResourceLoaderGetConfigVars'][] = 'UniversalLanguageSelectorHooks::addConfig';
|
||||
$wgHooks['MakeGlobalVariablesScript'][] = 'UniversalLanguageSelectorHooks::addVariables';
|
||||
$wgAPIModules['languagesearch'] = 'ApiLanguageSearch';
|
||||
$wgHooks['UserGetLanguageObject'][] = 'UniversalLanguageSelectorHooks::getLanguage';
|
||||
|
||||
@@ -78,7 +79,7 @@ $wgResourceModules['ext.uls.init'] = array(
|
||||
|
||||
$wgResourceModules['ext.uls.preferences'] = array(
|
||||
'scripts' => 'resources/js/ext.uls.preferences.js',
|
||||
'localBasePath' => $dir,
|
||||
'localBasePath' => $dir,
|
||||
'remoteExtPath' => 'UniversalLanguageSelector',
|
||||
'dependencies' => array(
|
||||
'mediawiki.user',
|
||||
|
||||
Reference in New Issue
Block a user