Specify the primary language of the page
Content available in English only.
Accessibility isn’t just about avoiding violations — it’s about ensuring that everyone can use your product with confidence. This guide explains each rule’s intent, highlights common issues, and shows how to fix them according to WCAG and the European Accessibility Act (EAA).
These guidelines do not replace the official WCAG standards. They’re concise, developer-focused notes to help you identify and fix issues effectively.
Screen readers speak the language you declare — so declare the correct one.
Why this matters and how to fix it
Why this matters
Screen readers and other assistive technologies rely on the page’s declared language to determine pronunciation, grammar rules, and reading patterns. Without a correct `lang` attribute, words may be mispronounced or interpreted incorrectly, reducing comprehension and causing cognitive strain.
How to fix this issue
Add a valid `lang` attribute to the <html> element that matches the primary language of the page. Use a standard ISO language code such as `en`, `sv`, `de`, or `fr`. If regional variants are relevant, include the full locale code (e.g., `pt-BR`, `en-GB`).
Developer guidance
This issue is often missed in template frameworks and multilingual sites. Ensure your layout, document shell, or root component sets the language dynamically based on the current locale. Avoid defaulting to `en` unless the site content is actually English.
Code examples
Incorrect Implementation
<html>Correct Implementation
<html lang="en">Real-World Examples
Before
<html>
<head>
<title>Kontakt</title>
</head>
<body>
<h1>Kontakta oss</h1>
</body>
</html>
<!-- Screen reader pronounces Swedish text using English rules → incorrect and confusing -->After
<html lang="sv">
<head>
<title>Kontakt</title>
</head>
<body>
<h1>Kontakta oss</h1>
</body>
</html>
<!-- Screen reader now announces Swedish correctly -->Manual testing
- 1. Open the page and inspect the <html> element.
- • Confirm a `lang` attribute is present and matches the page’s primary language.
- 2. Turn on a screen reader.
- 3. Listen to the first heading and first paragraph read aloud.
- • Expected: Pronunciation matches the language of the page.
- • Failure: Words sound incorrect, overly literal, or phonetically distorted.
- 4. If the page content changes languages mid-page, confirm those sections use `lang="xx"` on the specific element.
- 5. For multilingual sites, switch language and repeat — ensure the <html> `lang` value updates dynamically.
Trusted by organizations across Europe working toward WCAG and EAA conformance