Skip to main content

Language

For most products, whether that is a website or native app, defining both the document language or an inline change to the document language is essential as assistive technologies like screen readers set the language model based on this information.

If you incorrectly declare the lang attribute on the html tag, then this can have a major impact on the user experience for screen reader users.

Declaring the correct document language

We notified a UK based business that their website incorrectly declared Italian as the document language when all their content was written in English.

The lang attribute was set as:

This meant the screen reader used the Italian voice and language model to read the English words. It did not sound good.

When it came to announcing their telephone number it spoke the numbers in Italian. I don’t speak Italian.

The lang attribute should have been declared as:

You can define the language using the 2 character language subtag based on ISO 639-1 Language Codes or, better still, use the region code subtag in addition to the language code.