Page MenuHomePhabricator

localized transclusions
Closed, ResolvedPublic

Description

Author: monniaux

Description:
On commons etc. it would perhaps come handy to have localized transclusions: ex,
{{foobar}} would map to different templates (say, {{foobar.en}}, {{foobar.fr}})
depending on language choices.


Version: unspecified
Severity: enhancement

Details

Reference
bz1136

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 8:01 PM
bzimport set Reference to bz1136.
bzimport added a subscriber: Unknown Object (MLST).

Commons uses the templatename/langcode format now (eg. {{GFDL/de}}). It would be nice to be able to select which one to use: just linking them from the english version is not too user-friendly.

Maybe a new template modifier could be created for this: {{local:Template}} could look for the subpage corresponding to the interface language, then trying fallback languages (if any), and finally the base template.

This can be done already with something like {{ {{#ifexist:{{{1}}}/{{CONTENTLANGUAGE}}|{{{1}}}/{{CONTENTLANGUAGE}}|{{{1}}}}}, but doing it in the software would be surely more effective.

derfinn wrote:

{{CONTENTLANGUAGE}} is always 'en' in commons. This variable should stick to the userpreferences or '?uselang=de'. That would solve the problem, too.

robert wrote:

No, it shouldn't. The content language is the one set in the wikis configuration and this should be the same no matter what to ensure cache consistency. While Commons is indeed a multi-lingual wiki the content language in this context refers to the default.

It would of course quite easily be possible to develop a magic word that refers to the current users language, but again that would encouter cache problems. It is quite difficult to find a solution to this bug that ensures cache consitency and provides reasonable functionality -- I believe similar bugs like this have been closed in the past as LATER or WONTFIX.

JavaScript hacks can also be used, but this isn't very clean nor accessible.

There must be some to avoid cache problems, as {{intl:...}} already does this, except that it's constrained to the MediaWiki namespace.

This request is functionally equivalent to the {{USERIFCODE}} request (the requested functionality would be trivially implementable using something like {{foobar/{{USERIFCODE}}}}). So that I am marking it as a duplicate of bug 2085 (which is marked as WONTFIX).

  • This bug has been marked as a duplicate of bug 2085 ***