Skip to content

UX guides / Accessibility / Every page declares its main language, and the declaration matches the text

Every page declares its main language, and the declaration matches the text

Usually mediumHow serious this usually is when it goes wrong. Not a score.

The guideline

Put a lang attribute on the html element of every page, holding a well-formed BCP 47 language tag for the language the page mainly uses (for example en, fr or pt-BR). Make it match the text: a translated page needs its own value, so a template must not leave lang="en" on a German page. On a site in several languages, each language version declares its own. Where a page mixes languages, declare the one used most.

Common failures

  • The page does not declare its language correctly: the lang attribute is missing, empty, malformed, or names a different language from the text.

Where it applies

Where

  • Applies to any site

Disciplines

  • Accessibility

Devices

  • Desktop web
  • Mobile web

Why it matters, how to fix it, and the research behind it

Rubric's full guide adds the reasoning, the fix and the sources for this check, and checks your client's pages against it and hundreds of others. Findings come back worst first.