Add language settings button inside dropdown for non-content pages

NOTE: This patch is identical to patch with change-id:
Ifdf2a529b30e5a2df8867b606a525c9f7b3bdb6c

The above patch has been merged but reverted because of the usage
of '$skin->getTemplateDate()' method, which should be avoided. The
current patch replaces the usage of this method, with the usage of
the output page title ($out->getTitle()). All the rest of the code
has been kept the same.

Bug: T316559
Change-Id: Ibef9f6fd46d9055c3e0865905fb8aa8d031c1940
This commit is contained in:
NikG
2023-01-11 18:05:29 +02:00
parent 324f10ee3f
commit 965ffc3b1a
3 changed files with 57 additions and 0 deletions

View File

@@ -170,6 +170,12 @@ class Hooks implements
if ( $this->isEnabled() ) {
// Enable UI language selection for the user.
$out->addModules( 'ext.uls.interface' );
$title = $out->getTitle();
$isContentPage = $title && $title->exists() && $title->isContentPage();
// if current page is not a content page, we should use a different layout inside ULS
// according to T316559. Add JS config variable here, to let frontend know, when this is the case
$config[ 'wgULSisLanguageSelectorEmpty' ] = !$isContentPage;
}
// This is added here, and not in onResourceLoaderGetConfigVars to allow skins and extensions