Sanna Kramsi - Blog A peek into my life

Page and content language

May 15, 2021 | Accessibility

Related WCAG criteria

The default human language of each page needs to be programmatically determined. Use, for example, the 'lang' attribute in the <html> element. This helps screen readers to read the content in the correct language. At least some content management systems (CMS) add this 'lang' attribute automatically.

If you have content on a page in another language, provide the language of the content programmatically. Remember that this includes any content in another language, don't forget your language switcher menus.

In Drupal CMS, there is a language button, with which you can add language information for text editor content.

Remember to always make sure all the text content in the website codes can be translated. Labels and such won't help much if they are in the wrong language. Trying to understand content read to you in the wrong language is very hard.

I created a small example of a language switcher with and without the language attribute on my accessibility site.