This document provides information about the related Acquia Web Governance accessibility check:
Page language attribute has invalid language tag.
What
The lang attribute must contain a valid language tag that conforms to recognized standards.
Why
If the language of a webpage is not properly identified, it can create significant barriers for users who rely on assistive technologies. 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.
Who
This check affects the following users who have
Vision impairments: Who rely on screen readers to read content aloud.
Multilingual needs: Who depend on accurate language identification to use translation tools effectively, to ensure that the content is understandable.
Cognitive impairments: Who benefit from consistent and predictable language presentation to support clarity and reduce confusion.
User story
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."
Examples
This section provides some examples of the issue.
Example: Missing lang attribute for HTML page
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.
Example: Invalid lang attribute for HTML page
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.
Example: Valid lang attribute for HTML page
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.
How
This section provides information on how to identify and fix the issue.
How to identify it
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.
How to fix it
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"
Note
The value should represent the primary language of the page.
Refer to the ACT rules section, which includes a link to a complete technical explanation of this check.
This document provides information about the related Acquia Web Governance accessibility check:
Page language attribute has invalid language tag.
What
The lang attribute must contain a valid language tag that conforms to recognized standards.
Why
If the language of a webpage is not properly identified, it can create significant barriers for users who rely on assistive technologies. 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.
Who
This check affects the following users who have
Vision impairments: Who rely on screen readers to read content aloud.
Multilingual needs: Who depend on accurate language identification to use translation tools effectively, to ensure that the content is understandable.
Cognitive impairments: Who benefit from consistent and predictable language presentation to support clarity and reduce confusion.
User story
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."
Examples
This section provides some examples of the issue.
Example: Missing lang attribute for HTML page
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.
Example: Invalid lang attribute for HTML page
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.
Example: Valid lang attribute for HTML page
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.
How
This section provides information on how to identify and fix the issue.
How to identify it
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.
How to fix it
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"
Note
The value should represent the primary language of the page.
Refer to the ACT rules section, which includes a link to a complete technical explanation of this check.