Go to the front page
Testing for accessibilityA little testing workshop

Where to define the language of parts of the page?

The page language is English, but sometimes a small part of the content is in another language. When that happens, add the lang attribute to the element that contains the language change.

Descendant elements inherit the language, so you do not usually need to repeat the same lang attribute on every nested element.

Note that the screen reader behaviour can vary between different screen readers and the browser that is used. Another thing that effects this are the language settings in the screen reader.

Language on the paragraph

This example has the lang attribute on the paragraph. The link inside the paragraph inherits the same language.

Voici un exemple en français avec un lien vers une ressource utile.

Language repeated on nested elements

This example repeats lang="fr" on the paragraph and the link. It still works, but the language on the link is redundant because it already inherits French from the paragraph.

Voici un autre exemple en français avec un lien vers une ressource utile.