How accessible is your website?Start free check
WCAG 3.1.2Level AAUnderstandable

Language of Parts: Mark Foreign-Language Text

Also called: Language change, lang attribute on elements, Foreign-language passages

Definition

Language of Parts is WCAG success criterion 3.1.2. The human language of each passage or phrase in the content must be programmatically determinable – except for proper names, technical terms, words of indeterminate language and words that have become part of the surrounding language.

Language of Parts is the WCAG rule that text in another language than the rest of the page is marked in code. A German quote on an English page, a French product name with a description or the "Deutsch" entry in a language switcher get their own lang attribute. Screen readers then switch to the right pronunciation instead of reading foreign words with English rules.

What it means

WCAG 3.1.2 Language of Parts is a Level AA criterion of WCAG 2.2. It builds on Language of Page (3.1.1): the page declares its default language, and every passage or phrase in another language declares its own. Text without a marked language inherits the page language, so a page in one language passes automatically.

The criterion applies to longer passages and to single words. W3C names four exceptions:

Exception Example Needs lang?
Proper names A philosopher's name in an English text No
Technical terms Homo sapiens, hertz, habeas corpus No
Words of indeterminate language Words that belong to no single language No
Words that became part of the surrounding language "rendezvous" in English, "podcast" in French No
A full sentence or quote in another language A German phrase in an English article Yes
Language names in a language switcher "Deutsch", "Français", "Español" Yes

Marking the exceptions is not required, but W3C calls it good practice. When in doubt whether a borrowed word counts as part of the vernacular, check whether it is pronounced the same way in the surrounding language.

Who benefits? Screen reader users hear the right pronunciation, braille displays and voice browsers can apply the rules of that language, and browsers and translation tools treat the passage correctly. People with reading difficulties who use text-to-speech also rely on it.

Examples

Example
<html lang="en">
…
<p>As the Austrians say, <span lang="de">"Schau ma mal"</span> – let's wait and see.</p>

<!-- Language switcher: each name in its own language -->
<ul>
  <li><a href="/de" lang="de" hreflang="de">Deutsch</a></li>
  <li><a href="/fr" lang="fr" hreflang="fr">Français</a></li>
</ul>

<!-- Not needed: proper name and vernacular word -->
<p>Our café near Mozartplatz offers a croissant breakfast.</p>

W3C also shows a case of mixed languages: a link with an English title attribute contains the word "Español" in a span with lang="es". Only the Spanish text is marked, so the attribute stays English.

Do

Mark quotes, slogans, song titles and whole sentences in another language with lang. Give every entry of a language switcher the language it is written in. Use valid language codes such as de, fr or es-MX.

Don't

Mark every borrowed word such as "kindergarten" or "café" as a foreign word. Don't use invalid codes like lang="german" or en_US – browsers can't read them. Don't rely on a flag icon alone to show the language of a link.

How to check Language of Parts

    Questions

    Do I have to mark every foreign word with lang?

    No. Proper names, technical terms, words of indeterminate language and words that are part of the surrounding language are exceptions. Mark whole phrases and passages in another language; marking the exceptions too is optional good practice.

    What is the difference between Language of Page and Language of Parts?

    Language of Page (3.1.1, Level A) requires the default language on the html element. Language of Parts (3.1.2, Level AA) requires a lang attribute on passages that differ from that default.

    Is lang the same as hreflang?

    No. lang says which language the content of an element is in. hreflang on a link says which language the target page is in. A language switcher link can use both.

    Do language names in a language switcher need lang?

    Yes. W3C gives this exact example: "Deutsch" should be marked as German, "Français" as French. Otherwise an English screen reader reads them with English pronunciation.

    Let AI Handle Website Accessibility

    Built in Europe. Set up in 2 minutes, no developer needed. Put website accessibility on autopilot with AI-powered fixes and automated monitoring.

    1. 1Choose your plan
    2. 2Install in 2 min
    3. 3AI fixes your website
    4. Done