For each web page that has a default language, is the language code relevant?

A speech synthesizer adapts its pronunciation to the language declared in the source code. If your page is in French but carries lang="en", the screen reader reads the French text with English phonology: « Bienvenue » becomes unrecognizable, prosody collapses, and the blind user loses track of the content.

Criterion 8.4 does not merely require that a language code exists — that is the job of criterion 8.3. It requires that this code be correct. Two cumulative conditions: the code must be valid according to ISO 639-1 or ISO 639-2 standard, and it must match the main language in which the page is written.

In practice, inspect the <html> tag and note the value of the lang attribute. Page in French: lang="fr". Page in Spanish: lang="es". The code must reflect the reality of the visible content, not the theme language, not the CMS default configuration.

Correct code, correct reading.

Un test to assess the correspondence between language code and content

Validity and relevance of language code on <html>

  1. Open the developer tools and inspect the <html> tag.
  2. Note the value of the lang attribute.
  3. Verify that this code is valid: it must exist in ISO 639-1 standard (2-letter codes, e.g.: fr, en, es) or ISO 639-2 (3-letter codes, e.g.: fra, eng).
  4. Verify that this code is relevant: it must match the main language in which the page content is written.
  5. Both conditions must be met to pass the test. A missing, invalid, or mismatched code fails the test.

Examples

❌ Non-compliant : Incorrect language code on a French page

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Welcome to our website</title>
</head>
<body>
  <h1>Welcome</h1>
  <p>Discover our services in France.</p>
</body>
</html>

The page is written in French, but lang="en" declares English. A screen reader like NVDA or JAWS selects an English voice and reads the French text with its phonology: « Bienvenue » is pronounced in English, « Découvrez » becomes incomprehensible. This is the classic error of a template or CMS shipped with an unconfigured default language.

✅ Compliant : Correct language code on a French page

<!DOCTYPE html>
<html lang="fr">
<head>
  <meta charset="UTF-8">
  <title>Welcome to our website</title>
</head>
<body>
  <h1>Welcome</h1>
  <p>Discover our services in France.</p>
</body>
</html>

lang="fr" matches the actual language of the content. The screen reader automatically selects the French voice, with proper pronunciation and prosody. The user receives a sound experience consistent with what they read or have read aloud.

Tips and pitfalls

⚠️ The CMS ships with lang="en" by default

WordPress, Drupal, Shopify: many themes are distributed with lang="en" hardcoded in the HTML template. If no one explicitly configures the language in the CMS settings, all pages on the site are in violation, even if the content is entirely in French. Check this systematically during an audit — it is one of the most frequent errors in production.

💡 8.3 checks presence, 8.4 checks relevance

These two criteria are distinct. Criterion 8.3 tests the existence of the lang attribute on <html>. Criterion 8.4 tests the correctness of its value. A page with lang="zz" (invented code) may pass 8.3 but will fail 8.4. In an audit, evaluate them separately to produce accurate reports.

⚠️ lang="french" or lang="FR" alone are invalid

The full name of the language spelled out (french, francais) is not a valid ISO code. Similarly, lang="FR" in uppercase alone does not follow the BCP 47 convention. Correct codes for French: fr (ISO 639-1), fra (ISO 639-2), or fr-FR (with regional subtag). When in doubt, lang="fr" is the simplest and most robust form.

⚠️ Bilingual page: which language to declare on <html>?

Declare the main language, the one in which the navigation structure, headings, and majority of content are written. For passages in the other language, add local lang attributes on the relevant elements. This local markup is the subject of criterion 8.7, distinct from criterion 8.4.

💡 The W3C validator confirms the validity of the ISO code

The W3C HTML validator (validator.w3.org) flags unrecognized language codes. This is the quickest way to confirm that a lang value complies with standards without manually consulting ISO 639 lists. Relevance, on the other hand, remains a human check: only the auditor can compare the declared code to the actual language of the content.

Frequently asked questions

How do I practically audit RGAA criterion 8.4 on the relevance of the language code?

Open the page source (Ctrl+U or Cmd+U) and find the <html> tag. Note the value of the lang attribute. Compare it to the language of the visible content. Tools like Includdy flag missing languages, but not always incorrect or irrelevant codes. Checking relevance remains an essential manual step.

What is the difference between lang="fr" and lang="fr-FR" to satisfy RGAA criterion 8.4?

Yes, lang="fr-FR" is valid and relevant for a French page. The main code fr complies with ISO 639-1, and the regional subtag FR is recognized by BCP 47. The RGAA accepts these extended forms. The essential is that the main code matches the actual language of the document.

How do I choose lang on <html> for a bilingual page according to RGAA 8.4?

Declare the main language of the page on <html>. If the navigation, headings, and majority of content are in French, keep lang="fr". Then mark the English form with lang="en" on its container element. The lang on <html> reflects the dominant language, criterion 8.7 handles local exceptions.

How does RGAA criterion 8.4 apply to Single Page Applications rendered by JavaScript?

Yes. Whether the page is static, server-generated, or rendered by a JavaScript framework, the lang attribute on <html> must be correct. Verify that the framework does not reset the <html> tag to a default value (en) during route transitions: this is a frequent point of attention when auditing React or Vue.

References