Page MenuHomePhabricator

Provide a way to get localized namespaces names through the API
Open, Needs TriagePublic

Description

E.g. the dropdown at https://meta.wikimedia.org/wiki/Special:Contributions?uselang=de shows German translations for the namespaces. This doesn't appear to be accessible through the Siteinfo API.

I was thinking uselang=de should provide the localized names https://meta.wikimedia.org/w/api.php?action=query&meta=siteinfo&siprop=namespaces&uselang=de but I am told it probably makes more sense to introduce a dedicated parameter, maybe sinslang (siteinfo namespace lang), or something similar.

This may be as simple as using the requested language instead of the content language in ApiQuerySiteInfo: https://gerrit.wikimedia.org/g/mediawiki/core/+/7462d3075a23095fd627cebeb0f66e081ad2bede/includes/api/ApiQuerySiteinfo.php#287

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 19 2019, 4:13 AM

There is a siinlanguagecode parameter, but for namespaces there is no offical german translation, because that would not work in links.

I have no idea how to get it for a namespace dropdown

Anomie moved this task from Unsorted to Needs Code on the MediaWiki-API board.Jul 11 2019, 7:01 PM

meta=siteinfo&siprop=namespaces would not be the right place for this, as that's intended for returning namespace names that actually function on the wiki.

Normally the answer would probably be to use list=allmessages to fetch the relevant i18n messages, but the namespace names are not stored as i18n messages (they're separate i18n data).

It's a bit of a stretch, but probably the new meta=languageinfo would be the best place since in MediaWiki the namespace names are in fact "properties" of the language.