Page MenuHomePhabricator

Create API to fetch MediaWiki's language fallback tree structure
Closed, ResolvedPublic

Description

add listing of fallback language to SiteInfo/General

I think it would be nice to know which language is the fallback language ($fallback in Message.php).
This information can be used e.g. by bots to know which language should by used on edit summary when there is no translation for the primary language.
I think it should by added to the gernal information part of Siteinfo.

I've created a patch which lists all fallback language as an array by requesting action=query&meta=siteinfo&siprop=general.


Version: unspecified
Severity: enhancement

Attached:

Details

Reference
bz18634

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:34 PM
bzimport set Reference to bz18634.

(In reply to comment #0)

Created an attachment (id=6075) [details]
add listing of fallback language to SiteInfo/General

I think it would be nice to know which language is the fallback language
($fallback in Message.php).
This information can be used e.g. by bots to know which language should by used
on edit summary when there is no translation for the primary language.

If this is about MediaWiki messages, you can do this by just using list=allmessages&amlang=whatever&ammessage=messagename , and the fallback chain will automatically be honored.

I think it should by added to the gernal information part of Siteinfo.

I don't think so, because this way you'd only get information about the language that happens to be the site language. There should be a way to get it for all languages. I'm not sure what the right place to add this would be, I'll have to think about that.

(In reply to comment #1)

I don't think so, because this way you'd only get information about the
language that happens to be the site language. There should be a way to get it
for all languages. I'm not sure what the right place to add this would be, I'll
have to think about that.

The fallbacks are cached individually in memcached. In the future we may support custom fallback languages per user.

(In reply to comment #2)

The fallbacks are cached individually in memcached. In the future we may
support custom fallback languages per user.

My intention was more to get the site fallbacks and not user specific fallbacks because as mentioned above i would like to have the information for choosing the language for edit summary (e.g. my bot has no "als" template but its better to use "de" instead of the "en" one) and not for displaying customized messages to me. If the individual lang is "zh" this would end up in bad summary results on "als" projects.

Roan, Can this patch be used, or is it scrap?

So the request is to expose the fallback tree MediaWiki has through an API so that bots can use the same tree for their systems.

Changing summary accordingly.

This bug is closely related to bug 30216.

The patch seems to work fine for the moment

Applied in r93968