Page language (lang attribute)
Also called: lang attribute, Language of page
The human language of a page, declared with the lang attribute on the html element so assistive technology pronounces it correctly.
Definition
WCAG 3.1.1 Language of Page, Level A, requires that the default human language of each web page can be programmatically determined. In HTML you do this with the lang attribute on the root element, for example <html lang="de">. 3.1.2 Language of Parts, Level AA, extends this to passages in another language, such as <span lang="fr">.
Why it matters
Screen readers choose their speech voice and pronunciation rules from the language. A German page marked lang="en" is read with English pronunciation and is hard to follow. Browsers also use it for hyphenation, spell checking and translation, and braille displays for character tables.
How to test or meet it
- Set
langon<html>with a valid code (en,de,fr-CA) on every page, including templates for other locales. - Mark quotes, names of products in other languages and language switch links with their own
lang.
Automated tools reliably find a missing or invalid lang on the page. They cannot tell whether the declared language matches the text, or find foreign-language passages that are not marked: check those by reading the page, or by listening with a screen reader.
WCAG criteria
- 3.1.1 Language of Page (Level A)
- 3.1.2 Language of Parts (Level AA)
Related terms
Sources
By the Perceivly team · Published . This explains a term; it is not legal advice.