WCAG fix guide
How to Fix a Missing or Wrong Page Language (WCAG 2.2)
Applies to: SC 3.1.1 Language of Page, Level A · SC 3.1.2 Language of Parts, Level AA
A missing document language was found on 13.5% of home pages in the WebAIM Million 2026 (detected with WebAIM's WAVE tool), down from 33.1% in 2019. WebAIM also reports that 87.3% of pages had a document language defined (WebAIM). It is usually a one-line, site-wide fix, but a valid value can still be the wrong one, and automated checks can't tell.
What the lang attribute does
- Screen readers use it to load the right pronunciation rules. Without it, text can be read out with the wrong voice and pronunciation (W3C).
- Braille translation software uses it to handle accented characters and contractions (W3C technique H57).
- Browsers use it for things like automatic hyphenation: CSS
hyphens: autodepends on thelangattribute (MDN). - Not Google's language detection. Google says it uses the visible content and "We don't use any code-level language information such as lang attributes" (Google Search Central).
hreflang(which links language versions) is a separate thing and doesn't replacelang.
How to fix it
Put the language on the opening <html> tag of every page template:
<!doctype html>
<html lang="en-AU">
| Situation | Fix |
|---|---|
No lang, or lang="" | Add the page's main language: lang="en" |
lang="en_US" or lang="english" | Use a language tag with a hyphen: en-US. Underscores and language names are invalid |
lang only on <body>, or only <meta http-equiv="Content-Language"> | Move it to <html>. W3C advises against using the meta tag for this (W3C i18n) |
| English template reused for a German site | Change lang="en" to lang="de" in the template, not just the text |
| Arabic, Hebrew, Persian or Urdu page | Add the direction as well: <html lang="ar" dir="rtl"> |
Which value? W3C's rule is to keep the tag "as short as possible" (W3C i18n). en is enough unless the regional variant matters, as with spelling (en-AU, en-GB) or pt-BR versus pt-PT.
Language of parts (3.1.2): mark passages in another language, such as quotes, testimonials and the names in a language switcher. Proper names, technical terms and words that have become part of the surrounding language don't need it.
<blockquote lang="fr">Le service était impeccable.</blockquote>
<nav aria-label="Language">
<a href="/de/" lang="de" hreflang="de">Deutsch</a>
<a href="/fr/" lang="fr" hreflang="fr">Français</a>
</nav>
What automated checks flag, and what they don't
In our test of 15 language patterns in headless Chrome with axe-core 4.14.0, the open-source engine many scanners use, with the WCAG A/AA and best-practice rules switched on (October 2026), the results were:
| Pattern | Flagged? |
|---|---|
No lang, lang="", lang on <body> only, Content-Language meta only | Yes (html-has-lang) |
en_US, english, or an unknown code like xx | Yes (html-lang-valid) |
lang and xml:lang that disagree | Yes (html-xml-lang-mismatch) |
An invalid lang on a quote or span | Yes (valid-lang) |
lang="en" on a page written in French | No: the value is valid, but wrong for the content |
en-XY (an unknown region) | No: the unknown region isn't flagged |
A French quote with no lang at all | No: the scanner can't tell what language the text is in |
CMS-specific steps
- WordPress: Go to Settings › General › Site Language. Themes output it through
language_attributes(), which turnsen_USintoen-US. Block themes do this automatically. In a classic or custom theme, check thatheader.phphas<html <?php language_attributes(); ?>>and not a hard-coded value. Multilingual plugins set the language per translated page; check one page in each language. - Shopify: The page language comes from your default store language (Dawn uses
lang="{{ request.locale.iso_code }}"). Change it in Settings › Languages. Shopify warns that changing the default language can delete existing translations for that language, so export them first. - Webflow: Set the primary locale's language in the Localize panel's Locales settings. This overrides the older language field in Site settings. For right-to-left languages, Webflow sets the direction automatically.
- Squarespace: Set Site language in the Site Languages panel (version 7.1) or the Language & region panel (7.0), then save. Squarespace says the selected language appears in your site's header code.
- Wix: In your site dashboard, open Language & Region, choose the Site language and save. For multilingual sites, set each language in the Multilingual settings.
Menu names can change between platform versions (steps checked October 2026). If a path doesn't match, check your platform's current help pages.
WordPress, Shopify, Webflow, Squarespace and Wix are trademarks of their respective owners. Glimscope is not affiliated with or endorsed by any of them.
What automated tools can and can't tell you: Automated checkers (including axe-core, which our monitor uses) can flag many instances of this issue, but they cannot judge everything. A human still has to check meaning and context. For scale: Deque reports that in its own sample of first-time audits, its automated tests found 57.38% of issues by volume (Deque report). That is Deque's figure for its sample, not a detection rate for any one tool, and it means a large share of issues still needs manual testing. Scanners catch a missing or invalid language code. They can't tell whether a valid code matches the language the page is written in, or find passages in another language that aren't marked. Automated tests find only some accessibility issues; manual testing is still required. Not legal advice.
Manual checklist
- View source on one page of each template and language version:
<html lang>matches the language of the text - Quotes, testimonials and language-switcher names in another language have their own
lang - Right-to-left pages also have
dir="rtl" - Listen to one page with a screen reader: the voice matches the language
Sources
- www.w3.org/WAI/WCAG22/Understanding/language-of-page.html
- www.w3.org/WAI/WCAG22/Understanding/language-of-parts.html
- webaim.org/projects/million/
- www.w3.org/WAI/WCAG22/Techniques/html/H57
- developer.mozilla.org/en-US/docs/Web/CSS/hyphens
- developers.google.com/search/docs/specialty/international/managing-multi-regional-sites
- www.w3.org/International/questions/qa-html-language-declarations
- www.w3.org/International/articles/language-tags/
- www.deque.com/automated-accessibility-coverage-report/
Check your own site
Run a free automated scan of one page to check it for some issues like this one.
Automated tests find only some accessibility issues; manual testing is still required. Not legal advice.