User:APaskulin (WMF)/Translation notes

From mediawiki.org

This page contains rough notes about working with translation markup on MediaWiki.

Sentences and paragraphs[edit]

It is preferable to have one sentence per translation unit. The easiest way to do this is to have each sentence be its own paragraph. In this example, T:53 and T:54 are separated by a new line, creating them as separate translation units within one set of translate tags.

<translate>
=== Example 3: Missing and invalid titles === <!--T:16-->

<!--T:53-->
Titles that don't exist or are invalid will have a <code>missing</code> or <code>invalid</code> attribute set in the response.

<!--T:54-->
In output formats that support numeric array keys, missing and invalid titles will have negative page IDs.

==== GET request ==== <!--T:24-->
</translate>

If your task is to add a new paragraph that contains two sentences, the best option is to add translate tags:

<translate>
=== Example 3: Missing and invalid titles === <!--T:16-->

<!--T:53-->
Titles that don't exist or are invalid will have a <code>missing</code> or <code>invalid</code> attribute set in the response.

<!--T:54-->
In output formats that support numeric array keys, missing and invalid titles will have negative page IDs.
</translate>

<translate><!--T:92--> In some cases, a title can be viewed by a user but cannot be accessed by the API, such as pages that mirror content from another wiki.</translate>
<translate><!--T:93--> These titles will have a <code>known</code> attribute set in the response.</translate>

<translate>
==== GET request ==== <!--T:24-->
</translate>

Variables[edit]

Variables names should be unique within a translation unit. They don't have to be unique within the entire page. See the variables in the previous example.