Barrierepruefung.de Web Accessibility Checker

WCAG 3.1.1 Language of Page: explained simply

The default language of every web page must be determinable from its code, in HTML usually through the lang attribute on the html element. This lets screen readers load the correct pronunciation rules. If a page uses several languages, the one used most counts.

Last reviewed: Sources

What does the criterion require?

A screen reader reads text aloud using the pronunciation rules of a language. If it applies the English rules to a German text, the result is hard to understand. The criterion therefore requires that the default human language of each web page can be programmatically determined. That means the information is in the code in such a way that different programs, including assistive technologies, can extract it and present it to users in different forms.

In HTML this is done with the lang attribute on the html element, so <html lang="en"> for an English page. The W3C lists this as a sufficient technique (H57). The value is a standard language tag conforming to BCP 47, such as en, de or fr, and reflects the primary language of the page.

According to the W3C's Understanding document, this helps:

  • people who use screen readers or other technologies that turn text into speech
  • people who find it difficult to read written material fluently and accurately
  • people with certain cognitive, language and learning disabilities who use text-to-speech software
  • people who rely on captions, because media players can then show them correctly

Ordinary browsers too can display characters and scripts correctly when they know the language. Technique H57 also mentions braille translation software, which can then handle accented characters properly, for example.

Which language counts if there are several?

Many pages contain more than one language. The language of the page is then the one used most. If several are used equally, the first one used should be chosen. The W3C's example is a page produced in Germany with German and English content, most of it German: it is marked de.

If each language version has its own page, each page is marked with its own language. That includes pages that are easily forgotten, such as an English order confirmation in a shop that is otherwise German.

Individual passages or words in another language are the subject of 3.1.2 Language of Parts. The two are connected: where nothing else is specified for a piece of text, the language of the page applies to it.

Common failures

The W3C has no failure technique for this criterion. The following cases result from the requirement and from the test procedure of technique H57:

  • No information at all. The html element has no lang attribute, and the language of the page cannot be determined from the code in any other way.
  • The wrong language from the template. The theme was built for another market and carries lang="de" while the text is English. A screen reader that goes by it reads the text with German rules.
  • Forgotten in translation. A page is copied and translated for the French version, but the attribute still says en.
  • An invalid value. The attribute holds something that is not a BCP 47 tag, such as english. H57 asks to check that the value conforms to that standard and reflects the primary language.

Checked automatically and checked by you

What the automated check detects

Coverage: complete

The automated check covers this criterion completely on the pages it checks.

Rules

What you check yourself

The checklist has no question of its own for it.

Classification

Level
A
Introduced in
WCAG 2.0
W3C explanation
Understanding 3.1.1