Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:LangSwitch/doc: Difference between revisions

Template page
corrected typo of "than" for "then"
corrected another typo -- "is" for "in"
Line 9: Line 9:


|1=en
|1=en
|1d=Text in English language. Unless ''default'' is used this text will also be used in case the languages provided do not include the language set in the user's preferences. If you do not want to show any text when user's language is English, then use "en=~". LangSwitch templates without ''en'' option will be added to [[:Category:LangSwitch template without English version]].
|1d=Text in English language. Unless ''default'' is used, this text will also be used if the languages provided do not include the language set in the user's preferences. If you do not want to show any text when the user's language is English, then use "en=~". LangSwitch templates without an ''en'' option will be added to [[:Category:LangSwitch template without English version]].
|1def=
|1def=
|1stat=required
|1stat=required
Line 16: Line 16:
|2d=
|2d=
{{LangSwitch
{{LangSwitch
|en=Translated text in language ''xx'' (The parameter name ''xx'' can be any supported language code, and you can specify as many such parameters as needed for each translated language). Use "~" if you do not want any message (or default) is some specific language.  
|en=Translated text in language ''xx'' (The parameter name ''xx'' can be any supported language code, and you can specify as many such parameters as needed for each translated language). Use "~" if you do not want any message (or default) in some specific language.  
|fr=La valeur est le texte traduit dans la langue de code ''xx'' (Le nom du paramètre ''xx'' peut être n’importe quel code langue supporté, et vous pouvez indiquer autant de paramètres que nécessaire pour chaque langue de traduction).
|fr=La valeur est le texte traduit dans la langue de code ''xx'' (Le nom du paramètre ''xx'' peut être n’importe quel code langue supporté, et vous pouvez indiquer autant de paramètres que nécessaire pour chaque langue de traduction).
|mk=текст на јазикот ''xx''. ''xx'' може да бидат било кои поддржани јазици.  
|mk=текст на јазикот ''xx''. ''xx'' може да бидат било кои поддржани јазици.  
Line 25: Line 25:


|3=default
|3=default
|3d=Default text in case one of 'xx' languages is not the language of user’s preferences. By default english version will be shown, if provided.
|3d=Default text in case one of the 'xx' languages is not the language of user’s preferences. By default, the English version will be shown, if provided.
|3def=<nowiki>{{{en|}}}</nowiki> (English version)
|3def=<nowiki>{{{en|}}}</nowiki> (English version)
|3stat=optional
|3stat=optional
Line 32: Line 32:
|4d=
|4d=
{{LangSwitch
{{LangSwitch
|en=language code (only needs to be provided if the language shall be fixed and independent of the user’s preferences). Usually only used for template debugging.  
|en=language code (only needs to be provided if the language displayed is to be fixed and independent of the user’s preferences). This option is usually only used for template debugging.  
|fr=code de langue (ne doit être indiqué que si la langue doit être fixée et indépendante des préférences de l’utilisateur).
|fr=code de langue (ne doit être indiqué que si la langue doit être fixée et indépendante des préférences de l’utilisateur).
|mk=јазичен код (се става само ако со тоа јазикот е фиксен и независен од корисничките нагодувања).
|mk=јазичен код (се става само ако со тоа јазикот е фиксен и независен од корисничките нагодувања).
Line 58: Line 58:


== Examples ==
== Examples ==
Few examples showing template behavior for 3 languages: English, French and Corsu, which defaults to French if Corsu text is not available:
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:
{| border="1"
{| border="1"
! Test
! Test

Revision as of 22:32, 7 November 2010

Provides a method to present a string of text selected from an array of many language translations in the language set in the user's preferences or the most appropiate fallback language (as determined by {{GetFallback}}).

Usage

{{LangSwitch
 |en =
 |xx =
 |default =
}}

Template parameters

ParameterDescriptionDefaultStatus
enText in English language. Unless default is used, this text will also be used if the languages provided do not include the language set in the user's preferences. If you do not want to show any text when the user's language is English, then use "en=~". LangSwitch templates without an en option will be added to Category:LangSwitch template without English version.emptyrequired
xxTranslated text in language xx (The parameter name xx can be any supported language code, and you can specify as many such parameters as needed for each translated language). Use "~" if you do not want any message (or default) in some specific language.emptyoptional
defaultDefault text in case one of the 'xx' languages is not the language of user’s preferences. By default, the English version will be shown, if provided.{{{en|}}} (English version)optional
langlanguage code (only needs to be provided if the language displayed is to be fixed and independent of the user’s preferences). This option is usually only used for template debugging.value of {{int:Lang}} (the preferred language of the visitor viewing the page).optional

Additional information

The template is intended to be used in the following namespaces: the Template namespace

The template is intended to be used by the following user groups: no user group specified

Relies on:
{{GetFallback}}, {{GetFallback2}}

See also

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}} LangSwitch Error: no default[1] LangSwitch Error: no default[1] LangSwitch Error: no default[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=}} English English English

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.


Cookies help us deliver our services. By using our services, you agree to our use of cookies.