Module talk:Template translation

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search

Fallback[edit]

This module is getting more and more important and useful for the translation of the template through {{Translatable template}} or my experiment of auto-translatable templates. Thanks Verdy p for your modifications in adding a proper fallback to English when there is no translation (and checking if the /en subpage really exists since it is not always the case).

This can still go a step forward: since gerrit:101910 Lua has access to mw.language.getFallbacksFor(code), so this can be used to properly degrade the translation given the translated pages. A minor point to be warned is the last language in the fallback sequence is always 'en' since this fallback sequence is constructed for the translation of MediaWiki messages; on a wiki the last language of the fallback sequence must be the site-wide content language (yes, on multilingual Wikimedia wikis, the default language is always English, in for the sake of generality it cannot be assumed it is always that).

When such a function will be added, I guess it can replace {{Fallback}}, and particularly the Commons version, much more developed and used.

Additionnally, the internal fallback sequences of MediaWiki and the fallback sequences of commons:Template:Fallback should be compared and reconciliated, probably by opening bugs for MediaWiki and discuss about the better fallback sequences for each languages.

~ Seb35 [^_^] 17:46, 17 January 2014 (UTC)

I wrote a such a thing on a test wiki, mainly by splitting this.renderTranslatedTemplate into smaller private functions:
  • getTranslatablePage (which guesses the translatable "main" page depending of the arguments supplied to the module call; corresponds to the first third of renderTranslatedTemplate)); and
  • getTranslationFor (which constructs the fallback languages sequence and test if a translation exists for each one until one exists; corresponds to the second third of renderTranslatedTemplate).
I polish a bit my code before submitting it to avoid too much refreshing of pages on Meta.
~ Seb35 [^_^] 09:26, 18 January 2014 (UTC)
It’s on Module:Template translation/sandbox2 for now. ~ Seb35 [^_^] 16:56, 18 January 2014 (UTC)

Uses in the "Category" namespace[edit]

See Template_talk:Translatable_template#Template is not worked at the "Category:" namespace. --Kaganer (talk) 15:51, 18 January 2014 (UTC)