Skip to content
3.1.2 · Level AA · WCAG 2.0 · Understandable → Readable

Language of Parts

A passage or phrase in a different language from the page is marked with its own lang attribute, so it is pronounced correctly rather than mangled with the page's default accent.

Why it matters

A screen reader switches its voice to match the lang attribute. A French quotation on an English page read with English pronunciation is unintelligible to a French speaker and baffling to everyone else.

Automatically detected

axe-core checks that any lang attribute present holds a valid language code. It cannot detect foreign-language text that has no lang attribute at all — recognising that a phrase is in another language is a judgement.

Related axe-core rules: valid-lang

Fails

<p>Their motto is <span lang="french">Liberté, égalité, fraternité</span>.</p>

"french" is not a language code, so the attribute is ignored and the phrase is read with the page's accent.

Passes

<p>Their motto is <span lang="fr">Liberté, égalité, fraternité</span>.</p>

A valid BCP 47 code. The screen reader switches voice for the span and back again afterwards.

Openwell finds violations like this one across your whole site, clusters them by the component that caused them, and generates a fix that's re-validated before you see it.

Scan your site free
WCAG 3.1.2 Language of Parts — what it requires and how to fix it — Openwell