メタ:国際化ガイドライン

This page is a translated version of the page Meta:Internationalization guidelines and the translation is 42% complete.

メタウィキの趣旨とは多言語版ウィキである点で、ほとんどのページは翻訳対象とみなされ実際に訳されています。翻訳拡張機能を介して翻訳対象に指定するには、対象のページを<translate>...</translate> でタグ付けして(つまり国際化する ため)翻訳管理者の手で翻訳のマークアップ を受けます。このページではメタウィキにおけるページの国際化に関するガイドラインを提供します。

一般的なガイドライン

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, like 1=).

Segmentation examples

不適切な構文 良い構文
== <translate>節の見出し</translate> ==
<translate>これは段落です。</translate>

<translate>これは別の段落です。</translate>

{{Template}}

== <translate>Another heading<translate> ==
<translate>
== 節の見出し ==

これは段落です。

これは別の段落です。
</translate>

{{Template}}

<translate>
== Another heading ==
</translate>
<translate>
* これは長いリスト:
** このリストには160以上の単語があるか、
** 8個以上の項目があります。
</translate>
<translate>
* ですので、いくつかの小さな集団に分割することをお勧めします。
* ただし、リストにアクセスしやすくするために、翻訳タグから箇条書きを除外する必要があります。
</translate>
* <translate>これは長いリスト:</translate>
** <translate>このリストには 160 以上の単語があるか、</translate>
** <translate>8個以上の項目があります。</translate>
* <translate>ですので、いくつかの小さな集団に分割することをお勧めします。</translate>
* <translate>ただし、リストにアクセスしやすくするために、翻訳タグから箇条書きを除外する必要があります。</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>
This is a text with an [[internal link]] and an [https://openstreetmap.org external link].
</translate>
<translate>
This is a text with an [[<tvar name=1>Special:MyLanguage/internal link</tvar>|internal link]] and an [<tvar name="url">https://openstreetmap.org</tvar> external link].
</translate>

Categorization

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:landscape.jpg |thumb |left |alt=sunset |Photo of a beautiful landscape]]
</translate>
[[File:landscape.jpg |thumb |{{dirleft}} |alt=<translate nowrap>sunset</translate> |<translate>Photo of a beautiful landscape</translate>]]
[[File:English Wikipedia screenshot.png|thumb|right|<translate>Wikipedia homepage</translate>]]
<translate>
[[File:English Wikipedia screenshot.png|thumb|Wikipedia homepage]]
</translate>

アイコン

行内にアイコンを置くには、前後を<tvar name="img">で挟めば大丈夫です。

不適切な構文 良い構文
<translate>
[[File:pretty hello word.png|alt=Hello]] everybody! [[File:smiley.png|alt=🙂]] How are you?
</translate>
<translate>
[[File:pretty hello word.png|alt=Hello]] everybody! <tvar name="icon">[[File:smiley.png|alt=🙂]] How are you?
</translate>

翻訳の変数

Translation variables (</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}}),
  • 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|See help page]]
[[Special:MyLanguage/Help:Links|See help page]]
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

テンプレート

ほかのページの同様に、テンプレートにも翻訳準備ができますが、翻訳対象にマークアップする段階では「このページの翻訳を意識した参照読み込みを有効にする」チェックボックスにレ点を入れるのを忘れてはいけません。

もしも、そのテンプレートが翻訳対象外のページに採用されると予測する場合(たとえばe.g. 利用者ページ)でも、やはり翻訳が必要だと判断したら、考え方を変えて2021年以前の裏技を使い、以下のコードにあるuselang={{PAGELANGUAGE}}uselang={{int:lang}} に置き換えてください。

2021年以前の裏技

MediaWiki 1.36.0-wmf.32(2021-02-23)以前は、英語版のページにテンプレートそのものではなく、必ずテンプレートの/en 下位ページを書き込むことが求められました。

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.

もう1つの方法は、テンプレートを編集してそれ自体に {{TNT}} と自称させることでした。この達成には、テンプレートのコード全文をスイッチ内に配置して空の translate タグを評価させるために既定の {{TNT}} と呼ばれる事例を転用する必要があります。

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

関連項目