Network Working Group A. Phillips, Ed. Request for Comments: 5646 Lab126 BCP: 47 M. Davis, Ed. Obsoletes: 4646 Google Category: Best Current Practice September 2009 Tags for Identifying Languages
AbstractThis document describes the structure, content, construction, and semantics of language tags for use in cases where it is desirable to indicate the language used in an information object. It also describes how to register values for use in language tags and the creation of user-defined extensions for private interchange. Status of This Memo This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements. Distribution of this memo is unlimited. Copyright Notice Copyright (c) 2009 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents in effect on the date of publication of this document (http://trustee.ietf.org/license-info). Please review these documents carefully, as they describe your rights and restrictions with respect to this document. This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not be modified outside the IETF Standards Process, and derivative works of it may not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English.
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 2. The Language Tag . . . . . . . . . . . . . . . . . . . . . . . 4 2.1. Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.1.1. Formatting of Language Tags . . . . . . . . . . . . . 6 2.2. Language Subtag Sources and Interpretation . . . . . . . . 8 2.2.1. Primary Language Subtag . . . . . . . . . . . . . . . . 9 2.2.2. Extended Language Subtags . . . . . . . . . . . . . . 11 2.2.3. Script Subtag . . . . . . . . . . . . . . . . . . . . 12 2.2.4. Region Subtag . . . . . . . . . . . . . . . . . . . . 13 2.2.5. Variant Subtags . . . . . . . . . . . . . . . . . . . 15 2.2.6. Extension Subtags . . . . . . . . . . . . . . . . . . 16 2.2.7. Private Use Subtags . . . . . . . . . . . . . . . . . 18 2.2.8. Grandfathered and Redundant Registrations . . . . . . 18 2.2.9. Classes of Conformance . . . . . . . . . . . . . . . . 19 3. Registry Format and Maintenance . . . . . . . . . . . . . . . 21 3.1. Format of the IANA Language Subtag Registry . . . . . . . 21 3.1.1. File Format . . . . . . . . . . . . . . . . . . . . . 21 3.1.2. Record and Field Definitions . . . . . . . . . . . . . 23 3.1.3. Type Field . . . . . . . . . . . . . . . . . . . . . . 26 3.1.4. Subtag and Tag Fields . . . . . . . . . . . . . . . . 26 3.1.5. Description Field . . . . . . . . . . . . . . . . . . 26 3.1.6. Deprecated Field . . . . . . . . . . . . . . . . . . . 28 3.1.7. Preferred-Value Field . . . . . . . . . . . . . . . . 28 3.1.8. Prefix Field . . . . . . . . . . . . . . . . . . . . . 31 3.1.9. Suppress-Script Field . . . . . . . . . . . . . . . . 32 3.1.10. Macrolanguage Field . . . . . . . . . . . . . . . . . 32 3.1.11. Scope Field . . . . . . . . . . . . . . . . . . . . . 33 3.1.12. Comments Field . . . . . . . . . . . . . . . . . . . . 34 3.2. Language Subtag Reviewer . . . . . . . . . . . . . . . . . 35 3.3. Maintenance of the Registry . . . . . . . . . . . . . . . 35 3.4. Stability of IANA Registry Entries . . . . . . . . . . . . 36 3.5. Registration Procedure for Subtags . . . . . . . . . . . . 41 3.6. Possibilities for Registration . . . . . . . . . . . . . . 46 3.7. Extensions and the Extensions Registry . . . . . . . . . . 49 3.8. Update of the Language Subtag Registry . . . . . . . . . . 52 3.9. Applicability of the Subtag Registry . . . . . . . . . . . 52 4. Formation and Processing of Language Tags . . . . . . . . . . 53 4.1. Choice of Language Tag . . . . . . . . . . . . . . . . . . 53 4.1.1. Tagging Encompassed Languages . . . . . . . . . . . . 58 4.1.2. Using Extended Language Subtags . . . . . . . . . . . 59 4.2. Meaning of the Language Tag . . . . . . . . . . . . . . . 61 4.3. Lists of Languages . . . . . . . . . . . . . . . . . . . . 63 4.4. Length Considerations . . . . . . . . . . . . . . . . . . 63 4.4.1. Working with Limited Buffer Sizes . . . . . . . . . . 64 4.4.2. Truncation of Language Tags . . . . . . . . . . . . . 65 4.5. Canonicalization of Language Tags . . . . . . . . . . . . 66
4.6. Considerations for Private Use Subtags . . . . . . . . . . 68 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 69 5.1. Language Subtag Registry . . . . . . . . . . . . . . . . . 69 5.2. Extensions Registry . . . . . . . . . . . . . . . . . . . 71 6. Security Considerations . . . . . . . . . . . . . . . . . . . 71 7. Character Set Considerations . . . . . . . . . . . . . . . . . 72 8. Changes from RFC 4646 . . . . . . . . . . . . . . . . . . . . 73 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 76 9.1. Normative References . . . . . . . . . . . . . . . . . . . 76 9.2. Informative References . . . . . . . . . . . . . . . . . . 78 Appendix A. Examples of Language Tags (Informative) . . . . . . . 80 Appendix B. Examples of Registration Forms . . . . . . . . . . . 82 Appendix C. Acknowledgements . . . . . . . . . . . . . . . . . . 83
form tags. It also defines a mechanism for private use values and future extensions. This document replaces [RFC4646] (which obsoleted [RFC3066] which, in turn, replaced [RFC1766]). This document, in combination with [RFC4647], comprises BCP 47. For a list of changes in this document, see Section 8. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. Unicode] U+002D). There are different types of subtag, each of which is distinguished by length, position in the tag, and content: each subtag's type can be recognized solely by these features. This makes it possible to extract and assign some semantic information to the subtags, even if the specific subtag values are not recognized. Thus, a language tag processor need not have a list of valid tags or subtags (that is, a copy of some version of the IANA Language Subtag Registry) in order to perform common searching and matching operations. The only exceptions to this ability to infer meaning from subtag structure are the grandfathered tags listed in the productions 'regular' and 'irregular' below. These tags were registered under [RFC3066] and are a fixed list that can never change. The syntax of the language tag in ABNF [RFC5234] is: Language-Tag = langtag ; normal language tags / privateuse ; private use tag / grandfathered ; grandfathered tags
langtag = language ["-" script] ["-" region] *("-" variant) *("-" extension) ["-" privateuse] language = 2*3ALPHA ; shortest ISO 639 code ["-" extlang] ; sometimes followed by ; extended language subtags / 4ALPHA ; or reserved for future use / 5*8ALPHA ; or registered language subtag extlang = 3ALPHA ; selected ISO 639 codes *2("-" 3ALPHA) ; permanently reserved script = 4ALPHA ; ISO 15924 code region = 2ALPHA ; ISO 3166-1 code / 3DIGIT ; UN M.49 code variant = 5*8alphanum ; registered variants / (DIGIT 3alphanum) extension = singleton 1*("-" (2*8alphanum)) ; Single alphanumerics ; "x" reserved for private use singleton = DIGIT ; 0 - 9 / %x41-57 ; A - W / %x59-5A ; Y - Z / %x61-77 ; a - w / %x79-7A ; y - z privateuse = "x" 1*("-" (1*8alphanum)) grandfathered = irregular ; non-redundant tags registered / regular ; during the RFC 3066 era irregular = "en-GB-oed" ; irregular tags do not match / "i-ami" ; the 'langtag' production and / "i-bnn" ; would not otherwise be / "i-default" ; considered 'well-formed' / "i-enochian" ; These tags are all valid, / "i-hak" ; but most are deprecated / "i-klingon" ; in favor of more modern / "i-lux" ; subtags or subtag / "i-mingo" ; combination
/ "i-navajo" / "i-pwn" / "i-tao" / "i-tay" / "i-tsu" / "sgn-BE-FR" / "sgn-BE-NL" / "sgn-CH-DE" regular = "art-lojban" ; these tags match the 'langtag' / "cel-gaulish" ; production, but their subtags / "no-bok" ; are not extended language / "no-nyn" ; or variant subtags: their meaning / "zh-guoyu" ; is defined by their registration / "zh-hakka" ; and all of these are deprecated / "zh-min" ; in favor of a more modern / "zh-min-nan" ; subtag or sequence of subtags / "zh-xiang" alphanum = (ALPHA / DIGIT) ; letters and numbers Figure 1: Language Tag ABNF For examples of language tags, see Appendix A. All subtags have a maximum length of eight characters. Whitespace is not permitted in a language tag. There is a subtlety in the ABNF production 'variant': a variant starting with a digit has a minimum length of four characters, while those starting with a letter have a minimum length of five characters. Although [RFC5234] refers to octets, the language tags described in this document are sequences of characters from the US-ASCII [ISO646] repertoire. Language tags MAY be used in documents and applications that use other encodings, so long as these encompass the relevant part of the US-ASCII repertoire. An example of this would be an XML document that uses the UTF-16LE [RFC2781] encoding of [Unicode].
conveys the same meaning: Mongolian written in the Cyrillic script as used in Mongolia. The ABNF syntax also does not distinguish between upper- and lowercase: the uppercase US-ASCII letters in the range 'A' through 'Z' are always considered equivalent and mapped directly to their US- ASCII lowercase equivalents in the range 'a' through 'z'. So the tag "I-AMI" is considered equivalent to that value "i-ami" in the 'irregular' production. Although case distinctions do not carry meaning in language tags, consistent formatting and presentation of language tags will aid users. The format of subtags in the registry is RECOMMENDED as the form to use in language tags. This format generally corresponds to the common conventions for the various ISO standards from which the subtags are derived. These conventions include: o [ISO639-1] recommends that language codes be written in lowercase ('mn' Mongolian). o [ISO15924] recommends that script codes use lowercase with the initial letter capitalized ('Cyrl' Cyrillic). o [ISO3166-1] recommends that country codes be capitalized ('MN' Mongolia). An implementation can reproduce this format without accessing the registry as follows. All subtags, including extension and private use subtags, use lowercase letters with two exceptions: two-letter and four-letter subtags that neither appear at the start of the tag nor occur after singletons. Such two-letter subtags are all uppercase (as in the tags "en-CA-x-ca" or "sgn-BE-FR") and four- letter subtags are titlecase (as in the tag "az-Latn-x-latn"). Note: Case folding of ASCII letters in certain locales, unless carefully handled, sometimes produces non-ASCII character values. The Unicode Character Database file "SpecialCasing.txt" [SpecialCasing] defines the specific cases that are known to cause problems with this. In particular, the letter 'i' (U+0069) in Turkish and Azerbaijani is uppercased to U+0130 (LATIN CAPITAL LETTER I WITH DOT ABOVE). Implementers SHOULD specify a locale-neutral casing operation to ensure that case folding of subtags does not produce this value, which is illegal in language tags. For example, if one were to uppercase the region subtag 'in' using Turkish locale rules, the sequence U+0130 U+004E would result, instead of the expected 'IN'.
Section 5 of this document. The Language Subtag Registry maintained by IANA is the source for valid subtags: other standards referenced in this section provide the source material for that registry. Terminology used in this document: o "Tag" refers to a complete language tag, such as "sr-Latn-RS" or "az-Arab-IR". Examples of tags in this document are enclosed in double-quotes ("en-US"). o "Subtag" refers to a specific section of a tag, delimited by a hyphen, such as the subtags 'zh', 'Hant', and 'CN' in the tag "zh- Hant-CN". Examples of subtags in this document are enclosed in single quotes ('Hant'). o "Code" refers to values defined in external standards (and that are used as subtags in this document). For example, 'Hant' is an [ISO15924] script code that was used to define the 'Hant' script subtag for use in a language tag. Examples of codes in this document are enclosed in single quotes ('en', 'Hant'). Language tags are designed so that each subtag type has unique length and content restrictions. These make identification of the subtag's type possible, even if the content of the subtag itself is unrecognized. This allows tags to be parsed and processed without reference to the latest version of the underlying standards or the IANA registry and makes the associated exception handling when parsing tags simpler. Some of the subtags in the IANA registry do not come from an underlying standard. These can only appear in specific positions in a tag: they can only occur as primary language subtags or as variant subtags. Sequences of private use and extension subtags MUST occur at the end of the sequence of subtags and MUST NOT be interspersed with subtags defined elsewhere in this document. These sequences are introduced by single-character subtags, which are reserved as follows: o The single-letter subtag 'x' introduces a sequence of private use subtags. The interpretation of any private use subtag is defined
solely by private agreement and is not defined by the rules in this section or in any standard or registry defined in this document. o The single-letter subtag 'i' is used by some grandfathered tags, such as "i-default", where it always appears in the first position and cannot be confused with an extension. o All other single-letter and single-digit subtags are reserved to introduce standardized extension subtag sequences as described in Section 3.7. Section 4.6. o The single-character subtag 'i' is used by some grandfathered tags (see Section 2.2.8) such as "i-klingon" and "i-bnn". (Other grandfathered tags have a primary language subtag in their first position.) The following rules apply to the primary language subtag: 1. Two-character primary language subtags were defined in the IANA registry according to the assignments found in the standard "ISO 639-1:2002, Codes for the representation of names of languages -- Part 1: Alpha-2 code" [ISO639-1], or using assignments subsequently made by the ISO 639-1 registration authority (RA) or governing standardization bodies. 2. Three-character primary language subtags in the IANA registry were defined according to the assignments found in one of these additional ISO 639 parts or assignments subsequently made by the relevant ISO 639 registration authorities or governing standardization bodies: A. "ISO 639-2:1998 - Codes for the representation of names of languages -- Part 2: Alpha-3 code - edition 1" [ISO639-2]
B. "ISO 639-3:2007 - Codes for the representation of names of languages -- Part 3: Alpha-3 code for comprehensive coverage of languages" [ISO639-3] C. "ISO 639-5:2008 - Codes for the representation of names of languages -- Part 5: Alpha-3 code for language families and groups" [ISO639-5] 3. The subtags in the range 'qaa' through 'qtz' are reserved for private use in language tags. These subtags correspond to codes reserved by ISO 639-2 for private use. These codes MAY be used for non-registered primary language subtags (instead of using private use subtags following 'x-'). Please refer to Section 4.6 for more information on private use subtags. 4. Four-character language subtags are reserved for possible future standardization. 5. Any language subtags of five to eight characters in length in the IANA registry were defined via the registration process in Section 3.5 and MAY be used to form the primary language subtag. An example of what such a registration might include is the grandfathered IANA registration "i-enochian". The subtag 'enochian' could be registered in the IANA registry as a primary language subtag (assuming that ISO 639 does not register this language first), making tags such as "enochian-AQ" and "enochian- Latn" valid. At the time this document was created, there were no examples of this kind of subtag. Future registrations of this type are discouraged: an attempt to register any new proposed primary language MUST be made to the ISO 639 registration authority. Proposals rejected by the ISO 639 registration authority are unlikely to meet the criteria for primary language subtags and are thus unlikely to be registered. 6. Other values MUST NOT be assigned to the primary subtag except by revision or update of this document. When languages have both an ISO 639-1 two-character code and a three- character code (assigned by ISO 639-2, ISO 639-3, or ISO 639-5), only the ISO 639-1 two-character code is defined in the IANA registry. When a language has no ISO 639-1 two-character code and the ISO 639-2/T (Terminology) code and the ISO 639-2/B (Bibliographic) code for that language differ, only the Terminology code is defined in the IANA registry. At the time this document was created, all languages that had both kinds of three-character codes were also assigned a
two-character code; it is expected that future assignments of this nature will not occur. In order to avoid instability in the canonical form of tags, if a two-character code is added to ISO 639-1 for a language for which a three-character code was already included in either ISO 639-2 or ISO 639-3, the two-character code MUST NOT be registered. See Section 3.4. For example, if some content were tagged with 'haw' (Hawaiian), which currently has no two-character code, the tag would not need to be changed if ISO 639-1 were to assign a two-character code to the Hawaiian language at a later date. To avoid these problems with versioning and subtag choice (as experienced during the transition between RFC 1766 and RFC 3066), as well as to ensure the canonical nature of subtags defined by this document, the ISO 639 Registration Authority Joint Advisory Committee (ISO 639/RA-JAC) has included the following statement in [iso639.prin]: "A language code already in ISO 639-2 at the point of freezing ISO 639-1 shall not later be added to ISO 639-1. This is to ensure consistency in usage over time, since users are directed in Internet applications to employ the alpha-3 code when an alpha-2 code for that language is not available." ISO639-3]. Language collections and groupings, such as defined in [ISO639-5], are specifically excluded from being extended language subtags.
2. Extended language subtag records MUST include exactly one 'Prefix' field indicating an appropriate subtag or sequence of subtags for that extended language subtag. 3. Extended language subtag records MUST include a 'Preferred- Value'. The 'Preferred-Value' and 'Subtag' fields MUST be identical. 4. Although the ABNF production 'extlang' permits up to three extended language tags in the language tag, extended language subtags MUST NOT include another extended language subtag in their 'Prefix'. That is, the second and third extended language subtag positions in a language tag are permanently reserved and tags that include those subtags in that position are, and will always remain, invalid. For example, the macrolanguage Chinese ('zh') encompasses a number of languages. For compatibility reasons, each of these languages has both a primary and extended language subtag in the registry. A few selected examples of these include Gan Chinese ('gan'), Cantonese Chinese ('yue'), and Mandarin Chinese ('cmn'). Each is encompassed by the macrolanguage 'zh' (Chinese). Therefore, they each have the prefix "zh" in their registry records. Thus, Gan Chinese is represented with tags beginning "zh-gan" or "gan", Cantonese with tags beginning either "yue" or "zh-yue", and Mandarin Chinese with "zh-cmn" or "cmn". The language subtag 'zh' can still be used without an extended language subtag to label a resource as some unspecified variety of Chinese, while the primary language subtag ('gan', 'yue', 'cmn') is preferred to using the extended language form ("zh-gan", "zh-yue", "zh-cmn"). ISO15924] ("Information and documentation -- Codes for the representation of names of scripts"), or subsequently assigned by the ISO 15924 registration authority or governing standardization bodies. Only codes assigned by ISO 15924 will be considered for registration.
3. The script subtags 'Qaaa' through 'Qabx' are reserved for private use in language tags. These subtags correspond to codes reserved by ISO 15924 for private use. These codes MAY be used for non- registered script values. Please refer to Section 4.6 for more information on private use subtags. 4. There MUST be at most one script subtag in a language tag, and the script subtag SHOULD be omitted when it adds no distinguishing value to the tag or when the primary or extended language subtag's record in the subtag registry includes a 'Suppress-Script' field listing the applicable script subtag. For example: "sr-Latn" represents Serbian written using the Latin script. ISO3166-1] ("Codes for the representation of names of countries and their subdivisions -- Part 1: Country codes"), using the list of alpha-2 country codes or using assignments subsequently made by the ISO 3166-1 maintenance agency or governing standardization bodies. In addition, the codes that are "exceptionally reserved" (as opposed to "assigned") in ISO 3166-1 were also defined in the registry, with the exception of 'UK', which is an exact synonym for the assigned code 'GB'. 3. The region subtags 'AA', 'QM'-'QZ', 'XA'-'XZ', and 'ZZ' are reserved for private use in language tags. These subtags correspond to codes reserved by ISO 3166 for private use. These codes MAY be used for private use region subtags (instead of using a private use subtag sequence). Please refer to Section 4.6 for more information on private use subtags.
4. Three-character region subtags consist solely of digit (number) characters and were defined according to the assignments found in the UN Standard Country or Area Codes for Statistical Use [UN_M.49] or assignments subsequently made by the governing standards body. Not all of the UN M.49 codes are defined in the IANA registry. The following rules define which codes are entered into the registry as valid subtags: A. UN numeric codes assigned to 'macro-geographical (continental)' or sub-regions MUST be registered in the registry. These codes are not associated with an assigned ISO 3166-1 alpha-2 code and represent supra-national areas, usually covering more than one nation, state, province, or territory. B. UN numeric codes for 'economic groupings' or 'other groupings' MUST NOT be registered in the IANA registry and MUST NOT be used to form language tags. C. When ISO 3166-1 reassigns a code formerly used for one country or area to another country or area and that code already is present in the registry, the UN numeric code for that country or area MUST be registered in the registry as described in Section 3.4 and MUST be used to form language tags that represent the country or region for which it is defined (rather than the recycled ISO 3166-1 code). D. UN numeric codes for countries or areas for which there is an associated ISO 3166-1 alpha-2 code in the registry MUST NOT be entered into the registry and MUST NOT be used to form language tags. Note that the ISO 3166-based subtag in the registry MUST actually be associated with the UN M.49 code in question. E. For historical reasons, the UN numeric code 830 (Channel Islands), which was not registered at the time this document was adopted and had, at that time, no corresponding ISO 3166-1 code, MAY be entered into the IANA registry via the process described in Section 3.5, provided no ISO 3166-1 code with that exact meaning has been previously registered. F. All other UN numeric codes for countries or areas that do not have an associated ISO 3166-1 alpha-2 code MUST NOT be entered into the registry and MUST NOT be used to form language tags. For more information about these codes, see Section 3.4.
5. The alphanumeric codes in Appendix X of the UN document MUST NOT be entered into the registry and MUST NOT be used to form language tags. (At the time this document was created, these values matched the ISO 3166-1 alpha-2 codes.) 6. There MUST be at most one region subtag in a language tag and the region subtag MAY be omitted, as when it adds no distinguishing value to the tag. For example: "de-AT" represents German ('de') as used in Austria ('AT'). "sr-Latn-RS" represents Serbian ('sr') written using Latin script ('Latn') as used in Serbia ('RS'). "es-419" represents Spanish ('es') appropriate to the UN-defined Latin America and Caribbean region ('419'). Section 3.5. Note that any particular variant subtag might be associated with some external standard. However, association with a standard is not required for registration. 3. More than one variant MAY be used to form the language tag. 4. Variant subtags MUST be registered with IANA according to the rules in Section 3.5 of this document before being used to form language tags. In order to distinguish variants from other types of subtags, registrations MUST meet the following length and content restrictions: 1. Variant subtags that begin with a letter (a-z, A-Z) MUST be at least five characters long.
2. Variant subtags that begin with a digit (0-9) MUST be at least four characters long. 5. The same variant subtag MUST NOT be used more than once within a language tag. * For example, the tag "de-DE-1901-1901" is not valid. Variant subtag records in the Language Subtag Registry MAY include one or more 'Prefix' (Section 3.1.8) fields. Each 'Prefix' indicates a suitable sequence of subtags for forming (with other subtags, as appropriate) a language tag when using the variant. Most variants that share a prefix are mutually exclusive. For example, the German orthographic variations '1996' and '1901' SHOULD NOT be used in the same tag, as they represent the dates of different spelling reforms. A variant that can meaningfully be used in combination with another variant SHOULD include a 'Prefix' field in its registry record that lists that other variant. For example, if another German variant 'example' were created that made sense to use with '1996', then 'example' should include two 'Prefix' fields: "de" and "de-1996". For example: "sl-nedis" represents the Natisone or Nadiza dialect of Slovenian. "de-CH-1996" represents German as used in Switzerland and as written using the spelling reform beginning in the year 1996 C.E. Section 3.7. The following rules apply to extensions: 1. An extension MUST follow at least a primary language subtag. That is, a language tag cannot begin with an extension. Extensions extend language tags, they do not override or replace them. For example, "a-value" is not a well-formed language tag, while "de-a-value" is. Note that extensions cannot be used in tags that are entirely private use (that is, tags starting with "x-").
2. Extension subtags are separated from the other subtags defined in this document by a single-character subtag (called a "singleton"). The singleton MUST be one allocated to a registration authority via the mechanism described in Section 3.7 and MUST NOT be the letter 'x', which is reserved for private use subtag sequences. 3. Each singleton subtag MUST appear at most one time in each tag (other than as a private use subtag). That is, singleton subtags MUST NOT be repeated. For example, the tag "en-a-bbb-a-ccc" is invalid because the subtag 'a' appears twice. Note that the tag "en-a-bbb-x-a-ccc" is valid because the second appearance of the singleton 'a' is in a private use sequence. 4. Extension subtags MUST meet whatever requirements are set by the document that defines their singleton prefix and whatever requirements are provided by the maintaining authority. Note that there might not be a registry of these subtags and validating processors are not required to validate extensions. 5. Each extension subtag MUST be from two to eight characters long and consist solely of letters or digits, with each subtag separated by a single '-'. Case distinctions are ignored in extensions (as with any language subtag) and normalized subtags of this type are expected to be in lowercase. 6. Each singleton MUST be followed by at least one extension subtag. For example, the tag "tlh-a-b-foo" is invalid because the first singleton 'a' is followed immediately by another singleton 'b'. 7. Extension subtags MUST follow all primary language, extended language, script, region, and variant subtags in a tag and MUST precede any private use subtag sequences. 8. All subtags following the singleton and before another singleton are part of the extension. Example: In the tag "fr-a-Latn", the subtag 'Latn' does not represent the script subtag 'Latn' defined in the IANA Language Subtag Registry. Its meaning is defined by the extension 'a'. 9. In the event that more than one extension appears in a single tag, the tag SHOULD be canonicalized as described in Section 4.5, by ordering the various extension sequences into case-insensitive ASCII order. For example, if an extension were defined for the singleton 'r' and it defined the subtags shown, then the following tag would be a valid example: "en-Latn-GB-boont-r-extended-sequence-x-private".
Section 4.6 for more information on private use subtag choice. For example, suppose a group of scholars is studying some texts in medieval Greek. They might agree to use some collection of private use subtags to identify different styles of writing in the texts. For example, they might use 'el-x-koine' for documents in the "common" style while using 'el-x-attic' for other documents that mimic the Attic style. These subtags would not be recognized by outside processes or systems, but might be useful in categorizing various texts for study by those in the group. In the registry, there are also subtags derived from codes reserved by ISO 639, ISO 15924, or ISO 3166 for private use. Do not confuse these with private use subtag sequences following the subtag 'x'. See Section 4.6. RFC 4646, whole language tags were registered according to the rules in RFC 1766 and/or RFC 3066. All of these registered tags remain valid as language tags.
Many of these registered tags were made redundant by the advent of either RFC 4646 or this document. A redundant tag is a grandfathered registration whose individual subtags appear with the same semantic meaning in the registry. For example, the tag "zh-Hant" (Traditional Chinese) can now be composed from the subtags 'zh' (Chinese) and 'Hant' (Han script traditional variant). These redundant tags are maintained in the registry as records of type 'redundant', mostly as a matter of historical curiosity. The remainder of the previously registered tags are "grandfathered". These tags are classified into two groups: 'regular' and 'irregular'. Grandfathered tags that (appear to) match the 'langtag' production in Figure 1 are considered 'regular' grandfathered tags. These tags contain one or more subtags that either do not individually appear in the registry or appear but with a different semantic meaning: each tag, in its entirety, represents a language or collection of languages. Grandfathered tags that do not match the 'langtag' production in the ABNF and would otherwise be invalid are considered 'irregular' grandfathered tags. With the exception of "en-GB-oed", which is a variant of "en-GB", each of them, in its entirety, represents a language. Many of the grandfathered tags have been superseded by the subsequent addition of new subtags: each superseded record contains a 'Preferred-Value' field that ought to be used to form language tags representing that value. For example, the tag "art-lojban" is superseded by the primary language subtag 'jbo'. Section 2.1). Language tags may be well-formed in terms of syntax but not valid in terms of content. However, many operations involving language tags work well without knowing anything about the meaning or validity of the subtags. A tag is considered "valid" if it satisfies these conditions: o The tag is well-formed.
o Either the tag is in the list of grandfathered tags or all of its primary language, extended language, script, region, and variant subtags appear in the IANA Language Subtag Registry as of the particular registry date. o There are no duplicate variant subtags. o There are no duplicate singleton (extension) subtags. Note that a tag's validity depends on the date of the registry used to validate the tag. A more recent copy of the registry might contain a subtag that an older version does not. A tag is considered valid for a given extension (Section 3.7) (as of a particular version, revision, and date) if it meets the criteria for "valid" above and also satisfies this condition: Each subtag used in the extension part of the tag is valid according to the extension. Older specifications or language tag implementations sometimes reference [RFC3066]. A wider array of tags was considered well- formed under that document. Any tags that were valid for use under RFC 3066 are both well-formed and valid under this document's syntax; only invalid or illegal tags were well-formed under the earlier definition but no longer are. The language tag syntax under RFC 3066 was: obs-language-tag = primary-subtag *( "-" subtag ) primary-subtag = 1*8ALPHA subtag = 1*8(ALPHA / DIGIT) Figure 2: RFC 3066 Language Tag Syntax Subtags designated for private use as well as private use sequences introduced by the 'x' subtag are available for cases in which no assigned subtags are available and registration is not a suitable option. For example, one might use a tag such as "no-QQ", where 'QQ' is one of a range of private use ISO 3166-1 codes to indicate an otherwise undefined region. Users MUST NOT assign language tags that use subtags that do not appear in the registry other than in private use sequences (such as the subtag 'personal' in the tag "en-x- personal"). Besides not being valid, the user also risks collision with a future possible assignment or registrations. Note well: although the 'Language-Tag' production appearing in this document is functionally equivalent to the one in [RFC4646], it has
been changed to prevent certain errors in well-formedness arising from the old 'grandfathered' production.