Do you know what language your website speaks? For website accessibility, the language setting of your website is important as it enables assistive technology like screen readers and translators to work correctly, making for a better experience for all your visitors.
In the sixth article on website accessibility I touch on how the value of the language attribute of your website pages can affect accessibility and inclusivity.
Many readers might be thinking I’m referring to the language your website content is written in – I’m not, at least not yet.
Every website has, or should have, a language value set in the code of every page. I say ‘should have’ as unless your website was built with a web framework or some platform (WordPress, Wix etc), there is a good chance it doesn’t have a language setting in the code of the site.
This article covers:
- How can I check if my website has a language value?
- Why is website language important for accessibility?
- What if my web site has pages written in different languages?
- What if a page on my website has copy written in different languages?
- How easily/quickly can I add/change my website language to the correct value?
How can I check if my website has a language value?
Go to your website and right-click on your mouse/touchpad and select ‘View page source’ (or similar – this may be different based on the browser you’re using but typically you’re looking for any option label that has the word ‘source’ in it) from the pop-up menu. This will display your page in HTML code. At the very top of the page, in the first few lines, look for something that like this:
The ‘lang’ attribute of the HTML tag declares the language for your website. If you don’t have this in your source code it’s time to get in touch with your web agency to ask if they can add it; if the tag is present, check that the language setting is correct for your audience (see notes below for a link to the ISO language code reference).
Why is website language important for accessibility?
The language of a web page signals to a browser and other software like screen readers and language translation services what language the content of the page is written in. This allows such services to provide accurate translations e.g. we know there are differences in pronunciation of words between UK English and US English – setting the correct language code ensures that a screen reader pronounces words in the correct way.
What if my web site has pages written in different languages?
Different pages on a site can have different language declarations e.g. if your site has an international audience you may have the same pages in English and Spanish, in which case the relevant language code should be used for each page.
What if a page on my website has copy written in different languages?
The ‘lang’ attribute can be assigned to different container tags on a page e.g. your global language may be set to “en-GB” and a paragraph on this page may be written in French so adding ‘lang=”fr”’ to the paragraph tag will make the page more accessible as it clearly signals to browsers, user agents and other technology that this particular paragraph needs to be translated from French into the language of choice e.g. Braille, German etc.
How easily/quickly can I change my website language to the correct value?
Very easily. If you’re using a CMS like WordPress it’ll take all of 5 minutes to set the correct default language for your website.
If your website doesn’t use a CMS or other platform ask your web agency to make the change – the time it takes to make the change globally on your site will depend on how well the site has been made. If you need help don’t hesitate to reach out to me for help on LinkedIn (opens in a new tab).