accessibility-guidelines

This document is in beta. Help us by reporting issues via Github or email

Back to the overview page

Language of page

On this page:


Summary

In code, identify the language that the content of the page is written in (English for example).


Requirements

Why?

This makes sure that screen readers automatically use the correct speech libraries for accent and pronunciation.

When listening, correct pronunciation helps understanding. For users of assistive technologies such as screen readers it is particularly important, as some have different speech synthesizers for different languages. For example, “chat” means something different when using English pronunciation rather than French.

Other benefits for the Web

In HTML, correctly setting the lang attribute also has other benefits:

Official wording in the Web Content Accessibility Guidelines

3.1.1 Language of Page: The default human language of each Web page can be programmatically determined. (Level A)

This applies to native apps by replacing “Web page” with “app”.

See the W3C’s detailed explanation of this guideline with techniques and examples.


Guidance for iOS

This section needs more content. Contribute via Github or email.


Guidance for Android

This section needs more content. Contribute via Github or email.


Guidance for Flutter

This section needs more content. Contribute via Github or email.


Guidance for Web

Note: It’s better to only use the two-letter code representing the language (like lang="en"), rather than including the country as well (like lang="en-gb" or lang="en-us"):

Example

<html lang="en">
<!--  -->
</html>

Failure example

<html>
<!--  -->
</html>

Common mistakes

More guidance for Web


More info

Sources

Contribute

This document is in beta. Help us by reporting issues via Github or email