Ŝablono:Autotranslate/doc

El Komunejo

< Ŝablono:Autotranslate(Malsamoj inter versioj)
Iri al: navigado, serĉi
E (Reverted edits by 82.154.58.130 (talk) to last revision by Eusebius)
E (41 versioj: Helpaj ŝablonoj)
 
(21 mezaj versioj ne montrata.)
Linio 1: Linio 1:
{{Documentation subpage}}
{{Documentation subpage}}
-
This template is used to show a template in the users interface language.
+
This template is used to show a template in the user's interface language.
== How to convert a template ==
== How to convert a template ==
Linio 6: Linio 6:
=== Pick a template ===
=== Pick a template ===
-
First you have to pick a template to autotranslate. See [[Commons:Template i18n]] for a list.
+
&mdash;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:Template name|Template:<var>Template name</var>]]</code>
 +
*See [[Commons:Template i18n]] for a list of templates needing translation or translated.
=== Create a layout template ===
=== Create a layout template ===
-
If the template is not too difficult you should create a layout template to contain the layout of all language versions of the template. See for example [[Template:Cc-by-1.0/layout]].
+
&mdash;See for example [[Template:Cc-by-1.0/layout]].<br />
 +
You must create a layout template, named <code>[[Template:Template name/layout|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.
This template should not add any categories when transcluded.
-
=== Modify the en language link ===
+
=== Convert existing language versions ===
-
Usually the English link points to the main template, point it to the /en subpage. See for example [[Template:Cc-by-1.0/en]]
+
&mdash;See for example [[Template:Cc-by-1.0/en]].<br />
 +
All versions must be subpages of <code>[[Template:Template name|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;. For example, Spanish subpage must be named <code>[[Template:Template name/es|Template:<var>Template name</var>/es]]</code><br />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:Template name/en|Template:<var>Template name</var>/en]]</code> subpage.
-
=== Create a documentation page ===
+
Each language version of the template should be checked and converted to use the layout template &ndash;<code>[[Template:Template name/layout|Template:<var>Template name</var>/layout]]</code>&ndash;. Start with the English language version and compare it to the current template.
-
Create a documentation page at ''template name''/doc. This documentation page should include some code for creating language versions of the template. See for example [[Template:Cc-by-1.0/doc]]. Include this documentation in the main template by adding <nowiki>{{documentation}}</nowiki>
+
-
=== Convert existing language versions ===
+
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>&lt;noinclude&gt;</code> tag.
-
Each language version of the template should be checked and converted to use the layout template. 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 “<nowiki>{{translated tag|cleanup}}</nowiki>” and documentation, must be inside a <tt>&lt;noinclude&gt;</tt>” tag.
+
Here is the syntax you must use for <code>[[Template:Template name/en|Template:<var>Template name</var>/&lt;<var>prefix</var>&gt;]]</code>.
 +
<nowiki>{{</nowiki><code>[[Template:Template name/layout|<var>Template name</var>/layout]]</code>
 +
|text=&lt;''translated text of the template''&gt;
 +
|lang=&lt;''prefix''&gt;
 +
<nowiki>}}&lt;noinclude>
 +
{{translated tag|license}}
 +
&lt;/noinclude></nowiki>
 +
 
 +
=== Create a documentation page ===
 +
&mdash;See for example [[Template:Cc-by-1.0/doc]].<br />
 +
Create a documentation page at <code>[[Template:Template name/doc|Template:<var>Template name</var>/doc]]</code>. This documentation page should include some code for creating language versions of the template.
=== Convert the main template ===
=== Convert the main template ===
 +
&mdash;See for example [[Template:Cc-by-1.0]].<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!
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 for the layout part:
+
To enable the template, put this code in the template &ndash;<code>[[Template:Template name|Template:<var>Template name</var>]]</code>&ndash;.
-
<nowiki>{{Autotranslate|1={{{1|}}}|2={{{2|}}}|3={{{3|}}}|base=</nowiki>''template name''<nowiki>}}</nowiki>
+
<nowiki>{{Autotranslate|1={{{1|}}}|2={{{2|}}}|3={{{3|}}}|</nowiki>base=<var>template name</var>}}
-
See for example [[Template:Cc-by-1.0]]
+
-
 
+
-
=== Protect templates ===
+
-
The main template page is probably already protected. You should probably also protect /layout, /lang & /en.
+
== Code snippet ==
== Code snippet ==
To use this template, include the following code:
To use this template, include the following code:
-
 
+
<pre style="overflow:auto">
-
<PRE>
+
{{Autotranslate|1={{{1|}}}|2={{{2|}}}|3={{{3|}}}|4={{{4|}}}|5={{{5|}}}|6={{{6|}}}|7={{{7|}}}|8={{{8|}}}|9={{{9|}}}|base={{subst:PAGENAME}}}}
{{Autotranslate|1={{{1|}}}|2={{{2|}}}|3={{{3|}}}|4={{{4|}}}|5={{{5|}}}|6={{{6|}}}|7={{{7|}}}|8={{{8|}}}|9={{{9|}}}|base={{subst:PAGENAME}}}}
-
</PRE>
+
</pre>

Nuna versio ekde 21:01, 11. Jan 2010

Ŝablono:Documentation subpage This template is used to show a template in the user's interface language.

Enhavo

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

Create a layout template

—See for example Template:Cc-by-1.0/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:Cc-by-1.0/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:Cc-by-1.0/doc.
Create a documentation page at Template:Template name/doc. This documentation page should include some code for creating language versions of the template.

Convert the main template

—See for example Template:Cc-by-1.0.
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|1={{{1|}}}|2={{{2|}}}|3={{{3|}}}|base=template name}}

Code snippet

To use this template, include the following code:

{{Autotranslate|1={{{1|}}}|2={{{2|}}}|3={{{3|}}}|4={{{4|}}}|5={{{5|}}}|6={{{6|}}}|7={{{7|}}}|8={{{8|}}}|9={{{9|}}}|base={{subst:PAGENAME}}}}
Personaj iloj