Template:LangSwitch: Difference between revisions
Jump to navigation
Jump to search
(I can now happily remove the disclaimer, the template is rather fully tested, and works. This calls for celebration! :-) |
(Now if this ain't elegant... If this works *any* language code is automatically supported) |
||
Line 1: | Line 1: | ||
{{#if: {{{ {{lc: {{#titleparts: {{PAGENAME}} | 1}} }}| }}} | {{ | {{#if: {{{ {{lc: {{#titleparts: {{PAGENAME}} | 1}} }}| }}} | {{{ {{lc: {{#titleparts: {{PAGENAME}} | 1}} }} }}} | {{{en}}} }}<noinclude> | ||
{{Informative template|1= | {{Informative template|1= | ||
__NOTOC__ | __NOTOC__ | ||
Line 40: | Line 26: | ||
</pre> | </pre> | ||
=== | === Examples of language codes === | ||
{{{!}} class="wikitable" | {{{!}} class="wikitable" | ||
! ISO 639-1 | ! ISO 639-1 |
Revision as of 01:05, 8 November 2013
{{{en}}}
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>.