This technique relates to the following sections of the guidelines:
Use the lang
attribute of the html
element to define the document's language.
It
is important to identify the primary language of a document using
markup (as shown in the examples). The lang
attribute allows assistive technology to orient and adapt to the
pronunciation and syntax that are specific to the language of the page.
This attribute may also play a major role in the emerging global,
multi-lingual, simultaneous translation web environment.
There are other methods of specifying the primary language.
information on the use and support of HTTP headers and the meta element
are provided by the W3C
Internationalization Group. The lang attribute of the html
element is the preferred technique since it takes precedence over these
other methods.
The use of the lang attribute varies with the document and content type.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML lang="fr">
<BODY>
...document écrit en français...
</BODY>
</HTML>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr" >
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
...document écrit en français...
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
</head>
<body>
...document écrit en français...
</body>
</html>