Jump to content
Toggle menu
  • 3 articles
  • 75 files
  • 7 users
  • 37.9K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Autotranslate/doc: Difference between revisions

Template page
m −typogarbage (… and the text is huge, but cannot be fixed here)
duplicated argument
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Shared Template Warning|Template:Autotranslate|origin=Commons}}
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
{{Lua|Module:Autotranslate}}
{{Lua|Module:Autotranslate}}
{{TemplateBox
{{TemplateBox
|2                 = ...
| 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-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             =
| 2d-td-en = <nowiki>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**.</nowiki>
|2type              =
| 2stat = optional-
|2def              =
|2stat             =optional-


|1                 = base
| 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>.
| 1label-en = Translation parent page
|1d-td              =
| 1d-en = Parent page of the translated sub-pages. For example, if a template '''Foo''' keeps translations in sub-templates [[Template:Foo/en]], [[Template:Foo/de]], etc. then base is '''Template:Foo''', or just '''Foo'''. If a template '''Foo''' uses translation extension, then the language sub-templates will be most likely stored in  [[Template:Foo/i18n/en]], [[Template:Foo/i18n/de]], etc., then the base is '''Foo/i18n'''.
|1type              = string
| 1type = wiki-template-name
|1def              =
| 1av  = {{((}}subst:PAGENAME{{))}}/i18n
|1stat             = required
| 1stat = required


|3                 = lang
| 3 = lang
|3d-en             = display language
| 3label-en = Language
|3d-td              =
| 3d-en = display language
|3type             = string
| 3type = string
|3def               = <code><nowiki>{{int:lang}}</nowiki></code>
| 3def = <code>{{Magic word|int|lang}}</code>
|3stat             = optional-
| 3def-td = <nowiki>{{int:lang}}</nowiki>
| 3stat = optional-


  |name               = Autotranslate
| 4 = default
|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:
| 4label-en = default
| 4d-en = default language sub-page which will be called in case all language sub-pages in the fallback chain are missing
| 4type = string
| 4def = en
| 4def-td = en
| 4stat = optional-
 
| name = Autotranslate
| desc-en = 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">
<pre style="overflow:auto">
{{Autotranslate|base={{subst:PAGENAME}}}}
{{#invoke:Autotranslate|autotranslate|base={{subst:PAGENAME}}/i18n}}
</pre>
</pre>
|namespace         = template
 
|usergroup         =
| desc-td-en = 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.
|placement         = top
 
|usage-notes        =
| namespace = template
|type              =
| usergroup = all
|example            =
| placement = top
|example-value      =
 
|i18n-method       = -
| i18n-method = -
|i18n-desc         =
| i18n-desc = Used by {{C|templates using Autotranslate for internationalisation}} and {{C|templates using the Translate extension for internationalisation}}.
|i18n-mediawiki-msg =
 
|i18n-subpage      =
| seealso =  
|seealso           =  
* {{tl|LangSwitch}} for all-translations-on-one-page template i18n mechanism template.
* {{tl|LangSwitch}} for all-translations-on-one-page template i18n mechanism template
* {{tl|Multilingual link}} chooses link to Wikipedia article in the user interface language.
|setscats           = [[:Category:Autotranslated templates]]
 
|print              = one
| setscats = [[:Category:Autotranslated templates]]
|shorthand          =
| relieson = [[Module:Autotranslate]]
|relieson           = [[Module:Autotranslate]]
 
|mustbesubst        =
| print = multi
| useTemplateData = 1
}}
}}


Line 63: Line 73:
=== Convert existing language versions ===
=== Convert existing language versions ===
&mdash;See for example [[Template:Apache/en]].<br />
&mdash;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 &ndash;ISO 639 language code&ndash;.
All versions must be subpages of <code>Template:<var>Template name</var></code>, and this name must use the appropriate prefix, [[m:List_of_Wikipedias|as used on Wikipedia]] when adding a new language &ndash;ISO 639 language code&ndash;.
:For example, Spanish subpage must be named <code>Template:<var>Template name</var>/es</code>
:For example, the Spanish subpage must be named <code>Template:<var>Template name</var>/es</code>
Usually the English language link to the main template &ndash;<code>Template:<var>Template name</var></code>&ndash;. That is incorrect, point it to the <code>Template:<var>Template name</var>/en</code> subpage.
Usually the English-language template links to the main template &ndash;<code>Template:<var>Template name</var></code>&ndash;. This is incorrect, point it instead 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 &ndash;<code>Template:<var>Template name</var>/layout</code>&ndash;.<br />Start with the English language version and compare it to the current template.
Each language version of the template should be checked and converted to use the layout template &ndash;<code>Template:<var>Template name</var>/layout</code>&ndash;.<br />Start with the English language version and compare it to the current template.
Line 81: Line 91:
=== Create a documentation page ===
=== Create a documentation page ===
&mdash;See for example [[Template:Apache/doc]].<br />
&mdash;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.
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 <code>|il8n=autotranslate</code> option which provides a standard explanation of how to localise an autotranslated template.


=== Convert the main template ===
=== Convert the main template ===
Line 87: Line 97:
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!
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 &ndash;<code>Template:<var>Template name</var></code>&ndash;.
To enable the template, put this code in the template &ndash;<code>Template:<var>Template name</var></code>&ndash;.
  <nowiki>{{Autotranslate|</nowiki>base=<var>template name</var>}}
  <nowiki>{{#invoke:Autotranslate|autotranslate|</nowiki>base=<var>template name</var>}}


==See also==
==See also==
{{autotranslate|base=I18n templates}}
{{#invoke:Autotranslate|autotranslate|base=I18n templates}}
 
<includeonly>{{Sandbox other||
<includeonly>
<!-- Categories below this line; interwikis at Wikidata -->
[[Category:Internationalization templates]]
[[Category:Internationalization templates]]
[[Category:Autotranslated templates| *]]
[[Category:Autotranslated templates| *]]
[[Category:Lua-based templates]]
[[Category:Lua-based templates]]
</includeonly>
}}</includeonly>
Cookies help us deliver our services. By using our services, you agree to our use of cookies.