The label of the language button refers to the number of languages

Instead of "In another language" the button label will be
"0 languages", "1 language" or "X languages"

Bug: T268241
Change-Id: I293a1d5f4885f76cc5f62169ee24b52c234f9229
This commit is contained in:
jdlrobson 2021-02-01 14:51:28 -08:00 committed by Jdlrobson
parent 4b171bf74f
commit ef0ab0724e
3 changed files with 8 additions and 0 deletions

View File

@ -11,6 +11,7 @@
"vector.css": "/* All CSS here will be loaded for users of the Vector skin */",
"vector.js": "/* All JavaScript here will be loaded for users of the Vector skin */",
"vector-action-toggle-sidebar": "Toggle sidebar",
"vector-language-button-label": "{{PLURAL:$1|$1 language|$1 languages}}",
"vector-action-addsection": "Add topic",
"vector-action-delete": "Delete",
"vector-action-move": "Move",

View File

@ -22,6 +22,7 @@
"vector.css": "{{optional}}",
"vector.js": "{{optional}}",
"vector-action-toggle-sidebar": "Accessibility label for the button that toggles the sidebar's visibility, as well as audible presentation for screen readers.",
"vector-language-button-label": "Label for language button in modern Vector.\nArguments:\n - $1 number of languages, supports plural",
"vector-action-addsection": "Used in the Vector skin. See for example {{canonicalurl:Talk:Main_Page|useskin=vector}}\n{{Identical|Add topic}}",
"vector-action-delete": "Used in the Vector skin, as the name of a tab at the top of the page. See for example {{canonicalurl:Translating:MediaWiki|useskin=vector}}\n\n{{Identical|Delete}}",
"vector-action-move": "Used in the Vector skin, on the tabs at the top of the page. See for example {{canonicalurl:Talk:Main_Page|useskin=vector}}\n\n{{Identical|Move}}",

View File

@ -231,6 +231,12 @@ class SkinVector extends SkinMustache {
self::MENU_TYPE_PORTAL => 'vector-menu vector-menu-portal portal',
self::MENU_TYPE_DEFAULT => 'vector-menu',
];
if ( $portletData['id'] === 'p-lang' && $this->isLanguagesInHeader() ) {
$portletData['label'] = $this->msg(
'vector-language-button-label',
count( $this->getLanguages() )
)->parse();
}
$class = $portletData['class'];
$portletData['class'] = trim( "$class $extraClasses[$type]" );
return $portletData;