Name
xml:lang
Synopsis
xml:lang=”iso_639_identifier"
The xml:lang attribute
can be used on any element. Its value indicates the language of
the body of the 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 element or the other, depending on the user’s language preference.
The syntax of the xml:lang
value is defined by ISO-639. A two-letter language code is optionally
followed by a hyphen and a two-letter country code. 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, ISO-3166 provides extensions for nonstandardized
languages or language variants. Valid
xml:lang values include notations
such 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