Changes
Jump to navigation
Jump to search
Template:Autotranslate/doc (view source)
Revision as of 02:48, 7 November 2018
, 02:48, 7 November 2018no edit summary
{{Lua|Module:Autotranslate}}
{{TemplateBox
|2 = ...
|2d-en = any additional parameter passed to {{tl|Autotranslate}} will be passed to {{tl|Autotranslate}}'s subtemplates. Parameter names are case independent and the subtemplates '''will only ''see lower case'' names'''.
|2d-td =
|2type =
|2def =
|2stat =optional-
|1 = base
|1d-en = name of the template, where it is being added, like "Template:Information". Usually can use <code><nowiki>base={{subst:PAGENAME}}</nowiki></code>.
|1d-td =
|1type = string
|1def =
|1stat = required
|3 = lang
|3d-en = display language
|3d-td =
|3type = string
|3def = <code><nowiki>{{int:lang}}</nowiki></code>
|3stat = optional-
|name = Autotranslate
|desc = 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:
<pre style="overflow:auto">
{{Autotranslate|base={{subst:PAGENAME}}}}
</pre>
|namespace = template
|usergroup =
|placement = top
|usage-notes =
|type =
|example =
|example-value =
|i18n-method = -
|i18n-desc =
|i18n-mediawiki-msg =
|i18n-subpage =
|seealso =
* {{tl|LangSwitch}} for all-translations-on-one-page template i18n mechanism template
|setscats = [[:Category:Autotranslated templates]]
|print = one
|shorthand =
|relieson = [[Module:Autotranslate]]
|mustbesubst =
}}
== How to convert a template ==
Before you apply this template, first you have to prepare the template.
=== Pick a template ===
—See for example [http://commons.wikimedia.org/w/index.php?title=Template:Cc-by-1.0&oldid=12667239 Template:Cc-by-1.0 before changes].<br />
First you have to pick a template to autotranslate.<br />
''In this documentation, we will name our "selected template" as:'' <code>Template:<var>Template name</var></code>
*See [[Commons:Template i18n]] for a list of templates needing translation or translated.
=== Create a layout template ===
—See for example [[Template:Apache/layout]].<br />
You must create a layout template, named <code>Template:<var>Template name</var>/layout</code>, 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.<br />
This template should not add any categories when transcluded.
=== Convert existing language versions ===
—See for example [[Template:Apache/en]].<br />
All versions must be subpages of <code>Template:<var>Template name</var></code>, and his name must use the appropriate prefix, [[m:List_of_Wikipedias|as used on Wikipedia]] when adding a new language –ISO 639 language code–.
:For example, Spanish subpage must be named <code>Template:<var>Template name</var>/es</code>
Usually the English language link to the main template –<code>Template:<var>Template name</var></code>–. That is incorrect, point it to the <code>Template:<var>Template name</var>/en</code> subpage.
Each language version of the template should be checked and converted to use the layout template –<code>Template:<var>Template name</var>/layout</code>–.<br />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 <code><nowiki>{{translated tag|cleanup}}</nowiki></code> or <code><nowiki>{{documentation}}</nowiki></code>, must be inside a <code><noinclude></code> tag.
Here is the syntax you must use for <code>Template:<var>Template name</var>/<<var>prefix</var>></code>.
<nowiki>{{</nowiki><code><var>Template name</var>/layout</code>
|text=<''translated text of the template''>
|lang=<''prefix''>
<nowiki>}}<noinclude>
{{translated tag|license}}
</noinclude></nowiki>
=== Create a documentation page ===
—See for example [[Template:Apache/doc]].<br />
Create a documentation page at <code>Template:<var>Template name</var>/doc</code>. This documentation page should include some code for creating language versions of the template. {{tl|TemplateBox}} has a <tt>|il8n=autotranslate</tt> option which provides a standard explanation of how to localise an autotranslated template.
=== Convert the main template ===
—See for example [[Template:Apache]].<br />
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 –<code>Template:<var>Template name</var></code>–.
<nowiki>{{Autotranslate|</nowiki>base=<var>template name</var>}}
==See also==
{{autotranslate|base=I18n templates}}
<includeonly>
[[Category:Internationalization templates]]
[[Category:Autotranslated templates| *]]
[[Category:Lua-based templates]]
</includeonly>
{{TemplateBox
|2 = ...
|2d-en = any additional parameter passed to {{tl|Autotranslate}} will be passed to {{tl|Autotranslate}}'s subtemplates. Parameter names are case independent and the subtemplates '''will only ''see lower case'' names'''.
|2d-td =
|2type =
|2def =
|2stat =optional-
|1 = base
|1d-en = name of the template, where it is being added, like "Template:Information". Usually can use <code><nowiki>base={{subst:PAGENAME}}</nowiki></code>.
|1d-td =
|1type = string
|1def =
|1stat = required
|3 = lang
|3d-en = display language
|3d-td =
|3type = string
|3def = <code><nowiki>{{int:lang}}</nowiki></code>
|3stat = optional-
|name = Autotranslate
|desc = 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:
<pre style="overflow:auto">
{{Autotranslate|base={{subst:PAGENAME}}}}
</pre>
|namespace = template
|usergroup =
|placement = top
|usage-notes =
|type =
|example =
|example-value =
|i18n-method = -
|i18n-desc =
|i18n-mediawiki-msg =
|i18n-subpage =
|seealso =
* {{tl|LangSwitch}} for all-translations-on-one-page template i18n mechanism template
|setscats = [[:Category:Autotranslated templates]]
|print = one
|shorthand =
|relieson = [[Module:Autotranslate]]
|mustbesubst =
}}
== How to convert a template ==
Before you apply this template, first you have to prepare the template.
=== Pick a template ===
—See for example [http://commons.wikimedia.org/w/index.php?title=Template:Cc-by-1.0&oldid=12667239 Template:Cc-by-1.0 before changes].<br />
First you have to pick a template to autotranslate.<br />
''In this documentation, we will name our "selected template" as:'' <code>Template:<var>Template name</var></code>
*See [[Commons:Template i18n]] for a list of templates needing translation or translated.
=== Create a layout template ===
—See for example [[Template:Apache/layout]].<br />
You must create a layout template, named <code>Template:<var>Template name</var>/layout</code>, 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.<br />
This template should not add any categories when transcluded.
=== Convert existing language versions ===
—See for example [[Template:Apache/en]].<br />
All versions must be subpages of <code>Template:<var>Template name</var></code>, and his name must use the appropriate prefix, [[m:List_of_Wikipedias|as used on Wikipedia]] when adding a new language –ISO 639 language code–.
:For example, Spanish subpage must be named <code>Template:<var>Template name</var>/es</code>
Usually the English language link to the main template –<code>Template:<var>Template name</var></code>–. That is incorrect, point it to the <code>Template:<var>Template name</var>/en</code> subpage.
Each language version of the template should be checked and converted to use the layout template –<code>Template:<var>Template name</var>/layout</code>–.<br />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 <code><nowiki>{{translated tag|cleanup}}</nowiki></code> or <code><nowiki>{{documentation}}</nowiki></code>, must be inside a <code><noinclude></code> tag.
Here is the syntax you must use for <code>Template:<var>Template name</var>/<<var>prefix</var>></code>.
<nowiki>{{</nowiki><code><var>Template name</var>/layout</code>
|text=<''translated text of the template''>
|lang=<''prefix''>
<nowiki>}}<noinclude>
{{translated tag|license}}
</noinclude></nowiki>
=== Create a documentation page ===
—See for example [[Template:Apache/doc]].<br />
Create a documentation page at <code>Template:<var>Template name</var>/doc</code>. This documentation page should include some code for creating language versions of the template. {{tl|TemplateBox}} has a <tt>|il8n=autotranslate</tt> option which provides a standard explanation of how to localise an autotranslated template.
=== Convert the main template ===
—See for example [[Template:Apache]].<br />
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 –<code>Template:<var>Template name</var></code>–.
<nowiki>{{Autotranslate|</nowiki>base=<var>template name</var>}}
==See also==
{{autotranslate|base=I18n templates}}
<includeonly>
[[Category:Internationalization templates]]
[[Category:Autotranslated templates| *]]
[[Category:Lua-based templates]]
</includeonly>