Teamplaid:Lang2iso
This template, Lang2iso, is transcluded from {{DisplayTranslations}}. It should not be transcluded directly from article namespace.
It 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. (Some additions to ISO 639-1 codes are identified below.) If the provided language name is not identified, then the default value of "en" is returned.
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/macro is meant to facilitate invocations of other templates such as Teamplaid: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 Teamplaid:langWithName) since the ISO Language Code can now be derived from the ISO Language Name.
Additions to ISO 639-1 Alpha-2 codes: Teamplaid:See Not all languages have ISO 639-1 codes. Thus, as time goes on, users are encouraged to add ISO 639-2 or ISO 639-3 codes. Thus far, the following additions to ISO 639-1 have been added:
ISO codes
- "Devanāgarī", "Devanagari", "Devanagiri" and "Devangari" return "deva" (per ISO 15924)
- "Klingon" and "Klingonese" return "tlh" (per ISO 639-2)
- "Manipuri" returns "mni" (per ISO 639-2)
- "Prakrit" returns "pra" (per ISO 639-2)
- "Simplified Chinese" returns "hans" (per ISO 15924)
- "Traditional Chinese" returns "hant" (per ISO 15924)
See also
[deasaich an tùs]- {{Iso2lang}}
Tha an docamaideadh gu h-àrd ga thar-ghabhail o Teamplaid:Lang2iso/doc. (deasaich | history)
|