It is possible to specify the particular language in use for a document or even a
particular element. In HTML there is the common LANG attribute available, the META
element charset values and special HTTP headers, all allowing an author
to specify the human language of the content. In XML, there is the common 'xml:lang'
attribute.
The :lang Pseudo-element in CSS creates a selector that can address content according
to the human language it is encoded in. It takes as a value a string that identifies a
language system used for communication (with the exception of computer languages.)
The syntax and registry of HTML language tags is identical to the system specified in
RFC 1766.
A language tag is composed of one or more parts: A primary language tag
and a possibly empty series of subtags:
language-tag = [Primary
Language Tag] ("-" [Language Subtag])*
[Primary Language Tag] = "i"
(for IANA defined languages) | "x" (custom/private use language) | [ISO 639 2-letter
Language Code]
[Language Subtag] =
[ISO 3166 2-letter country code] | [dialect or other locale/situation specific
language]
Language tags are case-insensitive and spaces are not allowed. The
registering of language tags is administered by the
Internet Assigned Numbers Authority (IANA).
Example language tags include en, en-US,
and x-pig-latin
Example
Ext/Doc: blockquote:lang(fr)
{ quotes: '« ' ' »' }
(Sets the 'quotes' property on French BLOCKQUOTE elements to
use French quotation marks.)