Skip to content
easeweb
Search topics

Page language set wrong, so screen readers mispronounce it

A shared layout hardcodes lang="en", so a Spanish page is read aloud with English pronunciation rules, and a quote in another language is read in the page's voice.

WCAG 2.2
SC 3.1.1ASC 3.1.2AA
Required by
Section 508 · EN 301 549 (EU)
Broken lang="en"
The accessibility problem illustrated: Read with English sounds.
01

The problem

Screen reader and braille users hear a page read with the wrong language's pronunciation, which can make it hard or impossible to understand.

02

Try it

Listen to the Spanish product page.

Press Listen on each part to hear it with the voice its lang picks, if your device has one; the panel shows the voice and how it sounds. Switch language and listen again.

Broken Can you fix this?

<html lang="en">

Botas de montaña

Impermeables y ligeras, para todo el año.

Kept me dry for three days of rain.

Press Listen on a part of the page.

Set by: <html lang="en">

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Set the html lang from the page's actual language, and mark each passage in another language with its own lang.

  1. 1Every page's html element has a valid lang that matches its main content.
  2. 2When the language changes without a page load, the html lang changes with it.
  3. 3A passage in another language carries its own lang.
Before One lang for every language

html

<!-- app.html, the shared layout --><html lang="en">

html

<!-- the Spanish product page, words from the translation file --><h1>Botas de montaña</h1><p>Impermeables y ligeras, para todo el año.</p><blockquote>Kept me dry for three days of rain.</blockquote>
After

The template sets lang from the page's locale

html

<!-- app.html, rendered on the server for each request --><html lang="{locale}">  <!-- "es" on /es/ pages, "en" on /en/ -->

html

<h1>Botas de montaña</h1><p>Impermeables y ligeras, para todo el año.</p><blockquote lang="en">Kept me dry for three days of rain.</blockquote>

Fixing this with an AI coding assistant? Get this guide as Markdown

04

Verify the fix

5 checks, no mouse.

Test with: Screen reader

0 of 5 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat when a language is added.

Limits

This is a starting pattern, not a guarantee for every application. Screen readers switch voices only when a voice for that language is installed, and some ignore lang on short passages; that is outside your control, but the markup must still be right. Whether a passage is a name or a phrase in another language is a judgement no tool makes. Test each language version of your real pages, with someone who reads that language if you can.

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

Keep this fixed as your code changes.

Turn guides like this into rules your coding agents and CI follow, then have the result retested with a keyboard and screen readers.

How retests work