Meta:Linee guida per l'internazionalizzazione
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.
For a step-by-step guide to marking a page for translation, see the tutorial.
General notice: when translations are already complete, please refrain from performing an edit which would make them obsolete, even if the <translate> tagging does not follow these guidelines. This would place an unnecessary burden on our translators, who are already voluntarily carrying a heavy workload. |
Linee guida generali
Generally, you should follow Translate extension’s guidelines about marking a page for translation. When possible, avoid manually splitting translation units using the </translate> tag; let empty lines split translation units instead.
Although you can edit translated content using the visual editor, you must use the source editor to add or change translation markup. To make it easier to add translation markup, use the buttons in the box under the editing interface.
Do not use section editing when editing translated pages since this adds extra whitespace to the page.[1] Always select the option to edit the entire page.
Esempi di segmentazione
| Sintassi corretta | Bad syntax |
|---|---|
Aggiungi i tag <translate> sulle nuove linee attorno all'intestazione e ai paragrafi.
<translate>
== Intestazione della sezione ==
Questo è un paragrafo.
Questo è un altro paragrafo.
</translate>
{{Template}}
<translate>
== Un'altra intestazione ==
</translate>
|
Il markup dell'intestazione (per esempio ==) deve essere incluso nelle unità di traduzione.
== <translate>Intestazione della sezione</translate> ==
<translate>Questo è un paragrafo.</translate>
<translate>Questo è un altro paragrafo.</translate>
{{Template}}
== <translate>Un'altra intestazione<translate> ==
|
Split list items into individual translation units without line breaks. Exclude list markup from the translation unit.
* <translate>Questa è un lungo elenco:</translate> ** <translate>Ci sono più di 160 parole nell'elenco,</translate> ** <translate>O ci sono più di 8 elementi.</translate> * <translate>Perciò è meglio dividerla in diverse unità più piccole.</translate> * <translate>Ma dobbiamo escludere i punti elenco dai tag di traduzione per mantenere l'elenco accessibile.</translate> |
Markup degli elenchi (per esempio: * o #) devono essere esclusi dalle unità di traduzione.
<translate> * Questa è un lungo elenco: ** Ci sono più di 160 parole in questo elenco, ** o ci sono più di 8 elementi. </translate> <translate> * Perciò e meglio dividerlo in diverse unità più piccole. * Ma dobbiamo escludere i punti elenco per mantenere l'elenco accessibile. </translate> |
Elementi specifici
Link
Links require special markup to link to the correct language variant of the target page. Use localized link syntax for any page that could be translated, even if it hasn't been marked for translation. Pages which do not need localized link syntax include talk pages and templates without textual content.
To link to a page on a multilingual wiki, prefix links with Special:MyLanguage/. To make translation easier, include only the link text in the translation unit, not the link target. If the link is part of a larger translation unit, like a paragraph, you can exclude the link target from the translation unit by wrapping it inside a translation variable (<tvar name=1> … </tvar>).
For a standalone link to a page on the same wiki, such as in a list or a table, you can use the localized link template to simplify the syntax. This works on Meta-Wiki, mediawiki.org, Outreach Wiki, and other wikis where this template is available.
For links to Wikipedia article, you should use {{lwp}} template for the target and wrap it inside a tvar. E.g. [[{{lwp|Rosa Parks}}</tvar>]] produces en:Rosa Parks in English pages and fr:Rosa Parks in French pages.
For other cross-wiki and external links, if a translation exists, you should not put the link target inside tvar. Of course, if the target website has a language detection system (like MediaWiki's Special:MyLanguage/), you may use this system and put the full link inside tvar.
| Sintassi corretta | Bad syntax |
|---|---|
To link to a page on a multilingual wiki, prefix the link target with Special:MyLanguage/, and add link text. Use a translation variable to ensure that only the link text is included in the translation unit.
<translate> Scopri di più riguardo [[<tvar name=1>Special:MyLanguage/Wikimedia projects</tvar>|i progetti Wikimedia]] e come richiedere un [[<tvar name=2>Special:MyLanguage/New project process</tvar>|nuovo progetto]]. </translate> |
Le variabili di traduzione devono includere solo la destinazione del link, non il testo.
<translate> Scopri di più riguardo [[<tvar name=1>Special:MyLanguage/Wikimedia projects</tvar>|i progetti Wikimedia]] e come richiedere un [[<tvar name=2>Special:MyLanguage/New project process|nuovo progetto</tvar>]]. </translate> |
For a standalone link to a page on the same wiki, such as in a list or a table, use Template:ll, and translate only custom link text. You can use |nsp=0 to simplify the link text by omitting the namespace.
<translate>
Vedi anche:
</translate>
* {{ll|Help:Contents|2=<translate>Help pages</translate>}}
* {{ll|Meta:Discussion pages|nsp=0}}
|
A parameter name (2=) is required when adding <translate> tags inside template syntax.
<translate>
Vedi anche:
</translate>
* {{ll|Help:Contents|<translate>Help pages</translate>}}
* {{ll|Meta:Discussion pages|nsp=0}}
|
For external links, exclude the link target from the translation unit using a translation variable.
<translate> Questo è un testo con un [<tvar name=url>https://openstreetmap.org</tvar> link esterno]. </translate> |
A translation variable is required to exclude the external link target from the translation unit.
<translate> Questo è un testo con un [https://openstreetmap.org link esterno] </translate> |
Categorizzazione
You should exclude category declarations from <translate> tags. Instead, add {{#translation:}} after the category name: [[Category:Target category{{#translation:}}]]. This way, only the main English page is categorized into the target categories, translation pages are categorized in per-language categories.
| Sintassi corretta | Bad syntax |
|---|---|
[[Category:Wikipedia{{#translation:}}]]
|
<translate>[[Category:Wikipedia]]</translate> |
Immagini
Miniature e immagini grandi
If the image can be localized (e.g. it contains some text and a translated version exists), it should be fully included in <translate> tags.
Else, you should only wrap alt= value in <translate nowrap> tags and caption in <translate> tags.
If left or right is used as image parameter: remove it if it is useless (thumbnails default to right in English), or replace it respectively with {{dirstart}} or {{dirend}}.
| Sintassi corretta | Bad syntax |
|---|---|
[[File:paesaggio.jpg |thumb |{{dirstart}} |alt=<translate nowrap>Il tramonto oltre le montagne</translate> |<translate>La foto di un paesaggio bellissimo</translate>]]
|
<translate> [[File:paesaggio.jpg |thumb |left |alt=Il tramonto oltre le montagne |La foto di un paesaggio bellissimo]] </translate> |
<translate> [[File:Screenshot dalla Wikipedia in inglese.png|thumb|alt=Homepage of English Wikipedia with featured article and news topics|Homepage di Wikipedia]] </translate> |
[[File:Screenshot dalla Wikipedia in inglese.png|thumb|right|alt=<translate nowrap>Homepage of English Wikipedia with featured article and news topics</translate>|<translate>Homepage di Wikipedia</translate>]]
|
Icone
Inline icons may be simply wrapped in a <tvar name="icon">.
| Sintassi corretta | Bad syntax |
|---|---|
<translate> [[File:pretty hello word.png|alt=Hello everybody!]], <tvar name="icon">[[File:smiley.png|alt=🙂]] How are you? </translate> |
<translate> [[File:pretty hello word.png|alt=Hello everybody!]], [[File:smiley.png|alt=🙂]] How are you? </translate> |
Translation variables
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 insidetvar), - tag attributes (e.g.
<span class="css_class" style="background-color:blue"</tvar>>hello</span>), - template name and parameters (e.g.
{{<tvar name=1>center|5px</tvar>|hello}}), - parts of complex wikitext or HTML (but please ensure the resulting wikitext for translators is balanced).
The following examples should not be wrapped inside tvar:
- people and place names (even if they are rarely translated, they may be transliterated),
- XML tags without attributes, like
<code>(the translation interface handles them), - localizable link targets (i.e. links to multilingual website).
Translation variable names
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 an email address, URL, wikitext tag name…).
| Sintassi corretta | Bad syntax |
|---|---|
[[<tvar name="1">Special:MyLanguage/Help:Links|See help page]] |
[[Special:MyLanguage/Help:Links|See help page]]
|
The meeting will take place on <tvar name="date">{{dateT||9|24}}</tvar> on <tvar name="software">{{int string|Zoom}}</tvar>.
|
The meeting will take place on <tvar name=1>{{dateT||9|24}}</tvar> on <tvar name=2>{{int string|Zoom}}</tvar>.
|
Avoid using spaces, underscores or letters with diacritics in tvar names as well.
| Sintassi corretta | Bad syntax |
|---|---|
<tvar name="max-count">84</tvar> cafés
|
<tvar name="max_count of café">84</tvar> cafés
|
Templates
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 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=).
If your template is expected to be included in non-translatable pages (e.g. user pages) and should be translated in these pages, you can use the pre-2021 hack with switch, replacing uselang={{PAGELANGUAGE}} with uselang={{int:lang}} in the code shown below.
Pre-2021 hacks
Before MediaWiki 1.36.0-wmf.32 (2021-02-23), you should ensure English pages include the /en subpage of a template instead of a 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>
|=<span lang="en" dir="ltr" class="mw-content-ltr"><full template code></span>
|#default={{#invoke:Template translation|renderTranslatedTemplate|template={{subst:FULLPAGENAME}}|uselang={{PAGELANGUAGE}}|noshift=1}}
}}