Meta:Правила интернационализации
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 are already complete, please refrain from performing an edit which would make them obsolete, even if the <translate> tagging does not follow these guidelines. |
Основные правила
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 do the job instead.
Main new 2020 syntax requirements
- If you want to split a list into several units, do not put linebreaks inside of texts which should become one unit. You should also exclude bullet points/numbering hashtags from the
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, like1=
).
Примеры сегментации
Плохой синтакс | Хороший синтакс |
---|---|
== <translate>Заголовок раздела</translate> == <translate>Это параграф.</translate> <translate>Это другой параграф.</translate> {{Шаблон}} == <translate>Другой заголовок<translate> == |
<translate> == Заголовок раздела == Это параграф. Это другой параграф. </translate> {{Шаблон}} <translate> == Другой заголовок == </translate> |
<translate> * Это длинный список: ** В этом списке больше чем 160 слов, ** или более восьми пунктов. </translate> <translate> * Поэтому лучше разделить этот список на несколько частей. * При этом мы должны добавить звёздочки (астериски) из переводческих меток to keep the list accessible. </translate> |
* <translate>Это длинные список:</translate> ** <translate>В этом списке больше чем 160 слов,</translate> ** <translate>или более восьми пунктов.</translate> * <translate>Поэтому лучше разделить этот список на несколько частей.</translate> * <translate>При этом мы должны добавить звёздочки (астериски) из переводческих меток to keep the list accessible.</translate> |
Особые элементы
Ссылки
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 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
.
Плохой синтакс | Хороший синтакс |
---|---|
<translate> Это текст с [[внутренней ссылкой]] и внешней [https://openstreetmap.org ссылкой]. </translate> |
<translate> Это текст с [[<tvar name=1>Special:MyLanguage/internal link</tvar>|внутренней ссылкой]] и [<tvar name="url">https://openstreetmap.org</tvar> внешней ссылкой]. </translate> |
Категоризация
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.
Плохой синтакс | Хороший синтакс |
---|---|
<translate>[[Category:Wikipedia]]</translate> |
[[Category:Wikipedia{{#translation:}}]] |
Изображения
Предпросмотры и большие изображения
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}}
.
Плохой синтакс | Хороший синтакс |
---|---|
<translate> [[File:пейзаж.jpg |thumb |left |alt=закат |Фото прекрасного пейзажа]] </translate> |
[[File:пейзаж.jpg |thumb |{{dirleft}} |alt=<translate nowrap>закат</translate> |<translate>Фото прекрасного пейзажа</translate>]] |
[[File:Скриншот Википедии на английском.png|thumb|right|<translate>Главная страница Википедии</translate>]] |
<translate> [[File:Скриншот Википедии на английском.png|thumb|Главная страница Википедии]] </translate> |
Иконки
Inline icons may be simply wrapped in a <tvar name="img">
.
Плохой синтакс | Хороший синтакс |
---|---|
<translate> [[File:pretty hello word.png|alt=Hello everybody!]], [[File:смайлик.png|alt=🙂]] Как дела? </translate> |
<translate> [[File:pretty hello word.png|alt=Hello everybody!]], <tvar name="icon">[[File:смайлик.png|alt=🙂]] Как дела? </translate> |
Переменные перевода
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).
Названия переменных перевода
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…).
Плохой синтакс | Хороший синтакс |
---|---|
[[<tvar name="HelpLink">Special:MyLanguage/Help:Links|См. справочную страницу]] |
[[Special:MyLanguage/Help:Links|См. справочную страницу]] |
The meeting will take place on <tvar name=1>{{dateT||9|24}}</tvar> on <tvar name=2>{{int string|Zoom}}</tvar>.
|
The meeting will take place on <tvar name="date">{{dateT||9|24}}</tvar> on <tvar name="software">{{int string|Zoom}}</tvar>.
|
Avoid using spaces, underscores or letters with diatrics in tvar
names as well.
Плохой синтакс | Хороший синтакс |
---|---|
<tvar name="max_count of café">84</tvar> cafés
|
<tvar name="max-count">84</tvar> cafés
|
Шаблоны
You may prepare a template for translation like any page, but you should ensure the “Включить для этой страницы возможность раскрытия (трансклюзии) шаблонов с учётом перевода” 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 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}} }}