Template:LangSwitch

维基百科,自由的百科全书
跳到导航 跳到搜索


文档图示 模板文档[查看] [编辑] [历史] [清除缓存]

Template:TemplateBox

Examples[编辑]

Here are a few examples showing template behavior for three languages: English, French and Corsu, which defaults to French if Corsu text is not available:

Test Code lang=en lang=fr lang=co
no En; default {{LangSwitch|fr=French|default=default}} default French default
no En ; no default {{LangSwitch|fr=French|co=Corsu}} [1] French[1] Corsu[1]
En; default {{LangSwitch|en=English|co=Corsu|default=default}} English default Corsu
En; no default {{LangSwitch|en=English|co=Corsu}} English English Corsu
empty En; default {{LangSwitch|en=~|fr=French|default=default}} French default
empty En; no default {{LangSwitch|en=~|fr=French}} French ~
En; default; empty Fr {{LangSwitch|en=English|fr=~|co=Corsu|default=default}} English Corsu
En; default; empty Fr {{LangSwitch|en=English|fr=|co=Corsu|default=default}} English default Corsu
En; no default; empty Fr {{LangSwitch|en=English|fr=~|co=Corsu}} English Corsu
simple case with "lang=" {{LangSwitch|en=English|fr=French|co=Corsu|default=default|lang=}} default default default
  1. ^ 1.0 1.1 1.2 add [[Category:LangSwitch template without English version]]

The default option is intended for providing more language independent option. For example:

{{LangSwitch
|de=[[:de:Warschau|Warschau]]
|fr=[[:fr:Varsovie|Varsovie]]
|pl=[[:pl:Warszawa|Warszawa]]
|en=[[:en:Warsaw|Warsaw]]
|default=Warsaw
}}

will provide link to wikipedia articles in case one of the languages provided matches user's language but will link to Commons gallery page (Warsaw) if any other language is used.