• Home
  • Random
  • Nearby
  • Log in
  • Settings
Donate Now If Wikipedia is useful to you, please give today.
  • About Wikipedia
  • Disclaimers
Wikipedia

Template:Lang2iso

  • Template
  • Talk
  • Language
  • Watch
  • View source
Template documentation[view] [edit] [history] [purge]
WarningThis template is used on approximately 4,500 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them.
This template uses Lua:
  • Module:ISO 639 name (sandbox)

Template:Lang2iso takes an English-language language name (such as "Abkhazian" or "Sinhalese") and converts it into a two-letter ISO 639 language code. This table's values are based on List of ISO 639-1 codes. The template should not be transcluded directly from article namespace.

Examples

  • {{Lang2iso|German}} returns: de
  • {{Lang2iso|Greek}} returns: el
  • {{Lang2iso|Spanish}} returns: es

Purpose

Since most users will know a language's name but not its ISO code, this template is meant to facilitate invocations of other templates such as Template:Lang. Thus, instead of recalling (or having to know) that the ISO code for German is "de" and transcluding {{Lang|de|Mädchen}}, one can type: {{Lang|{{subst:Lang2iso|German}}|Mädchen}}.

This also reduces the number of parameters that need to be passed to some language routines (such as those similar to Template:Language with name) since the ISO language code can now be derived from the ISO language name.

See also

  • {{ISO 639 name}}
The above documentation is transcluded from Template:Lang2iso/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:Lang2iso&oldid=975221820"
Last edited on 27 August 2020, at 13:06

Languages

    • العربية
    • تۆرکجه
    • Basa Bali
    • বাংলা
    • Banjar
    • भोजपुरी
    • Català
    • Čeština
    • فارسی
    • Ilokano
    • Bahasa Indonesia
    • ଓଡ଼ିଆ
    • پښتو
    • संस्कृतम्
    • සිංහල
    • Simple English
    • سنڌي
    • کوردی
    • தமிழ்
    • తెలుగు
    • ไทย
    • Tshivenda
    • Українська
    • اردو
    • 中文
    Wikipedia
    • Wikimedia Foundation
    • Powered by MediaWiki
    • This page was last edited on 27 August 2020, at 13:06 (UTC).
    • Content is available under CC BY-SA 4.0 unless otherwise noted.
    • Privacy policy
    • About Wikipedia
    • Disclaimers
    • Contact Wikipedia
    • Code of Conduct
    • Developers
    • Statistics
    • Cookie statement
    • Terms of Use
    • Desktop