Meta:Internationalization guidelines

(Redirected from I18n)
Other languages:
English • ‎français • ‎polski • ‎português do Brasil • ‎עברית

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 guidelinesEdit

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 requirementsEdit

  • 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 elementsEdit

LinksEdit

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 name=1> … </tvar> (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.

CategorizationEdit

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 variablesEdit

Translation variables (<tvar name=name></tvar> 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 name=attr>class="css_class" style="background-color:blue"</tvar>>hello</span>),
  • template name and parameters (e.g. {{<tvar name=1>center|5px</tvar>|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 namesEdit

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.

TemplatesEdit

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 hacksEdit

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}}
}}