Module:ISO 639 name/doc explained

Module:ISO 639 name implements:

Data mapping

For code-to-name mapping, this module uses data from:

For name-to-code mapping, this module uses data from:

Testcases

iso_639_code_exists

Returns true when <{{var|code}}> is found in one of the ISO 639-1, -2, -3, -5, or override tables; returns nil else.

Useage:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_exists|</nowiki>&lt;{{var|code}}>}}

Examples:

without required &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_exists}}</nowiki>

with valid &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_exists|nav}}</nowiki>

with invalid &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_exists|xx}}</nowiki>

iso_639_code_to_name

Returns language name associated with &lt;{{var|code}}>. May return an error message with or without a language name.

Optional parameters:

suppresses error messages

creates link to en.wiki article about the language

– requires ; label for the language-name link: <nowiki>[[</nowiki>&lt;{{var|language name}}> language|&lt;{{var|label text}}>]]

queries part tables only; returns language name as defined in the base data tables without the removal of disambiguation informationExamples:

without required &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_to_name}}</nowiki>

with valid &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_to_name|nav}}</nowiki>

with invalid &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_to_name|xx}}</nowiki>

with invalid &lt;{{var|code}}> (IETF language tag):

<nowiki>{{#invoke:ISO 639 name|iso_639_code_to_name|nv-Latn}}</nowiki>

with invalid &lt;{{var|code}}>, error message suppressed:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_to_name|nv-Latn|hide-err=yes}}</nowiki>

linked:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_to_name|nav|link=yes}}</nowiki>

linked with alternate spelling:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_to_name|nav|link=yes|label=Navaho}}</nowiki>

ISO 639-1 code el is normally overridden by a setting in :

<nowiki>{{#invoke:ISO 639 name|iso_639_code_to_name|el}}</nowiki>

ISO 639-1 code el with override suppressed:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_to_name|el|raw=yes}}</nowiki>

ISO 639-3 code ina name has disambiguation that is normally suppressed:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_to_name|ina}}</nowiki>

ISO 639-3 code ina with disambiguation:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_to_name|ina|raw=yes}}</nowiki>

iso_639_code_1_to_name

Same as iso_639_code_to_name except that &lt;{{var|code}}> must be an ISO 639-1 code; search is constrained to and .

Example:

with valid &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_1_to_name|nv}}</nowiki>

with invalid &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_1_to_name|xx}}</nowiki>

iso_639_code_2_to_name

Same as iso_639_code_to_name except that &lt;{{var|code}}> must be an ISO 639-2 code; search is constrained to and .

Example:

with valid &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_2_to_name|apa}}</nowiki>

with invalid &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_2_to_name|xxx}}</nowiki>

iso_639_code_2B_to_name

Same as iso_639_code_to_name except that &lt;{{var|code}}> must be an ISO 639-2B code; search is constrained to and .

Example:

with valid &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_2B_to_name|ice}}</nowiki>

with invalid &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_2B_to_name|xxx}}</nowiki>

iso_639_code_3_to_name

Same as iso_639_code_to_name except that &lt;{{var|code}}> must be an ISO 639-3 code; search is constrained to and .

Example:

with valid &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_3_to_name|nav}}</nowiki>

with invalid &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_3_to_name|xxx}}</nowiki>

iso_639_code_5_to_name

Same as iso_639_code_to_name except that &lt;{{var|code}}> must be an ISO 639-5 code; search is constrained to and .

Example:

with valid &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_5_to_name|apa}}</nowiki>

with invalid &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_code_5_to_name|xxx}}</nowiki>

iso_639_name_exists

Returns true when &lt;{{var|language name}}> is found in one of the ISO 639-1, -2, -3, -5, or override tables; returns nil else.

Useage:

<nowiki>{{#invoke:ISO 639 name|iso_639_name_exists|</nowiki>&lt;{{var|language name}}>}}

Examples:

without required &lt;{{var|language name}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_name_exists}}</nowiki>

with valid &lt;{{var|language name}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_name_exists|french}}</nowiki>

with invalid &lt;{{var|language name}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_name_exists|fr}}</nowiki>

iso_639_name_to_code

Returns ISO 639 language code associated with &lt;{{var|language name}}>. May return an error message with or without a language name.

This function may not be particularly useful because, except for case, &lt;{{var|language name}}> must exactly match the name in the data tables.

Optional parameters:

&lt;{{var|part}}> (second positional parameter) – limits return to codes from the specified &lt;{{var|part}}> (1, 2, 3, 5), override table first then the appropriate data table; when not supplied, this function searches in order part 1 to part 5. The search stops when a match is found.

suppresses error messages

Examples:

without &lt;{{var|part}}>, with ISO 639-5 name:

<nowiki>{{#invoke:ISO 639 name|iso_639_name_to_code|North Germanic languages}}</nowiki>

with &lt;{{var|part}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639_name_to_code|Navajo|2}}</nowiki>

iso_639

When given an ISO 639 language code, return the associated language name; when given a language name, returns the associated ISO 639 language code. May return an error message with or without a language code/name.

This function may not be particularly useful because, except for case, a provided &lt;{{var|language name}}> must exactly match the name in the data tables.

Optional parameters:

&lt;{{var|part}}> (second positional parameter) – limits return to codes/names from the specified &lt;{{var|part}}> (1, 2, 3, 5), override table first then the appropriate data table; when not supplied, this function searches in order part 1 to part 5. The search stops when a match is found.

suppresses error messages

Examples:

without &lt;{{var|part}}>, with ISO 639-5 code:

<nowiki>{{#invoke:ISO 639 name|iso_639|gmq}}</nowiki>

without &lt;{{var|part}}>, with ISO 639-5 name:

<nowiki>{{#invoke:ISO 639 name|iso_639|North Germanic languages}}</nowiki>

with &lt;{{var|part}}> and &lt;{{var|code}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639|nav|2}}</nowiki>

with &lt;{{var|part}}> and &lt;{{var|name}}>:

<nowiki>{{#invoke:ISO 639 name|iso_639|Navaho|2}}</nowiki>