Gamepedia Help Wiki
mNo edit summary
Line 4: Line 4:
 
|link=[[mediawikiwiki:Extension:Translate|MediaWiki.org]]
 
|link=[[mediawikiwiki:Extension:Translate|MediaWiki.org]]
 
|desc=Special page for translating MediaWiki and beyond
 
|desc=Special page for translating MediaWiki and beyond
  +
| ucp = yes
 
}}
 
}}
   

Revision as of 19:20, 3 December 2020

Translate is an extension which, as an alternative to the standard method of translation, allows a wiki to be multilingual on a single domain. It is generally not recommended for use on Gamepedia, however there are some exceptions of wikis which use it, notably the Feed the Beast Wiki.

It is part of the MediaWiki Language Extension Bundle which also includes the Babel, CLDR, CleanChanges, LocalisationUpdate, and UniversalLanguageSelector extensions.

Basic usage

Markup

Translate uses its own custom tags and syntax for translations. Pages are "marked for translation" inline within the page text by wrapping the text to be translated with <translate>. Generally, only raw text should be marked for translation. Only translation administrators can mark pages for translation. Each time a page is edited, it will have to be remarked. The text inside the translate tags is able to be translated into any language, while the rest of the text serves as a "template" for the translated versions of the page.

Marking a page for translation will add special HTML comments denoting translation units. The translation units will be made into subpages of the page, for example, the first translation unit, for English, will be "Page/1/en". The page title will always be able to be translated, without any special markup. Its translation unit is "Page display title", so its English version is "Page/Page display title/en". The full version of the page is available at "/language code", for example, "Page/es" for the Spanish version of the page.

Generally placed at the bottom of the page, a <languages /> tag is used to allow users to easily switch between different language versions of the page.

Unless you know what you are doing (are a translation administrator), do not erase or edit any of the markup, including the translate tags, the HTML comments, and the languages tag.

Example

The base page:

{{Infobox
|name=Test Page
|mod=Test Mod
|lore=This is a description
}}

This is a page that can be translated.

After being prepared for markup:

{{Infobox{{L}}
|name=<translate>Test Page</translate>
|mod=<translate>Test Mod</translate>
|lore=<translate>This is a description!</translate>
}}
<translate>
This is a page that can be translated.
</translate>
<languages />

After being marked for translation:

{{Infobox{{L}}
|name=<translate><!--T:1--> Test Page</translate>
|mod=<translate><!--T:2--> Test Mod</translate>
|lore=<translate><!--T:3--> This is a description!</translate>
}}
<translate>
<!--T:4-->
This is a page that can be translated.
</translate>
<languages />

Note the use of {{L}}. This is not a magic word, but a template. It can technically be named anything, but "L" is an apt shorthand term, useful for its high usage. It is used to return the current page's language code or fallback. It is placed at the end of template transclusions (and links) is necessary in order to transclude (or link) the translated version of the page. For example, on the English version of the page, it will transclude {{Infobox/en}}, or on the Spanish version, {{Infobox/es}}, and so on. When this is used, the template must be also marked for translation and available in those languages. For this reason, frequently used templates are the most important things to translate first and keep up to date. Templates which don't need to be translated, for example a template which simply formats provided text, do not need to be transcluded at their specific language; they can remain non-translatable.

For an example {{L}} template, see the Feed the Beast Wiki's L template.

Translation

Translating pages is a much simpler process.

If a page can be translated, there will be "Translate this page" link at the top. (If it also says that the page needs to be re-marked up, alert a translation admin.) Clicking the link will open the user to the Special:Translate page, where they can select a language and go through each translation unit.

If the page is not able to be translated, make a request to a translation administrator.

See also