Skip to main content
Perceivly: Perceivly home

3.1.2 Language of Parts

Level AA · added in WCAG 2.0

When a passage or phrase is in a different language from the rest of the page, mark it with a lang attribute. Screen readers and browsers then know how to pronounce and display it.

Who it helps

Screen readers switch voices and pronunciation rules based on lang, so unmarked foreign text gets read with the wrong accent and can become unintelligible. Braille displays, translation tools and hyphenation also rely on it.

How to meet it

Examples

Fails:A German quote on an English page with no lang attribute
<html lang="en">
  <body>
    <p>Goethe wrote:</p>
    <blockquote>Wer nicht vorwärts geht, der geht zurück.</blockquote>
  </body>
</html>
Fails:An invalid language code in a language switcher
<a href="/es/" lang="spanish">Español</a>
Passes:The quote marked as German
<html lang="en">
  <body>
    <p>Goethe wrote:</p>
    <blockquote lang="de">Wer nicht vorwärts geht, der geht zurück.</blockquote>
  </body>
</html>
Passes:A language switcher link with a valid code
<a href="/es/" lang="es" hreflang="es">Español</a>

Can a scanner detect this?

Partly

axe-core's valid-lang rule flags lang attributes with invalid codes. It cannot tell when a passage in another language has no lang attribute at all, or when the code names the wrong language. A person who knows the content needs to check those.

axe-core rules that test it

Common mistakes

Official W3C explanation of 3.1.2

Check your own page

See which automated WCAG checks your page fails, with the failing elements and how to fix them.

Enter a page address, for example example.com/shop.

Reviewed November 2, 2026