Difference between revisions of "Template:Lang2iso/doc"
imported>Vanisaac m (→See also: clean up per WP:CAT#T and WP:AWBREQ add template:Sandbox other) |
imported>Gonnym (update doc) |
||
| Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
<!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE. --> | <!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE. --> | ||
| − | + | {{Lua|Module:ISO 639 name}} | |
| − | + | '''Template:Lang2iso''', should not be transcluded directly from article namespace. 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]]. | |
| − | |||
| − | |||
| − | |||
| + | ==Examples== | ||
* <nowiki>{{Lang2iso|German}}</nowiki> returns "{{Lang2iso|German}}" | * <nowiki>{{Lang2iso|German}}</nowiki> returns "{{Lang2iso|German}}" | ||
* <nowiki>{{Lang2iso|Greek}}</nowiki> returns "{{Lang2iso|Greek}}" | * <nowiki>{{Lang2iso|Greek}}</nowiki> returns "{{Lang2iso|Greek}}" | ||
* <nowiki>{{Lang2iso|Spanish}}</nowiki> returns "{{Lang2iso|Spanish}}" | * <nowiki>{{Lang2iso|Spanish}}</nowiki> returns "{{Lang2iso|Spanish}}" | ||
| − | + | ==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 [[Template:Lang]]. Thus, instead of recalling (or having to know) that the ISO code for German is "de" and transcluding: | 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 [[Template:Lang]]. Thus, instead of recalling (or having to know) that the ISO code for German is "de" and transcluding: | ||
| Line 22: | Line 19: | ||
This also reduces the number of parameters that need to be passed to some language routines (such as those similar to [[Template:langWithName]]) since the ISO Language Code can now be derived from the ISO Language Name. | This also reduces the number of parameters that need to be passed to some language routines (such as those similar to [[Template:langWithName]]) since the ISO Language Code can now be derived from the ISO Language Name. | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
==See also== | ==See also== | ||
| − | *{{tl|ISO 639 name}} | + | * {{tl|ISO 639 name}} |
<includeonly>{{Sandbox other||<!-- | <includeonly>{{Sandbox other||<!-- | ||
Revision as of 12:02, 27 August 2020
| This is a documentation subpage for Template:Lang2iso. It contains usage information, categories and other content that is not part of the original template page. |
| This template uses Lua: |
Template:Lang2iso, should not be transcluded directly from article namespace. 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.
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 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:langWithName) since the ISO Language Code can now be derived from the ISO Language Name.
See also
- {{ISO 639 name}}