computer tips trick
Terminology
In this article we refer to the value of a language attribute such as fr-CA
as a language tag. The fr
and CA
parts are referred to as subtags when described as parts of a tag. When described as members of an ISO list of languages or countries, fr
and CA
are referred to as codes.
Language tags can be (and should be) used to indicate the language of text in HTML and XML documents. For HTML 4, language tags are specified with the lang
attribute. For XML, language tags are given in the xml:lang
attribute. In both cases, language information is inherited along the document hierarchy, i.e. it has to be given only once if the whole document is in one language, and language information nests, i.e. inner attributes overwrite outer attributes.
Language tags are defined in RFC 3066, which obsoletes the older RFC 1766. XML has been updated to use RFC 3066 by an erratum. RFC 3066 is based on ISO-639 two-letter and three letter language codes, and on ISO-3166 two-letter country codes. RFC 1766 did not include three-letter language codes.