Level
A
Since
WCAG 2.0
Entries
26 / 193
/ WCAG criterion

3.1.1 Language of Page

The page has to declare its language, or a screen reader reads Polish text with an English voice.

/ What it requires

Every page has to state, in its code, which human language it is written in. In HTML that is the lang attribute on the html element. A screen reader uses it to pick the voice and the pronunciation rules, so a Polish page marked as English, or not marked at all, is read out with English sounds and becomes hard to follow. The same attribute guides braille output, automatic hyphenation and the choice of quotation marks.

The page passes when the html element carries a valid language tag that matches the main language of the content, for example lang="pl" or lang="en-GB". An absent or empty attribute fails, and so does a value that is not a real language tag. The criterion names no exceptions. Where a page mixes languages, declare the one used most and mark the other passages separately, as 3.1.2 requires. A tag for the wrong language defeats the purpose even when it is well formed.

/ How pages fail it

  • The html element has no lang attribute at all.
  • A Polish or German site keeps lang="en" from the template it was built on.
  • The value is not a language tag, such as lang="polish" or lang="pl_PL" with an underscore.
  • The attribute is present and empty, written as lang="".
  • Every language version of a multilingual site carries the same value, so the German pages are announced as English.

/ How to check it yourself

  1. Open the page source and look at the opening html tag near the top, which should carry a lang attribute.
  2. Alternatively type document.documentElement.lang into the browser console. An empty result means the attribute is missing.
  3. Check that the value is a real language tag: a short code such as pl, de or en, optionally followed by a hyphen and a region, as in en-GB.
  4. Compare the value with the language you actually read on the page, and repeat this for each language version of the site.
  5. Listen to a paragraph with a free screen reader such as NVDA. A wrong voice is audible at once.

/ How to fix it

  • Add the attribute to the root element, for example lang="pl" on the html element of a Polish page.
  • On a multilingual site, fill the value from the locale of each page in the template or in the language setting of the CMS, never as a fixed string.
  • Write regional variants with a hyphen, as in en-GB or de-AT, and not with an underscore.
  • In XHTML served as XML, add xml:lang with the same value next to lang.
  • Do not rely on a meta tag with http-equiv="content-language", because assistive technology does not take the page language from it.

/ What our scanner checks

Four checks look for one fault, an html element with no language. Our html_lang_missing check reads the raw HTML, while lang-missing, the axe rule html-has-lang and HTML_CodeSniffer H57.2 read the rendered page. None compares the declared language with the words on the page. A fifth check filed here, charset_missing, reports a missing character encoding declaration, which this criterion does not require.

/ Who fails it, in our own measurements

Measured bodies failing this criterion, most instances first
BodySectorInstancesScore
HealthCare.govhealth · US357
Medicarehealth · US351
Łódźcity · PL33
Federal Aviation Administrationtransport · US214
Kielcecity · PL271
Miami-Dade Countygovernment · US220
Narodowy Bank Polskigovernment · PL223
National Weather Servicegovernment · US234
New York Public Libraryculture · US224
Social Security Administrationgovernment · US2-
Sąd Najwyższygovernment · PL214
Dallascity · US123
Gorzów Wielkopolskicity · PL16
Humboldt-Universität zu Berlineducation · DE135
Instytut Pamięci Narodowejgovernment · PL143
Krakówcity · PL112
Las Vegascity · US18
Najwyższa Izba Kontroligovernment · PL141
Narodowy Instytut Zdrowia Publicznegohealth · PL125
New York Citycity · US137
Rzeszówcity · PL18
Seattlecity · US112
Sejm RPgovernment · PL19
Universität Heidelbergeducation · DE121
Uniwersytet Łódzkieducation · PL19
Zarząd Transportu Miejskiego Warszawatransport · PL177

One page per body, measured by automated checks on a weekly schedule. Any body that has fixed something since the last sweep will show it at the next one, and every entity page carries a right of reply.

/ Questions about this criterion

What lang attribute should a Polish or German page have?

Put the two-letter code of the language on the html element: lang="pl" for Polish, lang="de" for German, lang="en" for English. A region can follow after a hyphen where it matters, as in de-AT or en-GB. The codes come from the IANA language subtag registry, which is the list that browsers and screen readers understand.

What happens if the lang attribute is missing?

A screen reader falls back to its default voice, usually the language of the operating system or the one it used last. Text in another language is then pronounced by the wrong rules and can be unintelligible. Browser features that depend on the language, such as automatic hyphenation, may also stop working on that page.

Is lang="en" on a page that is not in English a WCAG failure?

In practice, yes. The criterion asks that software can determine the default language of the page, and a tag naming another language gives software the wrong answer. Many automated checkers only confirm that the attribute exists and is well formed, so this mistake passes them unnoticed. It takes a person reading the page, or a screen reader, to catch it.