From a874eb1096685e8b25fb7d1ad27db7d629a1b275 Mon Sep 17 00:00:00 2001 From: Func Date: Fri, 13 Jan 2023 14:31:55 +0800 Subject: [PATCH] LanguageDropdown: Check if the page is in talk namespaces instead $wgContentNamespaces is default to only contain the main namespace, we should check whether the page is a talk page instead. Also use the term "subject page" to align with existing functions of Title and NamespaceInfo. Bug: T316559 Bug: T326788 Change-Id: I873283195d5c503818b2056c87c25ecc77d2915a --- includes/Components/VectorComponentLanguageDropdown.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/Components/VectorComponentLanguageDropdown.php b/includes/Components/VectorComponentLanguageDropdown.php index 56532a1bd..a44ed073b 100644 --- a/includes/Components/VectorComponentLanguageDropdown.php +++ b/includes/Components/VectorComponentLanguageDropdown.php @@ -53,12 +53,12 @@ class VectorComponentLanguageDropdown implements VectorComponent { */ public function getTemplateData(): array { $title = $this->title; - $isContentPage = $title && $title->exists() && $title->isContentPage(); - // if page doesn't exist or if it's not a content page, we should + $isSubjectPage = $title && $title->exists() && !$title->isTalkPage(); + // If page doesn't exist or if it's in a talk namespace, we should // display a less prominent "language" button, without a label, and // quiet instead of progressive. For this reason some default values // should be updated for this case. (T316559) - if ( !$isContentPage ) { + if ( !$isSubjectPage ) { $icon = ''; $label = ''; $headingClass = 'mw-ui-button mw-ui-quiet mw-portlet-lang-heading-empty'; @@ -80,7 +80,7 @@ class VectorComponentLanguageDropdown implements VectorComponent { // Override header icon (currently no way to do this using constructor) $dropdownData['html-vector-heading-icon'] = $icon; $dropdownData['aria-label'] = $this->ariaLabel; - $dropdownData['is-language-selector-empty'] = !$isContentPage; + $dropdownData['is-language-selector-empty'] = !$isSubjectPage; return $dropdownData + $this->menuContentsData; }