Access 4.3.1.1

From Htmlpedia
Jump to: navigation, search

Access: [4.3.1.1]: language not identified (Priority 3)

Cause:

Identify the primary language of each document to ensure that clients automatically retrieve web pages in their preferred language. Language can be specified either through HTTP headers or html markup (i.e. '<html lang="en">'). In XHTML, you should specify the language using the XML namespace (in XHTML 1.0 you can optionally keep using the plain (HTML namespaced) "lang" attribute, but it is disallowed in versions 1.1+). As a last resort, it is possible to specify the language using a meta tag.

Example:

Bad
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
	<title>aert1.0/4.3.1 - The HTML element does not contain a lang attribute</title>
</head>
<body>
</body>
</html>
Good
<!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="en" xml:lang="en">
<head>
	<title>Language identified.</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="Content-Language" content="EN" />
</head>
<body>
</body>
</html>

Solution:

Specify the language of your document using at least one of the following:

  • The "lang" attribute of the "html" element. (HTML 4 and XHTML 1.0)
  • The "lang" attribute of the "html" element using the XML namespace (i.e., xml:lang). (XHTML 1.0+)
  • The "lang" attribute not supported in XHTML 1.1+
  • A meta tag. (HTML 4 and XHTML)

References: