Page MenuHomePhabricator

Make {{#translation}} help with transclusion of templates in correct language
Closed, DuplicatePublic


Currently, this function is worked for currrent page only:
called as {{#translation:}} and is returned "/code", if page is translation, or empty string otherwise.

Proposed update for ability to using this function for specified target page, as {{#translation:pagename}} or {{#translation:namespace:pagename}}.

This will be useful for eliminate widely used templates {{ifTranslation}}/{{ifNotTranslation}}, {{TNT}}/{{TNTN}} and {{Ll}}.

Taret result for my proposal:

  1. if current page is translation, and {{#translation:}} is returned "/code", then {{#translation:pagename}} should be return "pagename/code" (if this page is exist) or "pagename" otherwise;
  1. if current page is _not_ a translation, and {{#translation:}} is returned empty result, {{#translation:pagename}} should be return "pagename"

Note: maybe this should be separate magic word, as '#tlink' or '#tl' (or simple create these short aliases for this function)?

Version: unspecified
Severity: enhancement
See also: T47096: Add a way to transclude template or other page in the correct language of which this is one proposed solution



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:44 AM
bzimport set Reference to bz71114.
bzimport added a subscriber: Unknown Object (MLST).

Can you explain me how exactly could the templates be replaced with this magic word?

For TNT, would it work like this:
If I am on page, Foo/fi would {{#translation:Template}} return Template/fi if that page exists and Template otherwise? Then you would call it as {{{{#translation:Template}}}}.

What about the other templates? I'm not familiar with what they do.

Yes; explanations:

{{TNT|Template}} > {{ {{#translation:Template}} }}

{{TNTN|Template}} > {{#translation:Template}} (currently, these same, but without transcluding)

{{Ll}} will receive the code more simple, by eliminating calls {{tntn}} (see )

{{ifTranslation}}/{{ifNotTranslation}} - they are nothing to do with, I was mistaken ;) But they used Module:Template_translation (see - maybe it's code also possible to simplify (if this feature has available through API)?

Nemo_bis renamed this task from Update {{#translation}} parser function in the Translate extension to Make {{#translation}} help with transclusion of templates in correct language.Sep 22 2015, 12:52 PM
Nemo_bis set Security to None.
Nemo_bis updated the task description. (Show Details)

Since this is basically asking for the same thing as T47096, I am merging it and considering this solution.