Meta:Internationalization guidelines

From Meta, a Wikimedia project coordination wiki
(Redirected from Internationalization)
Jump to navigation Jump to search
Other languages:
English • ‎français • ‎polski • ‎עברית

Meta-Wiki aims to be a multi-language wiki, so most pages are expected to be translatable and translated. To be translatable through Translate extension, a page should be tagged with <translate>...</translate> (i.e. internationalized) then marked for translation by a translation admin. This page aims to present guidelines for page internationalization on Meta-Wiki.

General notice: when translations have been already done, please avoid to perform any edit which would make them obsolete, even if tagging does not follow these guidelines.

General guidelines[edit]

Generally, you should follow Translate extension’s guidelines about marking a page for translation: when possible, please avoid to manually split translation units closing the translate tag, you should let empty lines make the job instead.

Main new 2020 syntax requirements[edit]

  • If you want to split a list in several units, beware of putting no new line character inside units. You should also exclude bullet point/hash from translate tag.
  • If you insert a translate tag inside a parameter value of a template call, ensure the parameter is named (else add a numeric name, like 1=).

Specific elements[edit]

Links[edit]

Any page which could be translated should be linked with Special:MyLanguage/ prefix, even if it not actually internationalized. The main pages which do not need this prefix are talk pages and templates without textual content. To make translation easier, please wrap target of internal links inside <tvar|1> … </> (tvar name can be a number only, this is sufficient).

For cross-wiki and external links, if a translation exists, you should not put the link target inside tvar. For example, if the page links a Wikipedia article, you should allow translators to link to equivalent article in their own language Wikipedia instead. Of course, if target website include a language detection system (like MediaWiki’s Special:MyLanguage/), you may use this system and put the full link inside tvar.

Categorization[edit]

You should exclude category declarations from translate tags. Instead, add {{#translation:}} after category name: [[Category:Target category{{#translation:}}]]. This way, only main English page is categorized inside target categories, translation pages are categorized in per-language categories.

Translation variables[edit]

Translation variables (<tvar|name></> syntax) should be used to hide text from translators in order to prevent them from translating it.

The following examples should be wrapped inside tvar:

  • automatically-localized or non-localizable link targets,
  • usernames,
  • numbers likely to change (they should be wrapped inside {{formatnum:}} then inside tvar),
  • tag attributes (e.g. <span <tvar|attr>class="css_class" style="background-color:blue"</>>hello</span>),
  • template name and parameters (e.g. {{<tvar|1>center|5px</>|hello}}).

The following examples should not be wrapped inside tvar:

  • people and place names (even if they are rarely translated, they may be transliterated),
  • XML tag without attributes, like <code> (translation interface handles them),
  • localizable link targets (e.g. links toward Wikipedia articles).

Translation variable names[edit]

To help translators, please keep tvar names as short and readable as possible. If translators don’t need to know their content, using numbered names is a good idea because digits are quick to type for most translators and are common in many languages (so that most beginners do not accidentally translate them).

However if tvar is inside a sentence, it should have an explicit name to allow translators to understand what it contains and so write it easily in the right place in their translation (it is pretty common for email address, URL, wikitext tag name…).

Avoid putting proper names (people, places…) inside tvar: even if they are rarely translated, as they may be transliterated in several languages.

You may put parts of complex wikitext or HTML inside tvar, but please ensure resulting wikitext for translators is balanced.

Templates[edit]

You may prepare a template for translation like any page, but you should ensure the “Enable translation aware transclusion for this page” checkbox is checked when you mark the page for translation.

If your template is expected to be included in non-translatable pages (e.g. user pages) and should be even translated in these pages, you can use pre-2021 hack with switch, replacing uselang={{PAGELANGUAGE}} with uselang={{int:lang}} in the code shown below.

Pre-2021 hacks[edit]

Before MediaWiki 1.36.0-wmf.32 (2021-02-23), you should ensure English pages include /en subpage instead of template directly.

One way was to replace each occurrence of {{my translated template|param}} with {{TNT|my translated template|param}}, except in templates or transcluded pages which should contain {{ {{TNTN|my translated template}} |param}} instead.

Another way was to edit the template to make it call itself {{TNT}}. To this end, you should put the full template code inside a switch which evaluated an empty translate tag, with a default case which called {{TNT}}.

{{#switch:<translate></translate>
|=<full template code>
|#default={{#invoke:Template translation|renderTranslatedTemplate|template={{subst:FULLPAGENAME}}|uselang={{PAGELANGUAGE}}|noshift=1}}
}}