MEpedia:Template translation

This page is intended to keep track of the state of template translation on MEpedia and explain how template translation is accomplished.

Template status
The following tables list the template tags that should be translated. You can find a list of all language codes at MEpedia:Language codes. Where it says that "Foreign languages supported" is "all", it means at least the following 17 language codes: ar, da, de, es, fi, fr, it, ja, nl, no (or nn or nb), pl, pt, ru, sv, vi, zh-hans, zh-hant. (Why these languages? See "Prioritizing languages for translation".)

Using the MediaWiki: namespace for template translations
Small wikis like MEpedia use "Template:" pages that can accommodate any supported language. (There aren't separate "Template:" pages for each language.) Therefore, if there is any user interface message embedded inside the "Template:" page, it should be extracted to a "MediaWiki:" page so the software can translate it as needed. Here is the basic concept of using the MediaWiki: namespace to internationalize a template: Also note that interface messages in MediaWiki: can accept parameters. For example: This article may require cleanup to meet MEpedia's guidelines. The specific reason is: $1 Please help improve this page if you can. ( $2 )
 * Move the embedded interface message from the template to a MediaWiki: page, and create translations there. (e.g. ,  etc.)
 * Inside the template, replace the embedded interface message with the “int:” parser function. For example:
 * Assume that the contents of  contains the following:
 * Inside the template, you can then replace the embedded interface message with:

Resources for translation
In many cases, the template won't need to be translated from scratch. Translations can sometimes be adapted from www.TranslateWiki.net Also check Special:AllMessages, as there may already be a pre-translated interface message that can be used. There may be some minor customization needed. If a message needs to be customized, it is better to create a completely new interface message adapted from the pre-existing interface message. It is not a good idea to customize a pre-existing interface message that is used elsewhere, as that may conflict with the original intent of the pre-translated interface message.
 * Special:AllMessages
 * TranslateWiki

Translations without interface messages
The "MediaWiki:" namespace (interface/system message) method, described above, is the preferred way to do template translations, but if no system messages exist, and none can be found in translatewiki.net then they can be created within templates using Template:LangSwitch, which switches between different text depending on the current user's language code. If no translation is provided for the user's preferred reading language, it will default to the English text. (LangSwitch requires that special interface messages be set up for every possible language, such as MediaWiki:lang, MediaWiki:lang/fr, MediaWiki:lang/es, etc.)

Example use: Template:In_category

Text to copy-and-paste:

Templates that use Modules
Some templates use modules, these are written in Lua and may contain error messages, category names or other text. Translations can be done by using system messages from Lua
 * Message library commands - MediaWiki, eg


 * Language library commands - MediaWiki

Translating TemplateData for integration into Visual Editor
The "TemplateData" section of a template requires a different method of translating. Certain strings in the TemplateData allow for multiple translations to be specified. The following is an example: "date": {		"label": {			"en": "Year", "fr": "Année", "es": "Año", "de": "Jahr" },		"description": {			"en": "By default, the current year will be provided. You can specify a different year.", "fr": "Par défaut, l'année en cours sera fournie. Vous pouvez spécifier une autre année.", "es": "Por defecto, se proporcionará el año actual. Puede especificar un año diferente.", "de": "Standardmäßig wird das aktuelle Jahr angegeben. Sie können ein anderes Jahr angeben." },		"example": "2019", "type": "string", "autovalue": "", "suggested": true }

Bulk creating system messages
If other wikis have system messages with translations you want to use these can be easily exported into a file. This is quicker and less prone to errors than creating them one by one. Wikipedia supports over 400 languages to varying degrees, so each system message may have a very large number of translations. Administrator rights are needed to import them, so it is best if the same person does the export. Places to export translated system messages from include WikiMedia's Commons, MediaWiki, and (English, French, German, etc) Wikipedias may contain some.
 * First make a list of messages to export by searching for system messages, eg WikiMedia's Commons search, set to German (de), create a file containing a list of all system messages you want for all possible language codes (eg MediaWiki:donate_interface/aa, MediaWiki:donate_interface/ab), and save on your user area (use the tag to keep one per line), or just save elsewhere. The easier way to do this is to copy the language codes system messages and replace "lang" with the system message you want to add.
 * Make sure each system message has the prefix MediaWiki: and each is on a separate line
 * Use Special:Export on the wiki containing the messages, paste a list of the names in the box (one system message per line), pick latest versions only
 * Save the file that it creates
 * Go to Special:Import on MEpedia to import these, which may take several minutes
 * Make a note of any system messages containing errors, the log file in Special:RecentChanges should contain more info
 * Bear in mind some system messages are extremely short (2 characters) and will appear on the right of the screen because those languages are written right to left, eg MediaWiki:lang/arc