# Language of Parts: Mark Foreign-Language Text

Source: https://allyway.ai/glossary/language-of-parts

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](https://www.w3.org/WAI/WCAG22/Understanding/language-of-parts.html) is a Level AA criterion of [WCAG 2.2](https://allyway.ai/regulations/wcag-2-2). It builds on [Language of Page](https://allyway.ai/glossary/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](https://allyway.ai/glossary/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.

> **Tip:** > **One attribute on the nearest element**
> Use the HTML `lang` attribute (W3C technique H58) on the element that wraps the foreign text – a `span`, `blockquote`, `p` or `a`. MDN explains the [lang attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang) and its language codes.

## Examples

```html title="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:** 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:** 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

Q: Do I have to mark every foreign word with lang?
A: 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.

Q: What is the difference between Language of Page and Language of Parts?
A: 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.

Q: Is lang the same as hreflang?
A: 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.

Q: Do language names in a language switcher need lang?
A: 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.
