An IETF BCP 47 language tag is a standardized code that is used to identify human languages on 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 stands for English; for Latin American Spanish; for Romansh Sursilvan; for Serbian written in Cyrillic script; for Minnan using traditional Han characters, as spoken in Taiwan; for Cantonese using traditional Han characters, as spoken in Hong Kong; and for Zürich German.
It is used by computing standards such as HTTP, HTML, XML and PNG.
History IETF language tags were first defined in Request for comment 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 only of either basic Latin letters or digits.
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 backward 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.
List of common primary language subtags
The following is a list of some of the more commonly used primary language subtags. The list represents only a small subset (less than 2 percent) of primary language subtags; for full information, the Language Subtag Registry should be consulted directly.
+ Common languages and their IETF subtags English name Native name SubtagAfrikaansaf Amharic am Arabic ar Mapudungun arnMoroccan Arabicary Assamese as Azerbaijani az Bashkir ba Belarusian be Bulgarian bg Bengali bn Tibetan bo Breton br Bosnian / bs Catalan ca Central Kurdish ckb Corsican co Czech cs Welsh cy Danish da German de Lower Sorbian dsb Divehi dv Greek el English English en Spanish es Estonian et Basque eu Persian fa Finnish fi Filipino fil Faroese fo French fr Frisian fy Irish ga Scottish Gaelic gdGilberteseTaetae ni Kiribatigil Galician gl Swiss German gsw Gujarati gu Hausa ha Hebrew he Hindi hi Croatian hr Upper Sorbian hsb Hungarian hu Armenian hy Indonesian id Igbo ig Yi ii Icelandic is Italian it Inuktitut / () iu Japanese ja Georgian ka Kazakh kk Greenlandic kl Khmer km Kannada kn Korean ko Konkani kok Kurdish ku Kyrgyz ky Luxembourgish lb Lao lo Lithuanian lt Latvian lv Māori mi Macedonian mk Malayalam ml Mongolian / mn Mohawk moh Marathi mr Malay ms Maltese mt Burmese my Norwegian (Bokmål) nb Nepali ne Dutch nl Norwegian (Nynorsk) nn Norwegian no Occitan oc Odia orPapiamento pap Punjabi pa Polish pl Dari prs Pashto ps Portuguese pt K'iche quc Quechua qu Romansh rm Romanian ro Russian ru Kinyarwanda rw Sanskrit sa Yakut sah Sindhi sd Sami (Northern) se Sinhala si Slovak sk Slovenian sl Sami (Southern) sma Sami (Lule) smj Sami (Inari) smn Sami (Skolt) sms Albanian sq Serbian / sr Sesotho st Swedish sv Kiswahili sw Syriac syc Tamil ta Telugu te Tajik tg Thai th Turkmen tk Tagalog tl Tswana tn Turkish tr Tatar tt Tamazight tzm Uyghur ug Ukrainian українська uk Urdu ur Uzbek / uz Vietnamese vi Wolof wo Xhosa xh Yiddish yi Yoruba yo Chinese zh Zulu zu
Relation to other standards Although some types of subtags are derived from ISO or UN core standards, they do not follow these standards absolutely, as this could lead to the meaning of language tags changing over time. In particular, a subtag derived from a code assigned by ISO 639, ISO 15924, ISO 3166, or UN M49 remains a valid (though deprecated) subtag even if the code is withdrawn from the corresponding core standard. If the standard later assigns a new meaning to the withdrawn code, the corresponding subtag will still retain its old meaning.
This stability was introduced in RFC 4646.
ISO 639-3 and ISO 639-1
RFC 4646 defined the concept of an "extended language subtag" (sometimes referred to as extlang), although no such subtags were registered at that time.
RFC 5645 and RFC 5646 added primary language subtags corresponding to ISO 639-3 codes for all languages that did not already exist in the Registry. In addition, codes for languages encompassed by certain macrolanguages were registered as extended language subtags. Sign languages were also registered as extlangs, with the prefix sgn. These languages may be represented either with the subtag for the encompassed language alone (cmn for Mandarin) or with a language-extlang combination (zh-cmn). The first option is preferred for most purposes. The second option is called "extlang form" and is new in RFC 5646.
Whole tags that were registered prior to RFC 4646 and are now classified as "grandfathered" or "redundant" (depending on whether they fit the new syntax) are deprecated in favor of the corresponding ISO 639-3–based language subtag, if one exists. To list a few examples, nan is preferred over zh-min-nan for Minnan; hak is preferred over i-hak and zh-hakka for Hakka; and ase is preferred over sgn-US for American Sign Language.
Windows Vista and later versions of Microsoft Windows have RFC 4646 support.
ISO 639-5 and ISO 639-1/2 ISO 639-5 defines language collections with alpha-3 codes in a different way than they were initially encoded in ISO 639-2 (including one code already present in ISO 639-1, Bihari coded inclusively as bh in ISO 639-1 and bih in ISO 639-2). Specifically, the language collections are now all defined in ISO 639-5 as inclusive, rather than some of them being defined exclusively. This means that language collections have a broader scope than before, in some cases where they could encompass languages that were already encoded separately within ISO 639-2.
For example, the ISO 639-2 code afa was previously associated with the name "Afro-Asiatic (Other)", excluding languages such as Arabic that already had their own code. In ISO 639-5, this collection is named "Afro-Asiatic languages" and includes all such languages. ISO 639-2 changed the exclusive names in 2009 to match the inclusive ISO 639-5 names.
To avoid breaking implementations that may still depend on the older (exclusive) definition of these collections, ISO 639-5 defines a grouping type attribute for all collections that were already encoded in ISO 639-2 (such grouping type is not defined for the new collections added only in ISO 639-5).
BCP 47 defines a "Scope" property to identify subtags for language collections. However, it does not define any given collection as inclusive or exclusive, and does not use the ISO 639-5 grouping type attribute, although the description fields in the Language Subtag Registry for these subtags match the ISO 639-5 (inclusive) names. As a consequence, BCP 47 language tags that include a primary language subtag for a collection may be ambiguous as to whether the collection is intended to be inclusive or exclusive.