Template:Languagename

From MEpedia, a crowd-sourced encyclopedia of ME and CFS science and history
template icon Template documentation[view] [edit] [history] [purge]

Usage[edit source]

Works like {{#language:lang1|lang2}} but supports the transition of legacy codes still used by MediaWiki or still not supported by #language: and #languagename: parser functions in MediaWiki.

Syntax[edit source]

{{Languagename
| 1=lang1
| 2=lang2
}}

Parameters[edit source]

  • 1=lang1 code representing the language name (mandatory)
  • 2=lang2 code of the language into which the language name will be translated (optional)
    The default empty value will return the autonym, as if lang2=lang1; i.e. this template works like the #language: parser function of MediaWiki.
    To display the language name translated in the current user language selected in the UI, pass the value {{UILANGCODE}} (the MediaWiki parser function #languagename: is similar, except that its default value for parameter 2 is the UI language rather than the value of parameter 1, so it does not return the language autonym by default like #language:).
    Note that locale tags from the BCP 47 standard (as well as language codes from the ISO 639 standard from which most of them are inherited) are not case sensitive, but should preferably use dashes (-) as separators between locale subtags rather than underscores (_).

Examples[edit source]

  • {{Languagename|de}} generates
Deutsch

(the language autonym, in its native script and orthography)

  • {{Languagename|de|de}} generates
Deutsch

(should be the same as the previous)

  • {{Languagename|de|en}} generates
German

(language name translated to English)

  • {{Languagename|de|ar}} generates
Deutsch

(language name translated to Arabic)

  • {{Languagename|de|{{UILANGCODE}}}} generates
Deutsch

(should be the name translated in your own prefered language)

See also[edit source]

  • Template:Languagename: main template which normalizes the input language codes, and uses some fallbacks shared across known variants (such as formal or informal variants in Wikimedia sites) of some target languages
  • Template:Languagename/db: subtemplate called internally after normalizing the input language codes, and using some fallbacks shared across known variants of some target languages, containing the actual names


Test[edit source]

  • ar Arabic العربية Arabic
  • da dansk Danish Danish
  • de German German German
  • es Spanish Spanish Spanish
  • fi suomi Finnish Finnish
  • fr French French French
  • it italiano Italian Italian
  • ja 日本語 Japanese Japanese
  • nl Nederlands Dutch Dutch
  • no (or nn or nb) norsk (norsk bokmål, norsk nynorsk) Norwegian Norwegian —Norwegian Nynorsk/Norwegian Bokmål
  • pl polski Polish Polish
  • pt português Portuguese Portuguese
  • ru русский Russian Russian
  • sv svenska Swedish Swedish
  • vi Tiếng Việt Vietnamese Vietnamese
  • zh-hans Simplified Chinese Chinese (simplified) Simplified Chinese
  • zh-hant Traditional Chinese Chinese (traditional) Traditional Chinese
  • zh 中文 Chinese Chinese