On each web page, is each change of language indicated in the source code (except in special cases)?

A screen reader reads text using the voice configured for the page's language. If your page is in French and contains an English quotation without a language indication, the speech synthesis attempts to pronounce it with French phonology. The result: incomprehensible. This is exactly what criterion 8.7 seeks to prevent.

The fix comes down to one attribute: lang. Placed on the element containing the foreign-language text, or on one of its ancestors in the DOM, it tells assistive technologies in which language this content should be interpreted. It can be placed on any HTML element: <span>, <blockquote>, <p>, <q>, or any relevant container.

The scope is targeted. You don't mark proper nouns, nor foreign words present in the official dictionary of the page's language, nor terms whose approximate pronunciation does not create confusion. In contrast, a literary quotation, a commercial slogan, or an entire passage written in another language: the lang attribute is mandatory.

Un test to ensure that language changes are marked in the code

lang attribute on passages in foreign language

  1. Identify all passages of text written in a language different from the page's default language.
  2. Remove from your list:
    • Proper nouns (names of people, brands, city names).
    • Foreign-origin words present in the official dictionary of the page's language (for French, the dictionary of the Académie française).
    • Foreign words in common use whose approximate pronunciation does not cause confusion in context.
  3. For each remaining passage, inspect the DOM: verify that the element containing the text, or one of its parents, carries a lang and/or xml:lang attribute with a valid language code.
  4. All retained passages have a valid lang: test validated. A single passage lacks one: test failed.

Examples

❌ Non-compliant : English quotation without language indication

<p>Our philosophy revolves around a conviction:
  <span>To be or not to be, that is the question.</span>
</p>

The <span> does not carry a lang attribute. A screen reader configured in French pronounces this Shakespearean quotation with French phonology. The rendering is incomprehensible to the user.

✅ Compliant : English quotation with correct lang

<p>Our philosophy revolves around a conviction:
  <span lang="en">To be or not to be, that is the question.</span>
</p>

The lang="en" attribute on the <span> commands the screen reader to switch to an English voice for this passage. The quotation is rendered correctly, regardless of the page's default language.

❌ Non-compliant : Entire German block without language indication

<blockquote>
  <p>Da dachte der Herr daran, ihn aus dem Futter zu schaffen,
  aber der Esel merkte, daß kein guter Wind wehte.</p>
  <footer>Tales from the Brothers Grimm</footer>
</blockquote>

The entire block is in German, but no lang is specified. French speech synthesis distorts every word. The user perceives noise, not text.

✅ Compliant : Entire German block with inherited lang

<blockquote lang="de">
  <p>Da dachte der Herr daran, ihn aus dem Futter zu schaffen,
  aber der Esel merkte, daß kein guter Wind wehte.</p>
  <footer>Tales from the Brothers Grimm</footer>
</blockquote>

A single lang="de" on the <blockquote> covers the entire block: the <p> and <footer> inherit the attribute. No need to repeat lang on each child.

Tips and pitfalls

⚠️ Marking proper nouns is an over-marking error

Placing lang="en" on "Shakespeare," "MacBook," or "New York" is incorrect. Criterion 8.7 explicitly excludes proper nouns. A French screen reader is not supposed to pronounce these names with an English voice; the usual French pronunciation is perfectly understood. Over-marking can even degrade the experience by forcing an unexpected voice change in the middle of a sentence.

⚠️ Foreign words in the official dictionary are exempt, but not all

"Parking," "football," and "week-end" appear in the Académie française dictionary: no lang required. "Newsletter" does not. The criterion then applies, only if the absence of a language indication could cause misunderstanding in rendering. Since the French pronunciation of "newsletter" generally remains intelligible, the lang is not necessary in most contexts.

💡 NVDA does not automatically switch with the default voice

Even with correct lang in the HTML, NVDA will not change voice with the default synthesizer (OneCore, Hortense voice). For the language change to take effect, NVDA must be configured with a multi-accent synthesizer like eSpeak NG, then enable the "Automatic language switching" option in voice settings. This is the classic audit pitfall: one concludes that lang doesn't work, when in fact it's the screen reader configuration that is at fault.

⚠️ Dead and imaginary languages: the criterion does not apply

Latin, Ancient Greek, Tolkien's Elvish, Klingon: no speech synthesis can render them correctly. Criterion 8.7 is non-applicable for these languages. No need to search for a BCP 47 code for Old Norse or Medieval Latin. They are out of scope.

⚠️ Terms submitted via form and recalled in the page

An internal search engine displays "Results for: 'the best coffee'." This English term comes from an input field and is rendered as-is in the page. Criterion 8.7 does not apply: these passages are explicitly excluded from the RGAA scope. The same logic applies to an autocomplete field that repeats the entered value.

Frequently asked questions

How do you know if a foreign word should carry the lang attribute in RGAA?

Two questions suffice. Is this word in the official dictionary of the page's language (for French, that of the Académie française)? If yes, no lang. If no, would mechanical pronunciation in the language of origin cause confusion? If yes, lang is required. The criterion aims to improve comprehension, not to respect the strict etymology of words.

How do you apply the lang attribute to a parent element for foreign passages in RGAA?

Yes. The lang attribute is inherited in the DOM. If an entire <section> or <article> is written in English, a lang="en" on that element covers all of its descendants. You don't need to repeat the attribute on every <p>. A single lang on the common ancestor is sufficient.

What lang attribute value meets RGAA requirements for identifying a language?

BCP 47 language codes. The primary code is sufficient in almost all cases: lang="en" for English, lang="de" for German, lang="es" for Spanish. Regional subcodes (lang="en-GB", lang="pt-BR") are optional and useful only if the regional distinction impacts pronunciation or comprehension.

How do you audit RGAA criterion 8.7 on language changes effectively?

Scan the page visually and identify foreign-language passages. Then inspect the DOM with DevTools: select the element and check for the presence of lang on it or its ancestors in the "Elements" panel. Also verify that the value is a valid language code (two lowercase letters for the primary code). Tools like Includdy facilitate this verification on dense pages.

What is the difference between xml:lang and lang for RGAA compliance?

In HTML5, lang alone is sufficient. The xml:lang attribute is useful only for documents served as strict XHTML (MIME type application/xhtml+xml). For a standard HTML document, lang is sufficient. If you maintain a legacy XHTML site, specify both attributes with the same value to maximize compatibility.

References