Help talk:Extension:Translate/Page translation administration

Example templates made by the community: --Nemo 19:35, 22 March 2013 (UTC)
 * m:Template:Langcat for calling right category,
 * m:Template:Localized media,
 * m:Template:TNT for templates.

Proposal: adding and   pseudo-elements
Something missing: I's like to have the following syntaxes supported and recgnized by the tool when marking pages:

 &lt;!--T:ins&gt; some wiki text to insert into translated subpages, but ignored when rendering the base source page &lt;/--&gt; &lt;T:del&gt; some wiki text to remove in translated subpages, but rendered in the base source page &lt;/&gt;

These two kinds of pseudo-elements could be outside of translate tag pairs, but if they are, the "T:ins" would be visible as "$placeholders" in translation units, and the "T:del" would be invisible (they are only in the source, never in translations).


 * Notes
 * Insertions are placed within special HTML comments in the source, but not the deletions; see below why.
 * But if these pseudo-tags are integrated in the MediaWiki parser as regular tags the tags and contents of T:ins will be silently discarded, but only the "T:del" open and close tags will be discarded, preserving their content.
 * It will no longer be necessary to mask the "T:ins" into pseudo HTML comments so the "T:ins" pseudo-element would become simply  (if using the short close tag) or   (more HTML- and XML-friendly, and allows easier parsing without counting open tags, notably if there are other competing MediaWiki extensions needing their own tags as well).
 * At the same time the special HTML comments for "T:id" used in source pages should become an "id=" attribute of the open "translate" tag (this would avoid cluttering the translation source pages with many line breaks and the many T:id special comments).
 * The usage of abbreviated close tags (already used for "tvar" pseudo-elements) should be deprecated using regular  instead of just , because they may be ambiguous or they may need to be counted if "tvar"s are mixed within the contents of "T:ins" or "T:del" pseudo-elements.
 * The "translate" and "tvar" tags should also be integrated as regular tags, so that they are silently discarded when transcluding a page.
 * Later MediaWiki could intepret all these tags directly to perform what currently performs (i.e. locating a translation subpage during template transclusion, and resolving language fallbacks): Media-Wiki should also integrate the "Special:MyLanguage/" prefix so that they become directly usable instead of using the utility  or this utility template would no longer need a Lua module but would simply add this special page prefix to the invoked template.

Commented example of usage of and   pseudo-elements
The purpose of this is to allow using for example a "TNT|" prefix in a source translation which would be removed from all generated subpages named with the /code suffix.

Let's say we want to make the following template "Mytemplate", translatable using a "/layout" subtemplate (we want to create "MyTemplate/en" or "/fr" and so on from the "MyTemplate" used as the source):

 &lt;noinclude&gt;&lt;/noinclude&gt;

We would first adapt this source page for translatability as:

 &lt;noinclude&gt;&lt;/noinclude&gt;

This means:
 * delete " " before the base template name
 * insert " " after the base template name
 * translate " " in the Translate tool interface used by translators, and insert its replacement in the generated subpages.
 * the template documentation (templates should have one) is shared between all its translated versions, by passing its doc name explicitly (the documentation may be translated separately using the same technics as the for base template!); this doc sharing is also useful of you want to create a "/sandbox" version of the base template, where it will display some basic autotests of rendering within the documentation itself (this documentation sharing may also be trancluded in the "/testcases" subpage using the same syntax of transclusion od the doc page, to exhibit the syntax to use in test cases).

When marking the source page for translation it becomes:

 &lt;noinclude&gt;&lt;/noinclude&gt;

Or it could also be:

 &lt;noinclude&gt;&lt;/noinclude&gt;

