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.