‘Language of Page’ requires that each webpage has a default human language assigned.
Introduction
For both users who rely on conventional web browsers and those who prefer assistive technologies, assigned a webpage’s language is essential for understanding.
Among the benefits, text is rendered more accurately, screen readers will use the correct pronunciation rules and captions will load correctly.
How to Pass ‘Language of Page’
Set the default language of each webpage using the lang HTML attribute.
‘Language of Page’ Tips
Set the language in your site template so you only have to do this once (unless your website has pages in different languages).
If a webpage has content in more than one language, set the page to the language used most.
If a webpage uses multiple languages equally, set the page to the language used first.
When using English, be aware of the three options “en”, “en-gb” and “en-us”. If in doubt, stick with “en” as this lets users set their preference.
See Also
Free Developer Resources
Join over 3,700 subscribers on my weekly web accessibility email and get free developer resources like WCAG Checklists and special offers.
Over 600 developers like you have learned more about the Web Content Accessibility Guidelines with my guidebook.
To get an idea of the importance of doing this, it can be fun to try and understand what a screenreader is saying when the language code is wrong. Try a page in English with lang=”de” (German) or “fr” for example, and listen to it with free screenreader NVDA, or JAWS (which isn’t free but can be run in demo mode for 40 minutes).
Nice idea Richard! Here’s a link to NVDA if anyone wants to have a go: http://www.nvda-project.org/
What about bilingual pages? Do you set the language for both languages?
Hi Sunny – the page should be set to the main language on the page (this will be up to you if it’s 50/50) – you then need to mark text in the second language separately – see http://www.wuhcag.com/language-of-parts for more about that.