Template translation experiment
Admins: please do not delete this page for now (see the link above).
This experiment is a proof-of-concept of a translation system where the templates can be transcluded in the correct language (either the user language or the page language). This could be useful for multilingual wikis as Meta or Commons.
Although this works in theory and on my test wiki, this doesn’t work well here on Meta because of bug 54579, and partly because of bug 46925.
Try the different situations
editOpen the following links, corresponding to various situations:
Visualise the result
editLanguages: wiki="en" page="en" interface="en"
Autotranslated template in the page language: "{{Template translation experiment (page language)}}
" gives:
Date: 12 December 2013
Number: 857,201.19Autotranslated template in the user interface language: "{{Template translation experiment (user language)}}
" gives:
Date: 11 December 2013
Number: (not possible after the documentation to use {{formatnum:}} with an arbitrary language.)Technically
editThe templates are always called with {{Template name}}. Depending of the template, it will be displayed either in the user language or the page language. It is also possible to call a specific language: {{Template name/fr}}.
The first line of the autotranslated template is:
{{#if:{{#invoke:Template translation|getFrameLanguageSubpage}}|
(it is possible to add <nowiki> sections, for exemple with <languages />.)
The body of the template is translated using the <translate> tags and the Translate extension. It is even possible to call a subtemplate "/layout" to separate the layout from the texts.
The last line of the autotranslated template is:
|{{Template name/{{Fallback|Template name}}}}}}
in order to display the template in the user interface language. To display it in the page language, the {{Fallback}} template must be given {{CURRENTCONTENTLANGUAGE}} as second parameter.
Internally, a template called with {{Template name}} will detect that no specific language is requested (i.e. called as "multilanguage"), so it will call a language-specific instance as specified by the {{Fallback}} template (the one on Commons is much more elaborated than the one on Meta, and MediaWiki also now give the fallback chain in Lua). Then, when a language-specific instance is requested, it is displayed.
Discuss
editThe discussion around this experiment is on Meta talk:Babylon#Improve the template translation, but feel free to discuss on this talk page or on the translators-l mailing list.