Help:Templates: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
m (Johan G moved page Help:Template to Help:Templates: This is not about a specific template)
(→‎Translating templates: I simplified this quite a bit by creating Template:LangSwitch)
Line 6: Line 6:


=== Translating templates ===
=== Translating templates ===
Translating templates is working different than translating normal articles. All translations are written in the same file. The translated text (in this case a German and a Spanish one) is surrounded by the following construct:
Translating templates is different from translating normal articles. All translations are written within one and the same template. To do that one can use the {{tl|LangSwitch}} template.


<nowiki>{{ #ifeq: {{#titleparts: {{PAGENAME}} | 1 }} | </nowiki>'''De'''<nowiki> |
<pre>{{LangSwitch |en=English text |de=<German text> |fr=<French text> ...}}</pre>
German text...
|
{{ #ifeq: {{#titleparts: {{PAGENAME}} | 1 }} | </nowiki>'''Es'''<nowiki> |
Spanish text...
|
English text...
}}
 
}}
 
</nowiki>
 
This is a script, which tells the wiki software, that the block containing the German text should only be evaluated, if the name of the page, the template is embedded in, contains the "'''De'''" text pattern, which can be found in all names of German wiki-pages. The Spanish translation is treated the same way. If none of the language codes is found in the pages name, we can be sure, it is an English one or another language, which is not handled so far by the template and apply the English version of the text. Do not forget the closing brackets at the end. You need two of them for every translation, except for the English. Of course this works for any language. Just look up your language code.


It uses the two letter language code present in all but the English page titles.  If none of the languages that have been translated to is found, a template have not yet been translated to that language and the English text will be used instead, provided it is available.


== Small collection of various templates ==
== Small collection of various templates ==

Revision as of 23:18, 7 November 2013

This page is meant to help you with the use of templates on the wiki.

Editing or creating templates

Editing a template is almost as easy as editing a normal wiki page. Lets say, you want to edit a template with the name "what you always wanted to know". To do so open "wiki.flightgear.org/Template:what_you_always_wanted_to_know" (mind the underscores, that replace the spaces!). If you created a new template, you can embed it in any wiki article from now on by writing: {{what you always wanted to know}} (insert the template name here).

Translating templates

Translating templates is different from translating normal articles. All translations are written within one and the same template. To do that one can use the {{LangSwitch}} template.

{{LangSwitch |en=English text |de=<German text> |fr=<French text> ...}}

It uses the two letter language code present in all but the English page titles. If none of the languages that have been translated to is found, a template have not yet been translated to that language and the English text will be used instead, provided it is available.

Small collection of various templates

Tag Text that will be shown Place
{{abc}}

  A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z 


Top
{{Boeing}} Bottom
{{Building}} Bottom
{{Main article|Link to article}}

1rightarrow.png See Link to article for the main article about this subject.