(so that if the "T:ins" is in the middle of a translate element, it will have an identifier usable in placeholders for editing translation units (here it would be the $1 placeholder)

Mediawiki still interprets this base source page without the full "T:ins" tag and its content, as it is within HTML comments, and will drop the leading "T:del" tag and its ending short tag (just like it drops the leading and final "translate" tags but keeps their contents), but not its content. So it will render for the base source page as if it was still like:

 &lt;noinclude&gt;&lt;/noinclude&gt;

When saving the generated "/en" subpage for English, it becomes exactly like the original untagged and untranslated version:

 &lt;noinclude&gt;&lt;/noinclude&gt;

When we translate the English unit "some text..." into French "un peu de texte...", the generated "/fr" subpage also becomes:

 &lt;noinclude&gt;&lt;/noinclude&gt;

Note that with such design, we don't have to clutter the code of the "/layout" template:
 * the "/layout" template contains NO translate tags at all, it is never the base for translations;
 * the "/layout" template remains fully editable but contains parameters surrounding default values in English; like  here;
 * the coders of the "/layout" template dont have to worry about the existence or not of other translations which are created independantly, the layout may then be blocked without blocking the Translate tool for the base template (if needed the base template could be bloked as well but not in cascade as it would forbid adding/modifying all translations;
 * and we can also still edit the /layout template as well as the base template to add new translatable items with defaults in English at any time. A translate admin can then mark only the base templates without having to look deeply into the ossibly complex "/layout" template.
 * we benefit of the separation of work between wiki template designers/coders, and the more competent translators in various languages. Translate admins don't have to inspect everything and don't need to be experts in Wiki-syntax: we can have translate admins for more languages.

Then we can invoke  directly. Note that due to the fact that "TNT" is no longer referenced in the subpages, there will never be any self-recursion if we invoke  to use the English version directly.

It then becomes possible to design the base template so that it will automatically use where needed and without risk that it self-recurses within the translated subpages that TNT will attempt to locate and load, because the invokation of TNT is deleted in subpages !!!

Verdy p (talk) 03:29, 24 January 2014 (UTC)

Why we need these new pseudo-elements ?
On Meta-Wiki, where these possiblities have been experimented with success, the absence of support of these pseuo-elements means that sometimes templates using the aboce technics to be fully autotranslatable offer absolutely no way to determine what code will be be also generated in subpages. We could rename the base template to recreate anoher base template calling TNT with the renamed template in parameter.

However this multiplies the number of subpages, and this would still break the existing code that currently use randomly either:
 * or  (both versions are working now interchangeably with the local version of the Lua module used on Meta-Wiki by m:Template:TNT)
 * or  directly.

But in the later case,
 * when transcluding directly the "/en" version, it contains the same code as what is found in the base template,
 * so the "/en" template version so it will still attempt to use "TNT" on the base template name,
 * then TNT will resolve the template to use possibly as the English version, so it will attempt to reinclude the "/en" version: we get a self-recursion, and a script error

The self-recursion of the same template (forbidden in Media-Wiki) occurs when trying to use  directly in a viewed page that is also in English. TNT has in this case absolutely no way to determne which other template to try, if it detects the error.

The direct tranclusion of the "/en" version in a (e.g.) German page will also use TNT that will resolve the translated template to use as "/de" version, there will be no self-recursion, but the template will appear in German even though the English version was requested !

The direct transclusion of the "/de" version in the same German page attempts to transclude directly the "/de" version of the template (it will also use TNT that will attempt to reinclude the same "/de" template), and will cause the self-recursion error, so this is absolutely not specific to English.

In addition, TNT is designed to render its given template preferably in the same language as the content language of the currently viewed page, not peferably the user language. Fallbacks will still apply to every prefered language specified or implied. So this is a generic problem.

We'll get the same problems if instead of using TNT with its default resolution, we pass it another prefered language. The effective target template (to be expanded by TNT), has no way of determining by itself in Media-Wiki syntax that it is being transcluded conditionally by TNT, possibly in a context where the same template is itself calling TNT! Simply because it cannot traceback its invokation chain before using TNT. MediaWiki also does not even allow the template to test this itself, the second invokation of the template will be blocked before its expansion, even if the parameters are different: MediaWiki forbids all self-recursions when expanding templates and block them early (including tail recursions which could produce infinite loops, very costly on server resources, even if they are given limited time and memory to complete or to be interrupted abruptly).

With "T;ins" and "T:del", it is simple to avoid making this test in the base template (the same test is also necessarily performed in the translated version, needlessly): the translated versions ("/en" included) to know if we must use TNT or not: the translated template will no longer call TNT, because this use of TNT has been removed in all the generated translated versions !!!

Alternative if we don't have these new pseudo-elements ?
Most often, trancluding  directly is wrong when it should be   only, so that English pages will get the English version of the template, German pages will get the German version...

This is eay to fix, but sometimes it may be desirable to force the language to render, using another syntax that will allow TNT to look for ths specific language version (before trying with fallbacks of this specified language): in that case the template should be invoked like  with the language code we really want to render, but this requires modification of templates.

Forcing the language to transclude may be wrong as well for another reason: the translation may have been deleted or still not created, and language fallbacks should still be used to find the most relevant translation. Using TNT will still be useful in that case.

In summary, pages should never transclude directly any language-specific version of any translatable template, and should only use the base template, passing it a parameter for the prefered language. The same is true when creating links to other content pages which will be translated (links should use "Special:Mylanguage/" to resolve the target according to the preferred user language).

Verdy p (talk) 06:29, 24 January 2014 (UTC)

Bad section heading recommendations
The recommendation for sections is clearly wrong, recommending that a &lt;translate&gt;...&lt;/translate&gt; span across multiple sections. This makes section editing a bit confusing in the source editor, in addition to making it much harder to drill down into editable bits in visual editor. --brion (talk) 17:05, 1 April 2016 (UTC)


 * The first "wrong" example appears to work just fine. If there's no objection I'll switch the recommendations. --brion (talk) 17:30, 1 April 2016 (UTC)


 * Per T131516 the obviously-correct markup breaks because of the "markup for translate" step inserting a newline into the section heading. (It's fine until you run that.) It's not possible to manually remove the newlines because the extension demands the newlines be there or it rejects your edit. This is clearly incorrect and should be fixed in the extension. --brion (talk) 17:40, 1 April 2016 (UTC)


 * Quite a bold statement. This is not the only case of newlines being meaningful in wikitext, the most important example being lists. See the discussion I started a while ago, [Wikitext-l] Have multiline tags not terminate the list item until the tag is terminated. Nemo 08:32, 2 April 2016 (UTC)

In any case, I believe the text and the example on the page say 2 different things. --Elitre (WMF) (talk) 09:17, 30 June 2016 (UTC)
 * I don't know where the doubt about the recommended tagging for section headers comes from, as I have explained it in multiple places why it is the only way that works well. I have clarified the wording based on your feedback. --Nikerabbit (talk) 08:29, 5 October 2016 (UTC)
 * It still conflicts with "Headers can in principle be tied to the following paragraph, but it is better to have them separated. This way someone can quickly translate the table of contents before going into the contents." Also, it would entail forcing people to come up with a different translation for the header every time, when in several cases (like Tech News, newsletters etc.) there are consolidated machine memory translations which are usable with just one click. --Elitre (WMF) (talk) 13:26, 11 October 2016 (UTC)
 * You must have been reading an old version of the page. The new version says ”Headers can in principle be tied to the following paragraph, but it is better to have them separated with an empty line.”. I just re-marked the page for translation. --Nikerabbit (talk) 14:27, 11 October 2016 (UTC)
 * Yes. The given example though still includes extra text, so my remark stands :) I also believe that section editing (with the visual editor) works with at least one of the "wrong" examples. --Elitre (WMF) (talk) 14:33, 11 October 2016 (UTC)
 * Empty line is a translation unit separator, so it would in fact create two different translation units. Of course there are known issues with parsoid&VE which makes the whole tag thing ugly there and inadvertently section editing might also work due to that. --Nikerabbit (talk) 14:50, 11 October 2016 (UTC)

About marking outdated translations
With new version, phrase "...and outdated translations will be replaced temporarily with the original source text." is obsolete. Currently, outdated translations not replaced, but highlighted. --Kaganer (talk) 16:44, 16 January 2017 (UTC)
 * I've attempted to explain "Invalidation" in the page. (diff) It was outdated in that section, and unexplained in general. Please sanity-check (and improve or fix errors), and then mark for translation once it's good to go. Thanks! Quiddity (WMF) (talk) 23:29, 21 March 2017 (UTC)

Is there any way to convey additional information to the translator?
For example of what I mean, see this edit on Commons. Andrybak (talk) 11:52, 11 September 2018 (UTC)
 * Change content of the relevant /qqq page (ie. c:Translations:Template:Move/i18n/14/qqq). Matěj Suchánek (talk) 14:20, 11 September 2018 (UTC)


 * Matěj Suchánek, thank you! Andrybak (talk) 02:14, 13 September 2018 (UTC)

Beginner and lost - help?
Hello,

The translation extension is great, but the doc page is very hard to read for me. I was not able to get even some core infos. So, I am asking for help with 2 things:
 * What should I do after adding translate tags to a page? I have to directly contact a translation admin of my choosing? Currently, I am trying to mark d:Wikidata:WikiProject_COVID-19 for translation.
 * I started a beginners manual to the extension:translate, to make it easier for newcomers. If you want to help writing it, it would be super welcome: User:TiagoLubiana/Beginners_guide_to_translation. It is still largely a stub.

Best, TiagoLubiana (talk) 19:35, 16 April 2020 (UTC)

Is this really correct?
I belive the segment about images is wrong, I think one should never include a full image in a translation unit as that would only create more work for the translators. Would would ever be the point of that? Either remove the image from a translation unit or only mark the description for translation. --Sabelöga (talk) 11:22, 9 November 2020 (UTC)
 * Some images may be localized (e.g. screenshots). --Pols12 (talk) 21:05, 26 January 2021 (UTC)

Linking to sections
It is documented in #Markup examples section, but I would like to make examples clearer.

I believe the anchors to be the best approach, since I expect  to be a fairly stable piece of code on the page, unlikely to be changed even if the section title is changed. Am I right in my assumptions here? how do you feel about anchors? Can we explicitly recommend using anchors?
 * When the link is left untranslated,  and   will not work on a language subpage, say, page/uk. We would like it to (T62544), but it is not working as of today.
 * One might leave the section name for the translators to localise. It may be done by giving the translators
 * the whole link:  or  ,
 * the section name only:.
 * Translators might want to have instructions to the unit, so that they know what they are expected to do. It will work, but the result is not cemented in time: as soon as the translation of the section name is changed for whatever reason, the link is broken.
 * Note: don't use, it doesn't work.
 * One might use anchors. With the anchor in use, one might go with.

If examples on this are worth being added to the page, can someone please do it more neatly than I managed to suggest here? I'm not feeling bold enough to edit 🙂, thank you. – Ата  (talk) 10:11, 11 August 2021 (UTC)


 * SGrabarczuk (WMF), Shirayuki, please have a look ↑. The markup on Reading/Web/Desktop Improvements/Frequently asked questions page made me draw your attention to this. Ата  (talk) 10:15, 11 August 2021 (UTC)
 * Hey @Ата, thanks for bringing this. I'm familiar with the issue, just don't know how to use the anchors. ¯\_(ツ)_/¯ SGrabarczuk (WMF) (talk) 12:11, 11 August 2021 (UTC)
 * The anchor has to be put right above the section title:

&lt;translate>

section
&lt;/translate>
 * and then the link to  will lead to this place on the page whatever the displayed section title is. See en:template:anchor for more. --  Ата  (talk) 12:50, 11 August 2021 (UTC)

References/footnotes?
There doesn't seem to be any guideline in this page that explains how to format references and footnotes. Is that on purpose? --Abbad (WMF) (talk) 16:59, 17 January 2022 (UTC).


 * It's not on purpose. I just don't if anyone has figured out the best practice for them. Nikerabbit (talk) 07:45, 19 January 2022 (UTC)
 * :) That's unfortunate. But also slightly consoling for the tough time I've had figuring it out. If you happen to have any related tips, I'd appreciate them --Abbad (WMF) (talk) 01:54, 30 January 2022 (UTC).
 * You could try asking the Meta translation admins in https://meta.wikimedia.org/wiki/Meta_talk:Babylon whether they have any experiences or examples of these. Nikerabbit (talk) 08:33, 31 January 2022 (UTC)