Product SiteDocumentation Site

Appendix G. Language codes

Region subtags

The only part of the XML language tag that is mandatory in Publican is the language subtag. However, Publican is designed with the assumption that you will routinely include the region subtag when you identify languages. In many languages, spelling and vocabulary vary significantly from region to region. If you do not specify the regional variety of a language in which your document is authored or into which it is translated, you might obtain unexpected results when you build the document in Publican.

Other language codes

The system of codes used to identify languages in the XML standard is not the only system of languages codes in use in the world today. However, because Publican strives to comply with the XML standard, these are the only codes that Publican supports. In particular, note that the codes used in the GNU tools (identified by their use of underscores and the @ symbol to separate elements — for example, en_GB or sr_RS@latin) do not comply with the XML standard and therefore do not work with Publican.
Publican is an XML publication tool and therefore is designed to use the language codes — or tags — that the World Wide Web Consortium (W3C) designated in the XML specification.[5] These codes are defined in the Internet Engineering Task Force (IETF) document BCP 47: Tags for Identifying Languages.[6]
Language tags are built from one of more subtags, separated from one another by hyphens. In order of appearance within a language tag, these subtags are:
language-script-region-variant
BCP 47 also allows for considerable customization of language tags for special purposes through the use of extension subtags and private-use subtags. Extension subtags allow for finer-tuning of existing subtags, but must be registered with the IETF (none are currently registered). Private-use subtags are introduced by x- and do not need to be registered. Private-use subtags aside, a subtag is valid if it appears in the registry of subtags maintained by the IETF through the Internet Assigned Numbers Authority (IANA).[7] Although Publican will accept any language tag that is valid under the rules presented in BCP 47, it is designed around the assumption that language tags for documents will most usually take the form language-region. A brief description of subtags follows:
language subtag
The language subtag comprises two or more lower-case letters and is the only mandatory part of the language tag. For most widely spoken languages, the language subtag is a two-letter code identical with the language codes specified in ISO 639-1, [8] for example, zh (Chinese), hi (Hindi), es (Spanish), and en (English). Where no two-letter code exists in ISO 639-1, the language subtag is usually a three-letter code identical with the codes specified in ISO 639-2,[9] for example, bal (Balochi), apk (Kiowa Apache), and tpi (Tok Pisin). Finally, a small number of language subtags appear in the IANA registry that have no ISO 639-1 or ISO 639-2 equivalent, such as subtags for the constructed languages qya (Quenya) and tlh (Klingon), and for the occult language i-enochian (Enochian). This last example also illustrates a small number of language subtags grandfathered into the registry that do not match the two-letter or three-letter pattern of codes derived from the ISO 639 standards.

Extended language subtags

RFC 5646: Tags for Identifying Languages[10] issued in September 2009 allows for extended language subtags to follow the language subtag. Extended language subtags are three-letter codes that represent languages that share a close relationship with a language already represented by a language subtag. For example, yue represents Cantonese, but this subtag must always be used with the language subtag associated with it (Chinese), thus: zh-yue. The IETF does not yet recognize RFC 5646 as "Best Common Practice", nor are these subtags part of the XML standard yet.
script subtag
The script subtag comprises four letters — the first one in upper case, the other three in lower case — and defines a writing system. These codes are identical with the four-letter codes specified in ISO 15924.[11] The script subtag is used to identify languages that are commonly written with more than one writing system; the subtag is omitted when it adds no distinguishing value to the language tag overall. For example, sr-Latn represents Serbian written with the Latin alphabet and sr-Cyrl represents Serbian written with the Cyrillic alphabet; az-Arab represents Azerbaijani written in Arabic script and az-Cyrl represents Azerbaijani written with the Cyrillic alphabet. Conversely, French should not be represented as fr-Latn, because French is not commonly written in any script other than the Latin alphabet anywhere in the world.
region subtag
The region subtag comprises either two upper-case letters (for regions that conform to national boundaries) or three digits (for other areas, such as trans-national regions). The two-letter subtags are identical with those from ISO 3166-1[12], for example, AT (Austria), TZ (Tanzania), and VE (Venezuela). The three-digit region subtags are based on those in UN M.49, [13] for example, 015 (Northern Africa), 061 (Polynesia), and 419 (Latin America and the Caribbean).
variant subtag
Variant subtags identify well-defined, recognizable variants of a language or script and can include upper-case letters, lower-case letters, and numerals. Variant subtags that start with a letter must be at least five characters long, and those that start with a numeral must be at least four characters long. Most variant subtags can only be used in combination with specific subtags or combinations of subtags. Variant subtags do not harmonize with any other standard; they are each the result of a separate registration with the IETF by an interested person or group.
Under the present standard, dialects of several languages are designated with variant subtags, for example, nedis denotes Nadiza (also known as Natisone), a dialect of Slovenian. This tag must be used in conjunction with the language subtag for Slovenian, thus: sl-nedis. In September 2009, the IETF issued a Request for Comments (RFC) that (amongst other things) proposes that dialects be represented by language extension subtags attached to language subtags.[14]
Most variant subtags mark a particular orthography, most usually as a result of an official spelling reform or a significant work documenting the language. Examples (with their required language subtags) include: fr-1606nicot (French as documented by Jean Nicot in 1606), de-1901 (German spelling codified by the 2nd Orthographic Conference in 1901) and be-1959acad (Belarusian as codified by the Orthography Commission in 1959).
Finally, some variant subtags denote a particular variant of a system of writing or transliteration. For example, zh-Latn-wadegile is Chinese written in the Latin alphabet, according to the transliteration system developed by Thomas Wade and Herbert Giles; ja-Latn-hepburn is Japanese written in the Latin alphabet using the transliteration system of James Curtis Hepburn.
Publican includes support for the following languages: