Indicating the text language (English, Spanish, etc.) used on a web page is critical because assistive technologies need to know how to correctly pronounce the text. Language markup is especially relevant at IU, since the university has a large international audience.
If the language of content is not specified, assistive technology will read the text in the language set in the visitor's operating system. Unfortunately, those languages don’t always match up. In such cases, users from non-English-speaking countries could have difficulty understanding the page content.
Guidelines
For HTML pages, the HTML lang
attribute should be used to set both the default language and to indicate any language changes in the text.
For XHTML pages, use the xml:lang
attribute.
For pages that mix HTML and XML, use both the lang
attribute and the xml:lang
attribute together.
Benefits
These measures allow users of assistive technology to better understand the structure of web pages, how to navigate them, and how different pieces of content relate to one another.
The measures also allow search engines to determine the text language and more accurately index the page’s content. Assistive technologies can also pronounce text content more accurately.