- Next, let's cover language.
Most screen readers can read several different languages.
Users select a default language when installing
and configuring their screen reader.
If you don't specify the language of a page, the screen
reader will read it in the user's default language.
Now, the page language and default screen reader language
may happen to match by luck, but if not, it can make the
content difficult or impossible to understand.
Imagine English being read with Spanish pronunciation rules.
In addition to specifying the main page language,
you must also specify the language of parts.
For example, you might have a quote in Hindi
on an English page.
You must specify that language change for the quote.
Let's see an example.
Here I'm on the accessibility page of the IRS website.
I'll right click and select view page source.
At the very top, on the HTML element, I see this attribute.
Lang equals en; en stands for English.
So this is the main page language.
The code en comes from a standard list of language codes,
which you must use.
For example, lang equals English is not valid.
Now going back to the page, here we see some links to access
the page in other languages.
And notice those links are written in the languages
themselves.
For instance, Russian is written as русский.
I'm going to right click this link and select inspect.
And here on the link element, I have this attribute,
lang equals ru, which tells me that this link text is written
in Russian.
So you can apply the lang attribute to block level
and inline elements.