Skip to content
easeweb
Search topics

Pages read aloud in the wrong language

A shared layout hardcodes lang="en", so a Spanish page is read aloud with English pronunciation rules.

WCAG 2.2
SC 3.1.1A
Required by
Section 508 · EN 301 549 (EU)
Broken lang="en"
The accessibility problem illustrated: No vision:What did it say?
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?

BrokenOne lang for every language
<html lang="en">

Botas de montaña

Impermeables y ligeras, para todo el año.

Kept me dry for three days of rain.

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Keep the html lang set to the language the page is in

Before
BrokenOne lang for every language
<!-- app.html, the shared layout --><html lang="en">
What is wrong2 points
  • The Spanish page is read with English pronunciation, because the page says it is English.
  • That claim comes from the shared layout, which writes lang="en" on every page, the Spanish ones too.
After

The template sets lang from the page's locale

<!-- app.html, rendered on the server for each request --><html lang="{locale}">  <!-- "es" on /es/ pages, "en" on /en/ -->
How it is fixed2 steps
  1. Render lang in the shared layout from the page's locale: "es" on /es/ pages, "en" on /en/. Each page arrives with the language it is written in, before any script runs.
  2. Give the English review its own lang, so it keeps English pronunciation on the Spanish page (see Implementation decisions).

This fixes the Before and passes 3.1.1.

HTML and ARIA
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.

How screen readers handle lang

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; that is outside your control, but the markup must still be right. 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.

EaseWeb service

Fixed it? Keep it from coming back.

I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.

See the service