Language Identification

The main language of the page MUST be identified correctly on the element.
If the language is not specified, a screen reader will read the page in the user’s default language, which can be very difficult to understand.

Good Example:
The language is specified accurately on the second line in the code.
Begin code:




I Have a Dream, Excerpt

"I say to you today, my friends, so even though we face the difficulties
of today and tomorrow, I still have a dream. It is a dream deeply rooted
in the American dream.



End code.

Bad Example: Inaccurate Language Identification
If you do not identify the language of the page, and if the screen reader is set to a different language, the screen reader will read the document with the wrong pronunciation, making it nearly impossible to understand.
Begin code:




I Have a Dream, Excerpt

"I say to you today, my friends, so even though we face the difficulties
of today and tomorrow, I still have a dream. It is a dream deeply rooted
in the American dream.



End code.
Description: JAWS reads the English words with a Spanish accent, making the content extremely difficult to understand.

The primary language of the page MUST be identified with a valid value on the element.
The language designation must come from a standard list of language codes, which includes en (English), fr (French), es (Spanish), and others, according to the specification. Anything else (such as lang=”English”) will not work.
List of official language codes
Some screen readers support only two-letter codes. Other screen readers support regional language codes, such as en-us (American English) or fr-ca (French Canadian).
Good Example: Language of Page with a Valid Value
The primary language of the page is specified in the html tag, which is English in this case.
Begin code:

End code.
Bad Example: Missing or Invalid Value
In this example, the lang attribute is missing entirely from the element.
Begin code:


End code.
Bad Example: Invalid Value
The value “anglais” (the French word for “English”) is not valid. The proper value in this case would be lang=”en”.
Begin code:


End code.

Identify any changes of language within the document. The lang attribute can be applied to block level elements (

,

,

,

, etc.) as well as inline elements (, , , etc.).
Good Example: Inline Change in Language is Marked Correctly
There is a change of language in the last phrase of the following paragraph:
While in Spain, my friend tried to speak Spanish, but she wasn’t very good. Everyone kept saying “No comprendo nada de lo que dices.”
The markup for the above paragraph is shown below:
Begin code:

While in Spain, my friend tried to speak Spanish,
but she wasn’t very good. Everyone kept saying
"No comprendo nada de lo que dices."

End code.
Bad Example: Inline Change in Language is NOT Marked Correctly
In the following paragraph, the change in language is NOT specified in the markup, so the screen reader will read the Spanish words with English pronunciation rules:
While in Spain, my friend tried to speak Spanish, but she wasn’t very good. Everyone kept saying “No comprendo nada de lo que dices.”
The markup for the above paragraph is shown below (notice that there is no markup for the change in language):
Begin code:

While in Spain, my friend tried to speak Spanish,
but she wasn’t very good. Everyone kept saying
"No comprendo nada de lo que dices."

End code.
Listen to JAWS read this same sentence without the language change specified in the code (it reads the words with a bad English accent):


About admin

Freelance Certified Web Accessibility Specialists