Template:Autotranslate

This template has been protected from editing to prevent vandalism.
Please discuss changes on the talk page or request unprotection.
Documentation​view · edit ·history · purge ]
This documentation is transcluded from Template:Autotranslate/doc​.
Uses Lua:
This template is used as a part of the larger mechanism to show a template content in the user's interface language. It allows you to set up set of language subtemplates and call proper subtemplate based on users chosen language. All parameters passed to Autotranslate will be passed to the subtemplates. See Help:Autotranslate for help on the whole process. In most cases to use this template, you can use the following code snippet:
{{Autotranslate|base={{subst:PAGENAME}}}}
The template automatically sets the following categories: Category:Autotranslated templates
Usage
{{Autotranslate |base= }}
Template parameters
ParameterDescriptionDefaultStatus
baseTranslations PageName of the template's translations page, like "Template:Information". Usually can use base={{subst:PAGENAME}}​.emptyrequired
...any additional parameter passed to {{Autotranslate}} will be passed to {{Autotranslate}}'s subtemplates. Parameter names are case independent and the subtemplates will only see lower case names.emptyoptional
langLanguagedisplay language
{{int:lang}}
optional
 Parameter text is empty
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData
TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.
Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template.
‎<nowiki>
-tags can be wrapped around the arguments, if required, to avoid templates being expanded.
Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw
‎<templatedata>
-tags into the Wikitext of the template, as described in various Wikipediae.
This template is used as a part of the larger mechanism to show a template content in the user's interface language. It allows you to set up set of language subtemplates and call proper subtemplate based on users chosen language. All parameters passed to Autotranslate will be passed to the subtemplates. See [[Help:Autotranslate]] for help on the whole process. In most cases to use this template, you can use the following code snippet:
Template parameters
This template prefers inline formatting of parameters.
ParameterDescriptionTypeStatus
...Unknownoptional
Translations Pagebase
Name of the template's translations page, like "Template:Information", or "Template:Information/i18n".
Auto value
{{subst:PAGENAME}}/i18n
Templaterequired
Languagelang
display language
Default
{{int:lang}}
Stringoptional
Additional information
The template is intended to be used in the following namespaces: the Template namespace
The template is intended to be used by the following user groups: no user group specified
Placement: At the top of the page
Relies on:
Module:Autotranslate
See also
{{LangSwitch}} for all-translations-on-one-page template i18n mechanism template
Localization
This template is not intended to be localized.
How to convert a template
Before you apply this template, first you have to prepare the template.
Pick a template
—See for example Template:Cc-by-1.0 before changes.
First you have to pick a template to autotranslate.
In this documentation, we will name our "selected template" as:
Template:Template name
See Commons:Template i18n for a list of templates needing translation or translated.
Create a layout template
—See for example Template:Apache/layout​.
You must create a layout template, named
Template:Template name/layout
, to contain the layout of all language versions of the template. The easiest way to do this is to copy a layout template of a similar template.
This template should not add any categories when transcluded.
Convert existing language versions
—See for example Template:Apache/en.
All versions must be subpages of
Template:Template name
, and his name must use the appropriate prefix, as used on Wikipedia when adding a new language –ISO 639 language code–.
For example, Spanish subpage must be named
Template:Template name/es
Usually the English language link to the main template –
Template:Template name
–. That is incorrect, point it to the
Template:Template name/en
subpage.
Each language version of the template should be checked and converted to use the layout template –
Template:Template name/layout
–.
Start with the English language version and compare it to the current template.
Note that everything that is not supposed to be included together with the template, like {{translated tag|cleanup}} or {{documentation}}, must be inside a <noinclude> tag.
Here is the syntax you must use for
Template:Template name/<prefix>
.
{{
Template name/layout

|text=<translated text of the template> |lang=<prefix> }}<noinclude> {{translated tag|license}} </noinclude>
Create a documentation page
—See for example Template:Apache/doc​.
Create a documentation page at
Template:Template name/doc
. This documentation page should include some code for creating language versions of the template. {{TemplateBox}} has a |il8n=autotranslate option which provides a standard explanation of how to localise an autotranslated template.
Convert the main template
—See for example Template:Apache.
The last step is to enable the template. Be sure to check everything before you enable the template. You can cause a really big mess! To enable the template, put this code in the template –
Template:Template name
–.
{{Autotranslate|base=​template name}}
See also
Help for choosing the right template for your use case:
I18n templates:{{Multilingual description|lang=
|de,en,default=​Deutsch/English
|fr=français
|...
}}
{{de|Deutsch}}
{{en|English}}
{{fr|français}}
...
{{LangSwitch|lang=
|de,en,default=​Deutsch/English
|fr=français
|...
}}
{{Autotranslate}}{{TNT}}
Recommended use atCategories, galleriesFile description pages (deprecated, can be safely replaced by {{Multilingual description}})Small templates, whenever the previous options are not suitable (removes the visual indication of the language before each translated text)Data tables with translated cells or larger templates, when used on pages that do not have language subpages (e.g. not having Main page/en, Main page/de) and where the language displayed will be automatically determined by the language set in user preferencesData tables with translated cells or larger templates, when used on pages that do have language subpages; most of the time these will be pages prepared with the Translate Extension
Requires JavaScript enabled for foldingYesNo
Folding can be disabled by userYesNo
Folding is done server-sideNoYes
Folding when at least n languages are provided1 (all translations are shown without folding if the preferred language selected by the user has no matching translation)41
Detection of duplicate, incorrect, or unsupported language codesYesNoYes
Allows the same translation to be used for several languagesYesNoYes
Supports language fallbacksNoYesNoYes
Collation order of languages (when not folded)Consistent order by native language name, languages grouped by script:
  • LTR scripts: Latin, Latin or Cyrillic, Cyrillic, Greek, other simple LTR alphabets (Armenian, Georgian, etc.), abugidas (North Indian, South Indian, other South-East Asian, etc.), syllabaries (European, American, African, Asian), Korean alphabets (basic Jamos, Hangul including some sinograms), Japanese syllabaries (including some sinograms), sinograms (including some syllabaries)
  • RTL scripts: Hebrew, Arabic, other RTL abjads (Divehi, etc.), RTL syllabaries (N'ko)
As provided by the user in the wikitext (any inconsistent order may be difficult to lookup visually)N/A
Search indexing issuesNo (all translations are included on the same page, however search results may be less relevant with many languages mixed)Yes (may not index all languages depending on search engines, unless there's a list of links for visiting other languages)Partially (where used; language subpages of templates are indexed)No (translated pages should include a <languages/> navigation bar for visiting other languages)
Page size issuesYes (may exhaust size or time limits in the wiki parser if many languages are included; larger pages to download for all visitors; slower navigation for visitors with slow Internet access; may be costly for visitors with limited data plans)No (only the content for the selected language or a suitable fallback language is present in the generated page)
Contains expensive parser functionsNoYes (unless there's an editable /lang subpage listing all the existing translations selected with a {{LangSwitch}})

Last edited on 6 November 2018, at 21:18
Files are available under licenses specified on their description page. All structured data from the file and property namespaces is available under the Creative Commons CC0 License; all unstructured text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and the Privacy Policy.
Privacy policy
Terms of Use
Desktop
HomeRandomNearbyLog inSettingsDonateAbout Wikimedia CommonsDisclaimers
LanguageWatchEdit