Template:LangSwitch: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Clarification: This template is mainly meant for templates.)
(Further clarification + lang parameter for language override)
Line 1: Line 1:
{{#if: {{{ {{lc: {{#titleparts: {{PAGENAME}} | 1}} }}| }}} | {{{ {{lc: {{#titleparts: {{PAGENAME}} | 1}} }} }}} | {{{en|}}} }}<noinclude>
{{#if: {{{lang|}}} | {{{ {{{lang}}} }}} | {{#if: {{{ {{lc: {{#titleparts: {{PAGENAME}} | 1}} }}| }}} | {{{ {{lc: {{#titleparts: {{PAGENAME}} | 1}} }} }}} | {{{en|}}} }} }}<noinclude>
{{Informative template|1=
{{Informative template|1=
__NOTOC__
__NOTOC__
== Goal ==
== Goal ==
This template will show texts in different languages depending on the language of the page it is placed on. It is mainly meant for use in templates.
This template will show texts in different languages depending on the language of the page it is placed on.


It is mainly meant for translation of contents within templates so that a single template can be used in pages of different languages, rather than having to be translated with one template for each language.


The language the text will be shown in depends on the two letter language code between the page namespace and the page title, for example [[Talk:De/HB Radio-NAV|Talk:'''De'''/HB Radio-NAV]].  If a parameter with a text is not available in the language of the page or is empty, the English text will be shown instead provided it is available.
The language the text will be shown in depends on the two letter language code between the page namespace and the page title, for example [[Talk:De/HB Radio-NAV|Talk:'''De'''/HB Radio-NAV]].  If a parameter with a text is not available in the language of the page or is empty, the English text will be shown instead provided it is available.
Line 10: Line 11:
== Usage ==
== Usage ==
The parameters of this template corresponds to the ISO 639-1 two letter language code for the language to be used in that parameter.
The parameters of this template corresponds to the ISO 639-1 two letter language code for the language to be used in that parameter.
For testing and demonstration purposes the named parameter '''lang=''' can be used to select a different language than the language of the page the template is used on.


<pre>
<pre>
{{LangSwitch |de= |en= |es= |fr= |nl= |ru=}}
{{LangSwitch |de= |en= |es= |fr= |nl= |ru= |lang=}}
</pre>
</pre>


Line 23: Line 26:
|nl =  
|nl =  
|ru =  
|ru =  
|lang =
}}
</pre>
=== Using the lang parameter ===
For testing and demonstration purposes the the '''lang ''' parameter can be used to override the automatic language selection.
<pre><!-- Caveat: Google translated -->
{{LangSwitch
|de = Hallo Welt!
|en = Hello World!
|es = ¡Hola Mundo!
|fr = Bonjour tout le monde!
|nl = Hello World!
|ru = Привет мир!
|lang = fr
}}
}}
</pre>
</pre>
{{LangSwitch
|de = Hallo Welt!
|en = Hello World!
|es = ¡Hola Mundo!
|fr = Bonjour tout le monde!
|nl = Hello World!
|ru = Привет мир!
|lang = fr
}}


=== Examples of language codes ===
=== Examples of language codes ===

Revision as of 16:15, 28 November 2013


The following template description is not displayed when the template is inserted in an article.

Goal

This template will show texts in different languages depending on the language of the page it is placed on.

It is mainly meant for translation of contents within templates so that a single template can be used in pages of different languages, rather than having to be translated with one template for each language.

The language the text will be shown in depends on the two letter language code between the page namespace and the page title, for example Talk:De/HB Radio-NAV. If a parameter with a text is not available in the language of the page or is empty, the English text will be shown instead provided it is available.

Usage

The parameters of this template corresponds to the ISO 639-1 two letter language code for the language to be used in that parameter.

For testing and demonstration purposes the named parameter lang= can be used to select a different language than the language of the page the template is used on.

{{LangSwitch |de= |en= |es= |fr= |nl= |ru= |lang=}}
{{LangSwitch
|de = 
|en = 
|es = 
|fr = 
|nl = 
|ru = 
|lang =
}}

Using the lang parameter

For testing and demonstration purposes the the lang parameter can be used to override the automatic language selection.

<!-- Caveat: Google translated -->
{{LangSwitch
|de = Hallo Welt!
|en = Hello World!
|es = ¡Hola Mundo!
|fr = Bonjour tout le monde!
|nl = Hello World!
|ru = Привет мир!
|lang = fr
}}

Bonjour tout le monde!


Examples of language codes

ISO 639-1

two letter code

English name of language
ca Catalan
de German
en English
es Spanish
fa Farsi
fi Finnish
fr French
nl Dutch
pl Polish
pt Portugese
ru Russian
sv Swedish
zh Chinese

Known issues

Using equal signs inside template parameters will break the template. Two ways around this is to either use {{=}} or <nowiki>=</nowiki>.

Related content