Hreflang and international · Language

Invalid lang attribute on an element

A French quotation on this page has lang="french", which is not a valid language code, so screen readers read it with English sounds.

How this page is built

The page's html element has a valid lang of en-GB. The French quotation below has lang="french", where it should have lang="fr":

Bonjour tout le monde, et bienvenue sur ce site de test.

This page has no hreflang annotations, so the only fault is the value on the quotation.

Why it matters

A lang attribute on an element tells screen readers and browsers that its text is in a different language from the rest of the page. With a valid value, a screen reader switches voice and reads the words correctly. With an invalid one, it keeps the page’s language, so the French is read with English sounds.

Search engines also use these values when they work out which languages a page contains.

How to check it

Search the source for lang attributes inside the body and check each value against the BCP 47 rules. Accessibility checkers report invalid values.

How to fix it

Use a valid code, here fr. Add a region only when it matters, as in fr-CA.

Back to all tests