Page MenuHomePhabricator

Wikis with language variants must override logo in Common.css
Closed, ResolvedPublic

Description

Wikis with language variants will have different logos per variant, but must use MediaWiki:Common.css to have the logo vary depending on what variant you've chosen.

If you search for mw-wiki-logo on https://zh.wikipedia.org/wiki/MediaWiki:Common.css you'll see CSS rules switching the logo for the zh-hans variants.

$wgLogos supports variants for the wordmark and tagline property. This should be extended to support the 1x property

'wmgSiteLogoVariants' => [
        'zhwiki' => [
                'zh-hans' => [
                        'wordmark' => [
                                'src' => '/static/images/mobile/copyright/wikipedia-wordmark-zh-hans.svg',
                                'width' => 105,
                                'height' => 23,
                        ],
                        'tagline' => [
                                'src' => '/static/images/mobile/copyright/wikipedia-tagline-zh-hans.svg',
                                'width' => 103,
                                'height' => 15,
                        ],
                ],
],
...

if ( isset( $wmgSiteLogo1x ) ) {
        $wgLogos = [
                '1x' => $wmgSiteLogo1x ?? null,
                '1.5x' => $wmgSiteLogo1_5x ?? null,
                '2x' => $wmgSiteLogo2x ?? null,
                'icon' => $wmgSiteLogoIcon ?? null,
                'wordmark' => $wmgSiteLogoWordmark ?? null,
                'tagline' => $wmgSiteLogoTagline ?? null,
                'variants' => $wmgSiteLogoVariants ?? null,
        ];
}

Developer notes

The following configuration should work:

$wgLogos = [
	'variants' => [
		'zh-hans' => [
			'1x' => 'https://zh.wikipedia.org/static/images/project-logos/zhwiki-hans.png',
		],
		'zh-cn' => [
			'1x' => 'https://zh.wikipedia.org/static/images/project-logos/zhwiki-hans-2x.png',
		],
 	],
	'1x' => 'https://zh.wikipedia.org/static/images/project-logos/zhwiki-2x.png',
 ];

QA in prod

Open in two tabs:

Confirm the images in the top left are different.

Event Timeline

Change 773936 had a related patch set uploaded (by Func; author: Func):

[mediawiki/core@master] Apply logo variant override in ResourceLoaderSkinModule

https://gerrit.wikimedia.org/r/773936

Jdlrobson triaged this task as Medium priority.Mar 30 2022, 10:40 PM
Jdlrobson renamed this task from Wikis with language variants must override logo in Common.css to [Vector legacy/MonobWikis with language variants must override logo in Common.css.Mar 30 2022, 10:54 PM
Jdlrobson updated the task description. (Show Details)
Jdlrobson renamed this task from [Vector legacy/MonobWikis with language variants must override logo in Common.css to Wikis with language variants must override logo in Common.css.Mar 30 2022, 11:27 PM

@Func would you be able to take care of the configuration change for this so we can QA it on the beta cluster ? https://zh.wikipedia.beta.wmflabs.org/

Change 773936 merged by jenkins-bot:

[mediawiki/core@master] Apply logo variant override in ResourceLoaderSkinModule

https://gerrit.wikimedia.org/r/773936

Change 775416 had a related patch set uploaded (by Func; author: Func):

[operations/mediawiki-config@master] Add logo variants for zhwiki

https://gerrit.wikimedia.org/r/775416

Change 775422 had a related patch set uploaded (by Func; author: Func):

[mediawiki/core@master] Support language fallback for logo variants

https://gerrit.wikimedia.org/r/775422

Change 775423 had a related patch set uploaded (by Func; author: Func):

[operations/mediawiki-config@master] Use variants fallback to define logos for zhwiki

https://gerrit.wikimedia.org/r/775423

@Func would you be able to take care of the configuration change for this so we can QA it on the beta cluster ? https://zh.wikipedia.beta.wmflabs.org/

The beta cluster wikipedia doesn't have another logo, maybe anyone wants to modify one?

Right. No worries. We can test this in production during the backport. Thanks for preparing the patch.

Change 775416 merged by jenkins-bot:

[operations/mediawiki-config@master] Add logo variants for zhwiki

https://gerrit.wikimedia.org/r/775416

Mentioned in SAL (#wikimedia-operations) [2022-04-04T13:05:29Z] <urbanecm@deploy1002> Synchronized wmf-config/InitialiseSettings.php: 7ebad8ffa1826ed3429cd822d388807270cfe341: Add logo variants for zhwiki (T273578) (duration: 00m 51s)

Jdlrobson claimed this task.

QAed this today. Here are screenshots of the 2 URLs which are clearly different variants:

Screen Shot 2022-04-07 at 8.49.23 AM.png (840×1 px, 383 KB)

Screen Shot 2022-04-07 at 8.49.27 AM.png (558×1 px, 196 KB)

Thanks for working on this one!

@Func @Winston_Sung are you able to make sure https://zh.wikipedia.org/wiki/MediaWiki:Common.css gets updated to drop it's CSS rules? Let me know if you need any help.

I don't want to say this one is resolved, there are a bunch of Chinese wikis that have overrides in site js, I think logo variants can't be widely used without the fallback chain implemented.

@Func @Winston_Sung are you able to make sure https://zh.wikipedia.org/wiki/MediaWiki:Common.css gets updated to drop it's CSS rules? Let me know if you need any help.

I have posted a message in the village pump, should be done soon.

Change 775422 abandoned by Func:

[mediawiki/core@master] Support language fallback for logo variants

Reason:

https://gerrit.wikimedia.org/r/775422

I think we should use the language fallback chain instead of defining every language variant.

Change 775423 abandoned by Func:

[operations/mediawiki-config@master] Use variants fallback to define logos for zhwiki

Reason:

https://gerrit.wikimedia.org/r/775423