Skip to main content
Raasta
SeriousWCAG 3.1.2 · Level AAvalid-lang

Language code on part of the page is not valid

A lang attribute on part of the page, such as a quote in French or a language switcher, needs a valid language code or screen readers read it with the wrong pronunciation. Change values like lang="french" or lang="Deutsch" to real codes such as fr or de.

Who it hurts

Screen reader users, who hear foreign words read in the wrong accent, often unrecognisably.

Language switchers are the usual case: each language name should be marked up in its own language.

How to fix it

Pick your stack. Review every change before you ship it.

Before

<a href="/fr/" lang="french">Français</a>

After

<a href="/fr/" lang="fr" hreflang="fr">Français</a>

Check it by hand too

Listen to the language switcher and any foreign-language passages with a screen reader. Each should switch to the right voice.

Automated checks find a large share of accessibility problems, but not all of them. Passing this check does not on its own make a page compliant.

WCAG reference