An English voice can make a German booking confirmation difficult to understand. Screen readers and other reading tools use the page’s language declaration to choose pronunciation rules. A correct declaration helps users hear the words as the author intended.
What does WCAG require?
Language of Page (3.1.1) is a Level A requirement in WCAG 2.0, 2.1, and 2.2. Software must be able to determine the default human language of each web page from information the author provides. On a multilingual page, use the language that appears most. W3C recommends using the first language that appears if several are used equally. WCAG sets no minimum word count or required regional variant.
Common page language issues
- The main
<html>element has nolangattribute, or its value is empty. - The template contains an invalid language tag such as
Englishoren_US. - A French page has
lang="en"because the template was copied from the English site. The tag is valid, but it describes the wrong language. - A language selector changes the whole page in place and leaves the original document language in use.
How to set and maintain the page language
Use a valid language tag on the opening <html> element. Tags follow a standard called BCP 47. Short tags such as es for Spanish usually suffice. Add a region where it helps describe the content, as in pt-BR for Brazilian Portuguese.
<!doctype html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>Confirmación de reserva</title>
</head>
<body>
<h1>Tu reserva está confirmada</h1>
</body>
</html>
Set the value from the language of the content rendered by the template. If your app swaps the entire page to another language without reloading, update the attribute at the same time. For ordinary HTML, use lang. If you maintain an XHTML template that emits both lang and xml:lang, keep their values identical.
How to test the page language
Automated tools can flag missing, empty, or invalid declarations. Use the SimplifyAccess Accessibility Scanner to review how the page language is declared. Then inspect the rendered <html> element in the browser and compare its tag with the main content. Test each language version, including direct visits, language switches, and fallback pages that appear when a translation is missing.
With a screen reader that has the relevant voice installed, listen to the main heading and a short paragraph. If pronunciation is unexpected, check the rendered language tag and the screen reader’s language settings.
Related accessibility requirements
Language of Parts (3.1.2) covers passages and phrases on the page that use a different language. The page language supplies the default for content that inherits it.
