[go: up one dir, main page]

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

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

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.