Language Tag

The vocabulary for BCP 47 language tags and the subtags they are built from — the schema behind the generated `language-tags` code list. A LanguageTag is a complete tag that can label text in a language; a Subtag is a registered building block (a script, a region, a variant). A primary language subtag is both.

BCP 47 identifies a language with a tag such as en, zh-Hant or sl-rozaj, composed from registered subtags: a primary language, optionally an extended language, a script, a region and variants. The IANA Language Subtag Registry is the source of truth for the subtags and for a small set of whole tags registered before the grammar settled (grandfathered) or registered redundantly. The language-tags package at codes.kanonak.org is that registry projected into Kanonak by its producer; this package is the schema the projection is typed with.

The two classes to know are Language Tag — anything that can stand as a complete tag, and therefore anything a language-tagged string may point at — and Subtag — a registered component. A Language Subtag is both, so en alone is a valid tag. A Script Subtag such as Hant, a Region Subtag such as US or 001, an Extended Language Subtag and a Variant Subtag are components only. Grandfathered Tag and Redundant Tag are the registry's whole-tag entries. Because the registry holds subtags, not the tags people compose from them, a document that needs zh-Hant-TW declares it in its own package as a LanguageTag composed via Primary Language, Script and Region from the registry's entries — the composition is validated, and the registry stays a finite list.

Lifecycle follows the code-lists floor: a retired entry carries owl.deprecated and Deprecated On, and the registry's preferred value becomes prov.supersededBy on the entry — so a validator can say "iw is deprecated; use he" with a real reference, not a string.

AddedThe date the entry was added to the registry.CollectionA code for a group of languages that is not itself a language (`gem` Germanic).Deprecated OnThe date the registry deprecated the entry. Accompanies owl.deprecated; the replacement, when the registry names one, is prov.supersededBy.Extended LanguageThe extended language subtag of a composed tag, if any.Extended Language SubtagAn extended language subtag (`yue` after `zh`), always preceded by the primary language its prefix names. Every extlang is also registered as a primary…Grandfathered TagA whole tag registered under RFC 1766 or RFC 3066 before the current grammar (`i-klingon`, `art-lojban`). Most are deprecated in favour of a tag the grammar…Language SubtagA primary language subtag (`en`, `zh`, `cmn`). A subtag, and also a complete tag on its own — the common case for tagging text.Language TagA complete BCP 47 tag — something that can label text in a language. A primary language subtag alone (`en`), a grandfathered or redundant registered tag…MacrolanguageA language code that covers several closely related individual languages (`zh`, `ar`).MacrolanguageThe macrolanguage this individual language belongs to (`zh` for `cmn`).PrefixA tag this subtag is registered to follow (`de` for the variant `1901`, `sl-rozaj` for `njiva`). A pattern over tags, so a string rather than a reference; a…Primary LanguageThe primary language subtag a composed tag starts with.Private UseA code reserved for private agreement between parties.Redundant TagA whole tag registered under earlier rules that the current grammar can compose from subtags (`zh-Hant`, `sgn-BE-FR`). Kept as a registered entry for…RegionThe region subtag of a composed tag, if any.Region SubtagA region subtag — a two-letter country code (`US`, `GB`) or a three-digit UN M.49 area code (`001` world, `419` Latin America).ScopeThe registry scope of a language subtag that is not an individual language.ScriptThe script subtag of a composed tag, if any.Script SubtagA script subtag (`Latn`, `Hant`, `Cyrl`), four letters, title case.SpecialA special-purpose code — multiple languages, undetermined, no linguistic content, uncoded.SubtagA registered BCP 47 subtag — a building block of a tag. The code is the subtag exactly as registered, including case (`Hant`, `US`).Subtag ScopeThe registry's scope of a language subtag when it is not an individual language: a macrolanguage, a collection of languages, a special code (`mul`, `und`,…Suppress ScriptThe script that is implied and should not be written for this language (`Latn` for `en`), per the registry.Variant SubtagA variant subtag (`rozaj`, `1901`, `oxendict`) qualifying a language or script — an orthography, a dialect, a transliteration. Its prefix names the tags it may…VariantsThe variant subtags of a composed tag, in order.