Template:LangSwitch: Difference between revisions
Jump to navigation
Jump to search
(Now if this ain't elegant... If this works *any* language code is automatically supported) |
(Seems I did it, sans this small adjustment :-) |
||
Line 1: | Line 1: | ||
{{#if: {{{ {{lc: {{#titleparts: {{PAGENAME}} | 1}} }}| }}} | {{{ {{lc: {{#titleparts: {{PAGENAME}} | 1}} }} }}} | {{{en}}} }}<noinclude> | {{#if: {{{ {{lc: {{#titleparts: {{PAGENAME}} | 1}} }}| }}} | {{{ {{lc: {{#titleparts: {{PAGENAME}} | 1}} }} }}} | {{{en|}}} }}<noinclude> | ||
{{Informative template|1= | {{Informative template|1= | ||
__NOTOC__ | __NOTOC__ |
Revision as of 01:11, 8 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.
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.
{{LangSwitch |de= |en= |es= |fr= |nl= |ru=}}
{{LangSwitch |de = |en = |es = |fr = |nl = |ru = }}
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>.