Template:LangSwitch: Difference between revisions

Jump to navigation Jump to search
Usage when translating templates
(Further clarification + lang parameter for language override)
(Usage when translating templates)
Line 1: Line 1:
{{#if: {{{lang|}}} | {{{ {{{lang}}} }}} | {{#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__
== Goal ==
== Goal ==
This template will show texts in different languages depending on the language of the page it is placed on.
This template will show texts in different languages depending on the language of the page it is placed on.
Line 8: Line 7:


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.
__TOC__


== Usage ==
== Usage ==
Line 29: Line 31:
}}
}}
</pre>
</pre>
=== Translating templates ===
The template is mainly used for translating templates.
Do note that many templates are based on tables and have to start from the beginning of the line, which is accomplished like in the below example, and that inserting blank lines will alter the way the template is rendered.
<nowiki>{{LangSwitch
| en =  <!-- English -->
{{ Template with English contents }}
| de =  <!-- German -->
{{ Template with German contents }}
| fr =  <!-- French -->
{{ Template with French contents }}
}}</nowiki>


=== Using the lang parameter ===
=== Using the lang parameter ===

Navigation menu