Page MenuHomePhabricator

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

Description

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

Details

Reference
bz71114

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).
Kaganer created this task.Sep 22 2014, 9:35 AM

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 https://www.mediawiki.org/w/index.php?title=Template:Localized_link&action=edit )

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

jhsoby added a subscriber: jhsoby.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 15 2015, 4:39 PM
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.

Restricted Application removed a subscriber: Liuxinyu970226. · View Herald TranscriptMar 23 2016, 7:55 AM