Page MenuHomePhabricator

Inconsistent namespace display names between HTML and JavaScript in NamespaceInputWidget
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What should have happened instead?:

  • The namespace names in HTML and JavaScript should be consistent.
  • They should both display in the UI variant language instead of site language.
  • They should both respect MediaWiki:Conversion-ns{ns_id}/{lang_tag} system messages. (display 维基百科讨论 instead of Wikipedia讨论)

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
146aca8 (but this issue has been present for quite some time)

Other information (browser name/version, screenshots, etc.):
Before this consistency was introduced it's likely to show both localized aliases.

Event Timeline

Probably caused by missing handling of MediaWiki:Conversion-ns#/* system messages.

It appears that "Wikipedia讨论" is taken from wmf-config/core-Namespaces.php (see https://noc.wikimedia.org/wiki.php?wiki=zhwiki#wgNamespaceAliases) . However local MediaWiki:Conversion-ns5 and variants use "Wikipedia讨论" "维基百科讨论".

I appears that "Wikipedia讨论" is taken from wmf-config/core-Namespaces.php (see https://noc.wikimedia.org/wiki.php?wiki=zhwiki#wgNamespaceAliases). However local MediaWiki:Conversion-ns5 and variants use "Wikipedia讨论".

Please double check your input, as I think all places you referred are completely using Chinese characters.

Oops sorry, I must have hallucinated those.

Then I wonder where is that "Wikipedia讨论" configured. Using the MediaWiki Codesearch, the only occurrence is at Parsoid's baseconfig/zhwiki.json. The README file under that directory says it's generated with namespacealiases API call, which I can reproduce. But I have not traced further.

I found that "Wikipedia讨论" comes from the templates of NS_PROJECT_TALK in MessagesZh_hans.php or MessagesZh_hant.php. It gets formatted with $wgMetaNamespace which is "Wikipedia", by MediaWiki\Language\Language::fixVariableInNamespace.

@Func would you like to have a look? I think the logic of MediaWiki\Html\Html::namespaceSelectorOptions can be copied there.

Winston_Sung renamed this task from Inconsistent namespace display names between HTML and JavaScript in NamespaceInputWidget to Inconsistent namespace display names between HTML and JavaScript in NamespaceInputWidget, should both display in UI variant language instead of site language.Aug 3 2025, 4:09 PM
Winston_Sung updated the task description. (Show Details)
Winston_Sung renamed this task from Inconsistent namespace display names between HTML and JavaScript in NamespaceInputWidget, should both display in UI variant language instead of site language to Inconsistent namespace display names between HTML and JavaScript in NamespaceInputWidget.Aug 3 2025, 4:12 PM
Winston_Sung updated the task description. (Show Details)
Winston_Sung updated the task description. (Show Details)

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

[mediawiki/core@master] NamespaceInputWidget: Use names in the preferred language variant

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

Change #1176203 merged by jenkins-bot:

[mediawiki/core@master] NamespaceInputWidget: Use names in the preferred language variant

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

Should wgFormattedNamespaces in JS mw.config (doc) get the same treatment? Currently it is also populated with content language and Language::getFormattedNamespaces() in ResourceLoader.php. The recent changes page mw.rcfilters.js uses this API to obtain the namespace list. However such behavior change could potentially break some scripts on Chinese wikis.

(Or wait and see if they are willing to add a new API, as I just proposed in T174057#11071236)

@Scardenasmolinar I object to this merger, as the original issue here is specific to the implementation of one widget regarding the usage of LanguageConverter, and the fix is mostly complete (except for the case where zh-xx UI language is used with non-zh site content language).

T174057 is about using UI language instead of content language for namespace names in general (although I acknowledge it might not be too related to the Recent Changes interface itself, you can undo the project addition I did). T401499 is about the lack of functionality in Extension:AdvancedSearch to use UI language or variant of content language in namespace names. This task does not seem to encompass them, especially T174057.