Page MenuHomePhabricator

Namespace names in the dropdown menu of Extension:AdvancedSearch are untranslated for Chinese wikis
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue:

What happens?:
All namespace names (except for the article namespace) are in English. It also affect non-WMF Chinese wiki sites that use Extension:AdvancedSearch.

It appears to be caused by SearchEngineConfig::searchableNamespaces() using Language::getNamespaces() with the content language (zh). Note that if Language::getNamespaces() is used with one of the zh-xx variants, the symptom would be T396231 (it will show Chinese characters in that variant, but not respecting MediaWiki:Conversion-nsx/xx).

What should have happened instead?:
The namespace names in the Extension:AdvancedSearch dropdown list should match the one in title on page. LanguageConverter is needed for correctness.

Software version: 1.45.0-wmf.13

Event Timeline

Restricted Application added subscribers: ZhaoFJx, Stang, Aklapper. · View Herald Transcript

The translation file for that wiki are in English.

Same behaviour can be observed for https://zh.wikipedia.org/wiki/Special:PrefixIndex.

@Nikerabbit, who would be in charge to change that?

@pfischer

The MessagesZh namespace names are intended to be in English to use them as the canonical namespace name in URL, prevent lean to one of the language variants and prevent technical issues related to the zh language converter.

We are not going to change that.

I agree with T174057#4578576 that where to use UI language instead of content language for namespace names can be debatable. However for the Chinese case, the content language itself can change (in the chosen variant sense). The zh language code is mostly for technical purposes mentioned above (like preventing the title name in URL changing depending on the variant), and is rarely used as a display language.

Bewfip moved this task from Closed to Extensions/Skins on the Chinese-Sites board.
Gehel subscribed.

This looks like a translation problem more than a Search problem. @Nikerabbit : would your team be able to take ownership of this?

TheDJ subscribed.

I tested this for SpecialPrefixIndex and that now seems to work. I suspect the work by @Winston_Sung for T396231 might have something to do with that.

I can confirm that AdvancedSearch is still broken and listing only english namespaces when not using a variant in the url. That was the original report (please don't throw multiple problems in a single report btw.) so narrowing back down to AdvancedSearch.

Change #1186977 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/AdvancedSearch@master] Use LanguageConverter in SearchableNamespaceListBuilder

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

@thiemowmde: Answering "why uselang=zh still shows the namespace names in English" here. The reason was mentioned in T401499#11074592.

To say it in my words: The site-wide content language $wgLanguageCode = zh is a parent language code. The namespace names in zh are in English on purpose, to prevent URLs from changing depending on the variant. Most users use one of the variants zh-xx when using the website, and they will see localized namespace names (e.g. "Wikipedia" is "维基百科" in zh-hans, and "維基百科" in zh-hant; notice "维" and "維").

When seen as a variant language code, zh is called "不转换" (non-converting) in the interface. When the zh variant is selected, users will see a mixture of Traditional and Simplified Chinese characters in articles due to the diverse contributor background. LanguageConverter will process the text so that it mostly conforms to the user-selected variant (zh-cn, zh-tw, etc.).

Change #1188369 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/core@master] Better docs for SearchEngineConfig::searchableNamespaces

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

Change #1188369 merged by jenkins-bot:

[mediawiki/core@master] Better docs for SearchEngineConfig::searchableNamespaces

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

Change #1186977 merged by jenkins-bot:

[mediawiki/extensions/AdvancedSearch@master] Use LanguageConverter in SearchableNamespaceListBuilder

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

I tried this on the beta cluster. Unfortunately, it seems using SpecialPage::getLanguage() is not the correct way to initialise LanguageConverter, as it does not use MediaWiki:Conversion-nsx/xx (same cause as T401493).

Compare
https://zh.wikipedia.beta.wmcloud.org/w/index.php?title=Special%3ASearch&search=a&ns0=1&fulltext=1&uselang=zh&variant=zh-cn
and
https://zh.wikipedia.beta.wmcloud.org/w/index.php?title=Special%3ASearch&search=a&ns0=1&fulltext=1&uselang=zh-cn&variant=zh-cn
The former correctly shows "维基百科讨论" (from MediaWiki:Conversion-ns5/zh-cn), while the latter shows "Wikipedia讨论". Normally users set the UI language and the content variant to the same language code.

Yeah, the fix didn't work as it used the wrong Language object.

Yeah, the fix didn't work as it used the wrong Language object.

So it needs to use the ContentLanguage object ?

T351170 shows an example of using the site content language to initialise LanguageConverter. It suffice for the Chinese wikis, though it won't work on some presumptive multilingual wiki that sets $wgLanguageCode to English while supplying MediaWiki:Conversion-nsx. I am not sure if such wiki exists.

Maybe it's time to get rid of language-converter-only namespace display names.

Change #1189980 had a related patch set uploaded (by TheDJ; author: TheDJ):

[mediawiki/extensions/AdvancedSearch@master] Use content language for SearchableNamespaceListBuilder

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

tested this locally, and it does seem to work when following the steps from T401499#11196183