The lang attribute must contain a valid language tag that conforms to recognized standards.
If the language of a webpage is not properly identified, it can create significant barriers for users who rely on assistive technologies (glossary term, activate to view definition). Screen readers, for example, use the language attribute to determine how to pronounce words and phrases accurately. Without this information, the content may be read in a default or incorrect language, which makes it difficult or impossible for users to understand the information.
Additionally, language settings are critical for tools such as translation software and text-to-speech programs. When the language is not specified or is incorrect, these tools may misinterpret the text and cause to confusion or miscommunication. This can cause problems for multilingual users or those users who access the content in a non-native language.
Define the language of the page to ensure that all users, regardless of their needs or preferences, can effectively engage with the content and navigate the page without unnecessary obstacles.
Maria is a Norwegian carpenter with dyslexia:
"When I go online to read user manuals for some of the machinery I use, they are written in English but my text-to-speech software will read the English text with a Norwegian voice, pronouncing the words as if they were Norwegian. That makes it very hard for me to understand the instructions."
This section provides some examples of the issue.
A webpage lacks a lang attribute in the <html> tag to specify the primary language of the content:
<html>
This example demonstrates poor accessibility practices. Without a lang attribute, assistive technologies, such as screen readers, cannot determine the language of the page. This can lead to issues such as incorrect pronunciation, grammar errors, and ineffective text-to-speech rendering.
For instance, a screen reader might attempt to read the content using the wrong language settings, making it difficult or impossible for users to understand the text.
A webpage includes a lang attribute in the <html> tag, but the value of the attribute is not valid:
<html lang="#1"></html>Although the lang attribute is present, the value #1 is not a valid language tag. As a result, assistive technologies such as screen readers cannot correctly interpret the language of the page. This can lead to issues such as incorrect pronunciation, grammar misinterpretation, and ineffective text-to-speech rendering.
For users who rely on assistive technologies.
A webpage uses a valid lang attribute in the <html> tag to specify the primary language of the content:
<html lang="en">The lang attribute is neither empty nor invalid, which ensure that assistive technologies such as screen readers can accurately interpret the language of the page. This allows users who rely on such technologies to benefit from features like accurate pronunciation, grammar rules, and text-to-speech optimizations based on the specified language.
This section provides information on how to identify and fix the issue.
The Acquia Web Governance platform flags pages that are missing a lang attribute with a non-empty value, and it also flags pages that have lang attributes with invalid values.
If you receive the error: Page is missing a language attribute, you must add a lang attribute with a valid value, such as:
<html lang="en">If you receive the error: Page language attribute has invalid language tag, you must edit the value of the lang attribute to ensure that it contains a valid value. For example, change:
lang="#1" to:
lang="en"For the official list of language tags, visit: IANA language subtag registry.
Related accessibility conformance testing (glossary term, activate to view definition) rules.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
If this content did not answer your questions, try searching or contacting our support team for further assistance.