This document is a draft, and is designed to show changes from a previous version. It is presently showing added text,changed text,deleted text,[start]/[end] markers,and Issue Numbers.
Changes are displayed as follows:
HTML 4, XHTML 1.0 and XHTML 1.1
This technique relates to:
The objective of this technique is to clearly identify any changes in language on a page by using the lang
or xml:lang
attribute, as appropriate for the HTML or XHTML version you use.
HTML 4.01 uses the lang
attribute on elements. XHTML served as text/html uses the lang
attribute and the xml:lang
attribute on elements, in order to meet the requirements of XHTML and provide backward compatibility with HTML. XHTML served as application/xhtml+xml uses the xml:lang
attribute on elements.
Note:
HTML only offers the use of the lang
attribute, while XHTML 1.0 (as a transitional measure) allows both attributes, and XHTML 1.1 allows only xml:lang
.
This example demonstrates the use of the xml:lang
attribute defining a quote written in German. This snippet could be included by an XHTML 1.1 document where lang
is not allowed.
<blockquote xml:lang="de"> <p>Da dachte der Herr daran, ihn aus dem Futter zu schaffen, aber der Esel merkte, daß kein guter Wind wehte, lief fort und machte sich auf den Weg nach Bremen: dort, meinte er, könnte er ja Stadtmusikant werden.</p> </blockquote>
.
<p> And with a certain <span lang="fr">je ne sais quoi</span>, she entered both the room, and his life, forever. "My name is Natasha," she said. "<span lang="it">Piacere,</span>" he replied in impeccable Italian, locking the door. </p>
Resources are for information purposes only, no endorsement implied.
For each element in the document:
Check that the human language of the content of the element is the same as the inherited language for the element as specified in HTML 4.01, Inheritance of language codes
For each lang
attribute in the document:
Check that the value of the lang
attribute conforms to [begin change]BCP 47: Tags for the Identification of Languages[end change]
[1961]
or its successor
For each xml:lang attribute in the document:
Check that the value of the xml:lang
attribute conforms to [begin change]BCP 47: Tags for the Identification of Languages[end change]
[1961]
or its successor
All checks above are true.