Warninga11y.lang

Screen readers can't tell what language the page is in

Why it matters

A screen reader picks its voice from the lang attribute on <html>. When it is missing, the page is read in whatever voice the visitor has set as their default, and English read by a French voice, with French rules for every vowel, is not something anyone can follow. Braille displays and browser translation rely on the same attribute.

A value that isn't a real language tag (en_GB with an underscore, english) is ignored, which comes to the same thing.

Source: WCAG 2.2, 3.1.1 Language of Page (Level A); the value must be a valid BCP 47 tag.

How to fix it

Put the language on the opening <html> tag, with a hyphen rather than an underscore:

<html lang="en-GB">

If part of the page is in another language, mark that part too: <blockquote lang="cy">.

Examples

These are the rule's own test pages, and what it says about each. They are run on every change to the rule book.

<html lang="english">
<title>T</title>

Warninglang="english" isn't a valid language tag, so screen readers ignore it and guess.

fail-english
<title>T</title>

WarningThe <html> tag has no lang attribute, so a screen reader reads the page in the visitor's default voice, whatever language that is.

fail-none
<html lang="en_GB">
<title>T</title>

Warninglang="en_GB" isn't a valid language tag, so screen readers ignore it and guess.

fail-underscore
<html lang="en-GB">
<title>T</title>

PassedScreen readers are told the page is in en-GB.

pass-en-gb