Help:Templates: Difference between revisions

Jump to navigation Jump to search
added information about writing, editing and translating templates
(→‎User messages: Added Under Construction Template)
(added information about writing, editing and translating templates)
Line 110: Line 110:
|website =[http://www.jp.flightgear.org http://www.jp.flightgear.org]
|website =[http://www.jp.flightgear.org http://www.jp.flightgear.org]
}}
}}
==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: <nowiki>{{what you always wanted to know}}</nowiki> (insert the template name here).
===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:
<nowiki>{{ #ifeq: {{#titleparts: {{PAGENAME}} | 1 }} | </nowiki>'''De'''<nowiki> |
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.


[[Category:Help]]
[[Category:Help]]
172

edits

Navigation menu