Rampsight

All rules

Page language

The language code must be valid

Why it matters

An invalid code ("german", "en_GB" with an underscore) is ignored, which leaves the page with no declared language at all.

How to fix it

  1. Use a valid BCP 47 tag: two-letter language, optional region after a hyphen ("en", "pt-BR").
  2. Do not put the language name, a locale with an underscore, or a country code alone.

In markup

Fails
<html lang="german">
Passes
<html lang="de">

The requirement behind it

This rule is one way of failing the following WCAG 2.2 success criteria. The W3C, which writes the standard, explains each of them:

Further reading

Deque University on html-lang-valid (opens in new tab)

Deque maintains axe-core, the open-source engine our scanner runs. Their page documents the rule as the engine implements it.

Automated checks find failures a browser can prove. They cannot judge whether a caption is accurate, whether an alt text is useful, or whether a page can be operated end to end with a keyboard — those need a person.