The value of the lang attribute used to indicate the primary language of the page is for the wrong language.

Link to The value of the lang attribute used to indicate the primary language of the page is for the wrong language. copied to clipboard
Rule ID:
lang-not-accurate
User Impact:
Serious
WCAG :
3.1.1.a

Rule

The primary language of the page MUST be identified accurately on the <html> element.

Background

Most screen readers can read several different languages. Screen reader users select a default language when installing and configuring their screen reader. If no language is specified in the HTML document, the screen reader will read the document in the user's default language. If the screen reader's default language does not match the page language, the page will be read with a pronunciation that does not match the language, often making it impossible to understand.

People that speak more than one language though will likely access websites in more than one language, so specifying the page language correctly becomes important. To fix this issue, correctly identify the primary language for the page in the <html> element.

Code Examples

Good Example:

Specifying English as the primary language of the document.

<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>I Have a Dream, Excerpt</title>
  </head>
  <body>
  </body>
</html>

Failure Example:

Empty lang attribute

<!doctype html>
<html lang="">
  <head>
    <meta charset="UTF-8">
    <title>I Have a Dream, Excerpt</title>
  </head>
  <body>
  </body>
</html>

How To Fix

Fix this issue by:

  • Provide the correct lang attribute value.

Don't do this:

  • Provide an incorrect lang attribute value.
  • Fail to provide a lang attribute value.

References