Page MenuHomePhabricator

With ?uselang=invalid, Wikidata logo links to Main_page instead of Wikidata:Main_page
Open, Needs TriagePublic

Description

For example: https://www.wikidata.org/wiki/Wikidata:Main_Page?uselang=invalid – click on the Wikidata logo and you’ll be sent to https://www.wikidata.org/wiki/Main_Page (notice the missing Wikidata: namespace), which is a deleted page. This only seems to happen when the language code is something invalid (doesn’t have to be the literal string invalid).

Do we use some evil hack to change the target of the logo link and the hack is for some reason not loaded for invalid language codes?

Event Timeline

Ah, I see. The main page title is taken from the mainpage message (https://www.wikidata.org/wiki/MediaWiki:Mainpage), falling back to 'Main page' if that doesn’t work.

However, Title::newMainPage() supposedly uses the content language version of mainpage for that, so I’m not sure why uselang=invalid breaks it…

Okay, on wikidatawiki, mainpage is part of [$wgForceUIMsgAsContentMsg](https://www.mediawiki.org/wiki/Manual:$wgForceUIMsgAsContentMsg) and is therefore always used in the user language. Mystery solved.

I don’t see any easy way to fix this. (I wasn’t aware of it before, but we do have some localized versions of the main page that don’t just redirect to the main main page, so mainpage has to stay a force-user-language message for now.) Is this worth spending any effort on to find a solution or do we just close this?

Thanks! Though that task seems to contradict part of my last comment :) I left a comment there.

Also, I realized that there would be one generic solution: if Title::newMainPage() fails to look up the mainpage message in the content-but-really-user language, try again using the content language (->inLanguage( $wgContLang ) instead of ->inContentLanguage()) before falling back to the generic 'Main Page'.

Valid language codes have essentially the same problem, except they link to the translated version of "Main Page", e.g. https://www.wikidata.org/?uselang=kl, https://www.wikidata.org/?uselang=gn and https://www.wikidata.org/?uselang=gv all point to non-existent pages. The only ones which work are where we've created MediaWiki:Mainpage/xx.

If I understand the suggestion in the previous comment correctly, it would fix the cases where the language is unknown to MediaWiki, but wouldn't fix the ones where the language is known and it can look up the mainpage message.

If I understand the suggestion in the previous comment correctly, it would fix the cases where the language is unknown to MediaWiki, but wouldn't fix the ones where the language is known and it can look up the mainpage message.

Implementing my commit from T184386 would be lead to resolve these problem.