14. XHTML I18N Attribute Module

Contents

This section is normative.

This module defines the I18N attribute collection.

14.1. I18N Attribute Collection

xml:lang = LanguageCode
This attribute indicates the language of an element's attribute values and text content, and of all elements it contains, unless overridden. It is defined normatively in [XML] section 2.12. The default value of this attribute is unspecified.

An element inherits language code information according to the following order of precedence (highest to lowest):

  1. The @xml:lang attribute set for the element itself.
  2. The closest parent element that has the @xml:lang attribute set (i.e., the @xml:lang attribute is inherited).

In this example, the default text-processing language of the document is French ("fr"). Within the first paragraph a single word is declared to be in English ("en"), after which the primary language returns to French. The following paragraph is declared to be in English and includes an embedded French word.

Example

<html xmlns="http://www.w3.org/2002/06/xhtml2" xml:lang="fr" ...>
<head>
   <title>Un document multilingue</title>
</head>
<body>
<p>En janvier, toutes les boutiques de Londres
affichent des panneaux <span xml:lang="en">SALE</span>,
mais en fait ces magasins sont bien propres!</p>
<p xml:lang="en">Everwhere I went in France
the bakeries had signs up saying <em xml:lang="fr">PAIN</em>,
but despite that the bakers seemed quite happy.
</p>
</body>
</html>

Implementations: RELAX NG, XML Schema

14.2. Issues

Internationalization: translate attribute PR #7883
State: Approved
Resolution: Reject
User: None

Notes:
This is what ITS is for. We plan to incorporate ITS into XHTML 2.