Language Accessibility
Imagine hearing a phrase, paragraph, or even an entire page that is written in English but pronounced as if it were Spanish. It would be very difficult for listeners to understand. Most screen readers and other text-to-speech software can support multiple languages. When languages are defined properly, assistive technologies can correctly process and pronounce the language.
Overview
Section titled “Overview”Defining the default page language used for content ensures that both the browser and assistive technologies such as screen readers and other text-to-speech software will use the specified language as the default text-processing language.
This is also true when only a part of the content is in a language different from the primary language of the page. When language is correctly identified, the assistive technology changes its pronunciation of text to match the defined language.
When the language used for content is not defined:
- Most screen readers and other text-to-speech software are set to a default language when installed and will use that language as their default text-processing language. This can cause confusion if a different, undefined language is encountered as the screen reader will continue to use the pronunciation of its default language.
- Browsers will treat the language which is used most on the page as the default text-processing language. This can cause confusion if a different, undefined language is encountered as the browser may not render the text correctly, especially when the language uses a different alphabet or is read left to right.
Who is Helped
Section titled “Who is Helped”All individuals who use assistive technologies such as screen readers or another type of speech-to-text software benefit when languages are pronounced correctly. This includes:
- People who are blind or have a visual disability.
- People with certain cognitive, reading, or learning disabilities.
People who rely on captions can also be impacted when the language is not defined.
Everyone is helped as setting the correct language helps browsers:
- Render text more accurately.
- This is especially important for right-to-left languages or languages that use a different alphabet.
- People with cognitive and learning disabilities that impact reading skills can be affected when text is not rendered correctly.
- Return language-specific search results more accurately.
- Translate content using tools like Google Translate.
Identify Page Language
Section titled “Identify Page Language”The primary human language of a page must be defined to ensure that content is accurately processed and presented to assistive technologies and browsers. This allows:
- Screen readers and text-to-voice software to correctly pronounce the content, and
- Software such as browsers and text editors to correctly display font characters.
Setting the primary human language for a page allows assistive technologies, such as screen readers and text-to-voice software, to present content using the correct pronunciation and rules for that language.
Most modern screen readers support multiple languages. When a screen reader user configures their software, they can install different languages. However, they must choose a default language.
When a screen reader encounters content where the language for a page has not been defined, it will announce the content using the rules and pronunciation for its default language. For example, if a screen reader user has set their default language to French and the page is written in German without the language defined, the screen reader will announce the contents with French pronunciation and language rules. This can make it extremely difficult for users of assistive technology to understand the content.
When a screen reader encounters content within a page where the language is defined as something different from the defined language of a page, it can switch to the correct rules and pronunciation for that language. If the screen reader doesn’t support that language, it will often announce the language to the user, for example, “Latvian.” See Identify Changing Languages within Content (Ta11y) for more information.
Steve Faulkner has made a great short video example of this - Effect of the lang attribute on screen readers.
Identify Changing Languages within Content
Section titled “Identify Changing Languages within Content”When a web page is created, the primary language of that page should be defined.
When part of the web page includes languages that are different from the page’s primary language, the language change must be identified so that assistive technologies and user agents (browsers) switch language profiles. This ensures that assistive technologies like screen readers present and pronounce content written in a different language according to the rules of that language.
Most modern screen readers support multiple languages. When a screen reader user configures their software, they can install different languages. However, they must choose a default language.
Identifying the human language of each part of a page’s content (the language of parts) that differs from the defined language of the page allows both browsers and assistive technologies, such as screen readers and text-to-voice software, to switch to the correct language profile and present the content using the pronunciation and rules for that language. For example, if the primary language of the page is set to French and a screen reader encounters a sentence in German, it can switch to the correct rules and pronunciation for German if the new language is defined. If the screen reader doesn’t support that language, it will often announce the content’s language to the user if it has been identified, for example, “German.”
When a screen reader encounters content on a page different from the defined primary language of the page and the new language is not defined, it will announce the content using the rules and pronunciation for the primary language of the page. For example, if the primary language of the page is set to French and a sentence in German is encountered, the screen reader will announce the German sentence with French pronunciation and language rules. This can make it extremely difficult for users of assistive technology to understand this content.
Steve Faulkner has made a great short video example of this - Effect of the lang attribute on screen readers.
Further Reading
Section titled “Further Reading”Web Accessibility
Section titled “Web Accessibility”- Identify Page Language
- Identify Changing Languages within Content