Name
xml:lang
Synopsis
xml:lang='
iso_639_identifier
'
Description
The xml:lang attribute can be used on any element. Its value
indicates the language of that element. This is useful in a multilingual
context. For example, you might have:
<para xml:lang="en" >Hello</para> <para xml:lang="fr">Bonjour</para>
This format allows you to display one or the other, depending on the user’s language preference.
The syntax of the xml:lang value is defined by RFC-1766, available
at http://ds0.internic.net/rfc/rfc1766.txt. A two-letter language code
is optionally followed by a hyphen and a two-letter country code. The
languages are defined by RFC-1766 and the countries are defined by ISO-3166.
Traditionally, the language is given in lowercase and the country in
uppercase (and for safety, this rule should be followed), but processors
are expected to use the values in a case-insensitive manner.
In addition, RFC-1766 also provides extensions for nonstandardized
languages or language variants. Valid xml:lang values include
such notations as en, en-US, en-UK, en-cockney,
i-navajo, and x-minbari.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access