Introduce a preference to disable compact language links

Bug: T133030
Change-Id: If9ec0b8c75c59c62991f0d4bfa99f6d4c9324c30
This commit is contained in:
Santhosh Thottingal
2016-05-03 10:41:13 +05:30
committed by Niklas Laxström
parent 49bf8000e3
commit f1995bc603
4 changed files with 20 additions and 4 deletions

View File

@@ -75,7 +75,8 @@ class UniversalLanguageSelectorHooks {
if ( $wgULSCompactLanguageLinksBetaFeature === false ) {
// Compact language links is a default feature in this wiki.
return true;
// Check user preference
return $user->getBoolOption( 'compact-language-links' );
}
return false;
@@ -340,6 +341,8 @@ class UniversalLanguageSelectorHooks {
}
public static function onGetPreferences( $user, &$preferences ) {
global $wgULSCompactLanguageLinksBetaFeature;
$preferences['uls-preferences'] = [
'type' => 'api',
];
@@ -354,6 +357,14 @@ class UniversalLanguageSelectorHooks {
// showing the link when javascript is disabled.
];
if ( $wgULSCompactLanguageLinksBetaFeature === false ) {
$preferences['compact-language-links'] = [
'type' => 'check',
'section' => 'rendering/languages',
'label-message' => 'ext-uls-compact-language-links-preference'
];
}
return true;
}

View File

@@ -48,7 +48,8 @@
"UniversalLanguageSelectorHooks": "UniversalLanguageSelector.hooks.php"
},
"DefaultUserOptions": {
"uls-preferences": ""
"uls-preferences": "",
"compact-language-links": true
},
"config": {
"@ULSGeoService": "ULS can use geolocation services to suggest languages based on the country the user is vising from. Setting this to false will prevent builtin geolocation from being used. You can provide your own geolocation by setting window.Geo to object which has key \"country_code\" or \"country\". If set to true, it will query Wikimedia's geoip service. The service should return jsonp that uses the supplied callback parameter.",

View File

@@ -70,5 +70,7 @@
"apihelp-ulslocalization-description": "Get the localization of ULS in the given language.",
"apihelp-ulslocalization-param-language": "Language code.",
"apihelp-ulslocalization-example-1": "Get Tamil localization",
"apihelp-ulslocalization-example-2": "Get Hindi localization"
"apihelp-ulslocalization-example-2": "Get Hindi localization",
"prefs-languages": "Languages",
"ext-uls-compact-language-links-preference": "Use a compact language list, with languages relevant to you."
}

View File

@@ -72,5 +72,7 @@
"apihelp-ulslocalization-description": "{{doc-apihelp-description|ulslocalization}}",
"apihelp-ulslocalization-param-language": "{{doc-apihelp-param|ulslocalization|language}}\n{{Identical|Language code}}",
"apihelp-ulslocalization-example-1": "{{doc-apihelp-example|ulslocalization}}",
"apihelp-ulslocalization-example-2": "{{doc-apihelp-example|ulslocalization}}"
"apihelp-ulslocalization-example-2": "{{doc-apihelp-example|ulslocalization}}",
"prefs-languages": "Field set legend for user preferences regarding display of language lists",
"ext-uls-compact-language-links-preference": "Label for compact language links user preference"
}