Free scan

Fix "Invalid language code on a passage" in HTML

Why it's a problem

A passage in another language (a quote, a product name, a link to the French version) is flagged with a lang attribute on its element. If that code is invalid, the screen reader ignores it and reads the passage with the page's pronunciation.

How to fix it — HTML

Give each language change a valid code: lang="fr", lang="de", lang="es"… The site's language switcher is a common case: each language name is written in its own language, with its own lang.

Avoid
<a href="/en" lang="english">English</a>
<a href="/de" lang="ger">Deutsch</a>
Correct
<a href="/en" lang="en">English</a>
<a href="/de" lang="de">Deutsch</a>

Check your site in 30 seconds

Conformly detects this kind of issue across all your pages, continuously, and alerts you on every regression.

Free scan

Other fixes