Introduce languages options to ULS
Default value of this option will be $.uls.data.autonyms(). It can be set to limit language selection to a set of languages. Updated examples, used a config variable wgULSLanguages to set this. Change-Id: Ia322cbdcdb14f08619d2e4df5b23e2702841d147
This commit is contained in:
committed by
Amir E. Aharoni
parent
bce461b980
commit
8f7382b242
@@ -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 .= "
|
||||
<div class='uls-menu' data-languages=\"" . $languageData . "\">
|
||||
<div class='uls-menu'>
|
||||
<div class='row'>
|
||||
<span class='icon-close'></span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user