Page MenuHomePhabricator

Add a parser function to return the fallback language for a given language code
Closed, DeclinedPublic

Description

Right now Commons relies on templates like {{GetFallback}} and {{GetFallback2}} to retrieve fallback languages. These templates consist of hard-coded switch statements which have to be updated by hand.

It should be rather trivial to code a parser function which returns Language::getFallbackFor( $code ) so that such templates aren't necessary.


Version: unspecified
Severity: enhancement

Details

Reference
bz28596

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:31 PM
bzimport added a project: ParserFunctions.
bzimport set Reference to bz28596.

happy.melon.wiki wrote:

Surely what Commons actually needs is nice ways of doing internationalisation, not for even more of MediaWiki's dirty laundry to be exposed to compound the hacks it already uses?

Yes, there is definitely a bigger issue to solve here. Fixing this bug would only take 1 day, however, and would probably solve the transclusion limit problems currently happening on Commons. I disagree that it would compound the hacks. It would actually eliminate 1 of the hacks, but not the entire leaning tower of hacks. It might be a good interim fix until the bigger issues can be solved.

also: bug 23414, I do not know which is the better extensions.

Where is the MediaWiki's fallback code? We can at least synch commons templates with MediaWiki software, so it is consistent.

(In reply to comment #4)

Where is the MediaWiki's fallback code? We can at least synch commons templates
with MediaWiki software, so it is consistent.

See e.g. http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/languages/messages/MessagesNds_nl.php?view=markup , which has $fallback = 'nl'; near the top of the file.

Per Niklas: "Fallbacks are actually a list now, not a recursive tree you can just walk."

Scribunto now exposes this via mw.language.getFallbacksFor(). Adding a parser function to do it would seem to be clutter.