Language Identifiers

Introduction

BCP47 - IETF Language Tags

An IETF BCP 47 language tag is a standardized code or tag that is used to identify human languages in the Internet. The tag structure has been standardized by the Internet Engineering Task Force (IETF) in Best Current Practice (BCP) 47; the subtags are maintained by the IANA Language Subtag Registry. [///]

To distinguish language variants for countries, regions, or writing systems (scripts), IETF language tags combine subtags from other standards such as ISO 639, ISO 15924, ISO 3166-1 and UN M.49. For example, the tag “en” stands for English; “es-419” for Latin American Spanish; “rm-sursilv” for Romansh Sursilvan; “sr-Cyrl” for Serbian written in Cyrillic script; “nan-Hant-TW” for Min Nan Chinese using traditional Han characters, as spoken in Taiwan; and “gsw-u-sd-chzh” for Zürich German. In its accordance with ISO 639-3, however, it does not provide codes for distinguishing between Arabic-based scripts, and maintains two duplicate codes for Punjabi, as well as a number of dubious or non-existent language distinctions made by its parents standard.

It is used by computing standards such as HTTP, HTML, XML and PNG.

History

IETF language tags were first defined in RFC 1766, edited by Harald Tveit Alvestrand, published in March 1995. The tags used ISO 639 two-letter language codes and ISO 3166 two-letter country codes, and allowed registration of whole tags that included variant or script subtags of three to eight letters.

In January 2001, this was updated by RFC 3066, which added the use of ISO 639-2 three-letter codes, permitted subtags with digits, and adopted the concept of language ranges from HTTP/1.1 to help with matching of language tags.

The next revision of the specification came in September 2006 with the publication of RFC 4646 (the main part of the specification), edited by Addison Philips and Mark Davis and RFC 4647 (which deals with matching behaviour). RFC 4646 introduced a more structured format for language tags, added the use of ISO 15924 four-letter script codes and UN M.49 three-digit geographical region codes, and replaced the old registry of tags with a new registry of subtags. The small number of previously defined tags that did not conform to the new structure were grandfathered in order to maintain compatibility with RFC 3066.

The current version of the specification, RFC 5646, was published in September 2009. The main purpose of this revision was to incorporate three-letter codes from ISO 639-3 and 639-5 into the Language Subtag Registry, in order to increase the interoperability between ISO 639 and BCP 47.

Syntax of language tags

Each language tag is composed of one or more “subtags” separated by hyphens (-). Each subtag is composed of basic Latin letters or digits only.

With the exceptions of private-use language tags beginning with an x- prefix and grandfathered language tags (including those starting with an i- prefix and those previously registered in the old Language Tag Registry), subtags occur in the following order:

  • A single primary language subtag based on a two-letter language code from ISO 639-1 (2002) or a three-letter code from ISO 639-2 (1998), ISO 639-3 (2007) or ISO 639-5 (2008), or registered through the BCP 47 process and composed of five to eight letters;
  • Up to three optional extended language subtags composed of three letters each, separated by hyphens; (There is currently no extended language subtag registered in the Language Subtag Registry without an equivalent and preferred primary language subtag. This component of language tags is preserved for backwards compatibility and to allow for future parts of ISO 639.)
  • An optional script subtag, based on a four-letter script code from ISO 15924 (usually written in Title Case);
  • An optional region subtag based on a two-letter country code from ISO 3166-1 alpha-2 (usually written in upper case), or a three-digit code from UN M.49 for geographical regions;
  • Optional variant subtags, separated by hyphens, each composed of five to eight letters, or of four characters starting with a digit; (Variant subtags are registered with IANA and not associated with any external standard.)
  • Optional extension subtags, separated by hyphens, each composed of a single character, with the exception of the letter x, and a hyphen followed by one or more subtags of two to eight characters each, separated by hyphens;
  • An optional private-use subtag, composed of the letter x and a hyphen followed by subtags of one to eight characters each, separated by hyphens.

Subtags are not case-sensitive, but the specification recommends using the same case as in the Language Subtag Registry, where region subtags are UPPERCASE, script subtags are Title Case, and all other subtags are lowercase. This capitalization follows the recommendations of the underlying ISO standards.

Optional script and region subtags are preferred to be omitted when they add no distinguishing information to a language tag. For example, es is preferred over es-Latn, as Spanish is fully expected to be written in the Latin script; ja is preferred over ja-JP, as Japanese as used in Japan does not differ markedly from Japanese as used elsewhere.

Not all linguistic regions can be represented with a valid region subtag: the subnational regional dialects of a primary language are registered as variant subtags. For example, the valencia variant subtag for the Valencian variant of the Catalan is registered in the Language Subtag Registry with the prefix ca. As this dialect is spoken almost exclusively in Spain, the region subtag ES can normally be omitted.

Furthermore, there are script tags that do not refer to traditional scripts such as Latin, or even scripts at all, and these usually begin with a Z. For example, Zsye refers to emojis, Zmth to mathematical notation, Zxxx to unwritten documents and Zyyy to undetermined scripts.

IETF language tags have been used as locale identifiers in many applications. It may be necessary for these applications to establish their own strategy for defining, encoding and matching locales if the strategy described in RFC 4647 is not adequate.

The use, interpretation and matching of IETF language tags is currently defined in RFC 5646 and RFC 4647. The Language Subtag Registry lists all currently valid public subtags. Private-use subtags are not included in the Registry as they are implementation-dependent and subject to private agreements between third parties using them. These private agreements are out of scope of BCP 47.

ISO 639 — Codes for the representation of names of languages

ISO 639 is a set of standards by the International Organization for Standardization that is concerned with representation of names for languages and language groups.

It was also the name of the original standard, approved in 1967 (as ISO 639/R) and withdrawn in 2002. The ISO 639 set now consists of five parts, since part 6 was withdrawn.

ISO 639-1 — Part 1: Alpha-2 code

ISO 639-1:2002, Codes for the representation of names of languages—Part 1: Alpha-2 code, is the first part of the ISO 639 series of international standards for language codes. Part 1 covers the registration of two-letter codes. There are 183 two-letter codes registered as of June 2021. The registered codes cover the world's major languages.

These codes are a useful international and formal shorthand for indicating languages.

Many multilingual web sites use these codes to prefix URLs of specific language versions of their web sites, for example, “ru.” before the website name is the Russian version of that website. See also IETF language tag. (Two-letter country-specific top-level-domain code suffixes are often different from these language-tag prefixes).

ISO 639, the original standard for language codes, was approved in 1967. It was split into parts, and in 2002 ISO 639-1 became the new revision of the original standard. The last code added was ht, representing Haitian Creole on 2003-02-26. The use of the standard was encouraged by IETF language tags, introduced in RFC 1766 in March 1995, and continued by RFC 3066 from January 2001 and RFC 4646 from September 2006. The current version is RFC 5646 from September 2009. Infoterm (International Information Center for Terminology) is the registration authority for ISO 639-1 codes.

New ISO 639-1 codes are not added if an ISO 639-2 code exists, so systems that use ISO 639-1 and 639-2 codes, with 639-1 codes preferred, do not have to change existing codes.

If an ISO 639-2 code that covers a group of languages is used, it might be overridden for some specific languages by a new ISO 639-1 code.

There is no specification on treatment of macrolanguages (see ISO 639-3).

ISO 639-2 — Part 2: Alpha-3 code

ISO 639-2:1998, Codes for the representation of names of languages — Part 2: Alpha-3 code, is the second part of the ISO 639 standard, which lists codes for the representation of the names of languages. The three-letter codes given for each language in this part of the standard are referred to as “Alpha-3” codes. There are 487 entries in the list of ISO 639-2 codes.

The US Library of Congress (LOC) is the registration authority for ISO 639-2 (referred to as ISO 639-2/RA). As registration authority, the LOC receives and reviews proposed changes; they also have representation on the ISO 639-RA Joint Advisory Committee responsible for maintaining the ISO 639 code tables.

ISO 639-2 Bibliographic

While most languages are given one code by the standard, twenty of the languages described have two three-letter codes, a “bibliographic” code (ISO 639-2/B), which is derived from the English name for the language and was a necessary legacy feature, and a “terminological” code (ISO 639-2/T), which is derived from the native name for the language and resembles the language's two-letter code in ISO 639-1. There were originally 22 B codes; scc and scr are now deprecated.[///]

In general the T codes are favored; ISO 639-3 uses ISO 639-2/T.[///]

ISO 639-2 Numeric

Certain file formats, e.g. MP4/QuickTime, use a numeric value derived from the ISO 639-2/T (Terminologic) language codes.

ISO 639-3 — Part 3: Alpha-3 code for comprehensive coverage of languages

ISO 639-3:2007, Codes for the representation of names of languages – Part 3: Alpha-3 code for comprehensive coverage of languages, is an international standard for language codes in the ISO 639 series. It defines three-letter codes for identifying languages. The standard was published by International Organization for Standardization (ISO) on 1 February 2007.

ISO 639-3 extends the ISO 639-2 alpha-3 codes with an aim to cover all known natural languages. The extended language coverage was based primarily on the language codes used in the Ethnologue (volumes 10–14) published by SIL International, which is now the registration authority for ISO 639-3. It provides an enumeration of languages as complete as possible, including living and extinct, ancient and constructed, major and minor, written and unwritten. However, it does not include reconstructed languages such as Proto-Indo-European.

ISO 639-3 is intended for use as metadata codes in a wide range of applications. It is widely used in computer and information systems, such as the Internet, in which many languages need to be supported. In archives and other information storage, it is used in cataloging systems, indicating what language a resource is in or about. The codes are also frequently used in the linguistic literature and elsewhere to compensate for the fact that language names may be obscure or ambiguous.

ISO 639-5 — Part 5: Alpha-3 code for language families and groups

ISO 639-5:2008 “Codes for the representation of names of languages—Part 5: Alpha-3 code for language families and groups” is a highly incomplete international standard published by the International Organization for Standardization (ISO). It was developed by ISO Technical Committee 37, Subcommittee 2, and first published on May 15, 2008. It is part of the ISO 639 series of standards.

ISO 15924 — Codes for the representation of names of scripts

ISO 15924, Codes for the representation of names of scripts, is an international standard defining codes for writing systems or scripts (a “set of graphic characters used for the written form of one or more languages”). Each script is given both a four-letter code and a numeric code.

Where possible the codes are derived from ISO 639-2, where the name of a script and the name of a language using the script are identical (example: Gujarātī ISO 639 guj, ISO 15924 Gujr). Preference is given to the 639-2 Bibliographical codes, which is different from the otherwise often preferred use of the Terminological codes.

4-letter ISO 15924 codes are incorporated into the IANA Language Subtag Registry for IETF language tags and so can be used in file formats that make use of such language tags. For example, they can be used in HTML and XML to help Web browsers determine which typeface to use for foreign text. This way one could differentiate, for example, between Serbian written in the Cyrillic (sr-Cyrl) or Latin (sr-Latn) script, or mark romanized or transliterated text as such.

References and Further Reading