Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 19:23, 26 December 2023 by wikipedia>Tom.Reding ({{High-use}})
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:Language templates

Usage

The {{ISO 639 name}} template is used to resolve ISO 639-1, ISO 639-2, ISO 639-3 and ISO 639-5 codes to language names. It will trim extraneous IETF language tags to just the ISO 639 code. E.g.: Sanskrit in Latin script, which IETF language tag is sa-Latn, renders as:

  • {{ISO 639 name|sa-Latn}} → Sanskrit error: sa-Latn is an IETF tag (help)

The error message can be suppressed with |hide-err=yes:

  • {{ISO 639 name|sa-Latn|hide-err=yes}} → Sanskrit

The rendered language name can be linked to the appropriate language article with |link=yes:

  • {{ISO 639 name|sa-Latn|hide-err=yes|link=yes}}Sanskrit

When linking, an alternate link label can be provided with |label=<label text>:

  • {{ISO 639 name|sa-Latn|hide-err=yes|link=yes|label=sa-Latn}}sa-Latn

The {{ISO 639 name link}} template is the same as Template:Tnull except that it presets |link=yes.

Both of these templates can be safely substituted.

Other functions

This template can be used to execute any of the functions exported by Module:ISO 639 name. These function are:

  • iso_639_code_exists – returns true if <code> is found in any of the ISO 639 data tables
  • iso_639_code_to_name – (default) as described above
  • iso_639_code_1_to_name – same as iso_639_code_to_name except constrained to the ISO 639-1 data table
  • iso_639_code_2_to_name – same as iso_639_code_to_name except constrained to the ISO 639-2 data table
  • iso_639_code_2B_to_name – same as iso_639_code_to_name except constrained to the ISO 639-2B data table
  • iso_639_code_3_to_name – same as iso_639_code_to_name except constrained to the ISO 639-3 data table
  • iso_639_code_5_to_name – same as iso_639_code_to_name except constrained to the ISO 639-5 data table
  • iso_639_name_exists – returns true if <name> is found in any of the ISO 639 data tables
  • iso_639_name_to_code – returns language code associated with <name>; may be constrained to a particular ISO 639 data table
  • iso_639 – returns language name when given a valid language code; returns a language code when given a valid language name; may be constrained to a particular ISO 639 data table

To use these functions set |fn= to the appropriate function name.

Language codes

Template:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/rowTemplate:ISO 639 name/doc/row
ISO 639-1 codes and matching codes from ISO 639-2, -2B, and -3
ISO 639-1 ISO 639-2 ISO 639-2BTemplate:Efn ISO 639-3 Name Article

Notes

Template:Notelist

Examples

  • {{ISO 639 name|en}} gives English
  • {{ISO 639 name|fr}} gives French

Error messages

This template produces error messages. These messages are:

  • Template:Error-smallIETF language tags are not ISO 639 language codes. When these tags are encountered, the template attempts to render the correct language and also emits this error message
  • Template:Error-small – where <part> is 1, 2, 3, 5; template was called without the required language code
  • Template:Error-small – <code> fails simple length validation; 639 part 1, language codes are two characters, for 639 parts 2, 3, and 5, language codes are three characters
  • Template:Error-small – <code> not found after searching ISO 639-<part> data

The module that does the work for this template has other functionality not supported by this template. See Module:ISO 639 name. Error messages related to that other functionality are:

  • Template:Error-small – module function iso_639_name_to_code() only – this message emitted when a language name is not provided in the {{#invoke:}}
  • Template:Error-small – module functions iso_639_name_to_code() and iso_639() only – this message emitted when <part> is not one of 1, 2, 3, or 5
  • Template:Error-small – module function iso_639() only – this message emitted when a language name or a language code is not provided in the {{#invoke:}}

Tracking categories

See also