Language of Parts
Passages in another language need their own lang attribute, so a screen reader switches voice for them. Proper names and words that have been absorbed into the surrounding language are exempt.
- Principle
- Understandable
- Guideline
- 3.1
- Level
- AA
- In WCAG since
- 2.0
- Number
- 3.1.2
Broken, then fixed
The same interface twice: first with the mistake, then with the smallest change that fixes it.
A French quotation read with an English voice.
The sign on the door still read Défense d’afficher, which nobody obeyed.
Pronounced with English rules it becomes noise. The reader cannot tell whether they missed a word or the page contains a typo.
The passage declares its own language.
The sign on the door still read Défense d’afficher, which nobody obeyed.
<em lang="fr">. The voice switches for the phrase and switches back. Words like "café" or "rendezvous" need nothing — they are English now.
How to test
Check your own interface against 3.1.2, one step at a time.
- Read the page and list every passage, phrase or single word in a language other than the one the html element declares.
- Cross off proper names, technical terms, words of no clear language, and words that have become part of the surrounding language, such as café in English.
- Open your browser’s DevTools, inspect each passage left on the list, and check that it, or an element around it, has a lang attribute.
- Check that each lang value is the code for the language the passage is in, such as de for German or es for Spanish.
- Turn on a screen reader (NVDA on Windows, VoiceOver on a Mac) and read each passage. Listen for the voice switching to the other language and back again after it.
Common questions
Do proper names in another language need a lang attribute?
No. 3.1.2 leaves out proper names, so a French town or a German surname in English text needs no lang attribute of its own.
Does a single word in another language need lang?
Only when it has not become part of the surrounding language. One word can need its own lang, but a word such as rendezvous in English text is English now and needs nothing.
Can an automated checker test 3.1.2?
No, not on its own. A checker can find a lang value that is not a valid code, but it cannot tell that a passage is in another language. You have to read the page.
Try it yourself
A lab is a small working piece of interface that you change yourself. Read its steps, use the controls under it, and watch the verdict line at the bottom: it says whether the criterion passes or fails as you go. Reset puts it back.
Try it: mark the French phrase
How to use this lab
- Goal. Make a screen reader switch to French for the French phrase in an English sentence.
- The controls. The Mark the phrase lang="fr" tick box adds or takes away lang="fr" on the phrase “Défense d’afficher”. The markup shows the tag, and the log names the voice each line is read in.
- Try this. Tick Mark the phrase lang="fr", then untick it, and compare the voices in the log.
- What it means. With the phrase marked, 3.1.2 passes: the screen reader reads it in a French voice, then goes back to English. Unmarked, 3.1.2 fails, because the phrase is read with English sounds and listeners may not recognise it. The verdict line under the lab says which.
The markup
<em>Défense d’afficher</em>Screen reader says
3.1.2 fails
Also in guideline 3.1
Criteria in the same guideline often fail together.