User Agent and Assistive Technology Support Notes

Description

The objective of this technique is to identify the default language of a document by
providing the lang and/or xml:lang attribute on the html
element.

Identifying the language of the document is important for a number of reasons:

It allows braille translation software to substitute control codes for accented
characters, and insert control codes necessary to prevent erroneous creation of
Grade 2 braille contractions.

Speech synthesizers that support multiple languages will be able to orient and
adapt to the pronunciation and syntax that are specific to the language of the page,
speaking the text in the appropriate accent with proper pronunciation.

Marking the language can benefit future developments in technology, for example
users who are unable to translate between languages themselves will be able to use
machines to translate unfamiliar languages.

Marking the language can also assist user agents in providing definitions using a
dictionary.

HTML 4.01 uses the lang attribute of the html element. XHTML served
as text/html uses the lang attribute and the xml:lang attribute of
the html element, 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 of the html element. Both the lang
and the xml:lang attributes can take only one value.

Note 1:
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.

Note 2:
Allowed values for the lang and xml:lang attributes are indicated in the resources referenced below. Language tags use a primary code to indicate the language, and optional subcodes (separated by hyphen characters) to indicate variants of the language. For instance, English is indicated with the primary code "en"; British English and American English can be distinguished by using "en-GB" and "en-US", respectively. Use of the primary code is important for this technique. Use of subcodes is optional but may be helpful in certain circumstances.

Examples

Example 1

This example defines the content of an HTML document to be in the French language.

Example 2

This example defines the content of an XHTML 1.0 document with content type of
text/html to be in the French language. Both the lang and
xml:lang attributes are specified in order to meet the requirements of
XHTML and provide backward compatibility with HTML.

Expected Results

The above checks are all true.

If this is a sufficient technique for a success criterion, failing this test procedure does not necessarily mean that the success criterion has not been satisfied in some other way, only that this technique has not been successfully implemented and can not be used to claim conformance.