Skip to main content

In html, the lang attribute is used to specify the language of a web page. This is required for accessibility purposes as it helps to ensure that screen readers will correctly pronounce the content.

All pages in the School of Medicine (SOM) web system are tagged with the English language code. If content in another language is added to the SOM web system, that content needs to be properly tagged. This can be accomplished by adding the lang attribute to html elements such as paragraph or header tags.

<p lang="en">This is some content.</p>

<h2 lang="en">This is some content.</h2>

For Spanish, the language code is es. The html would look like this:

<p lang="es">This is some content.</p>

A list of other acceptable language codes can be found on this HTML Language Code Reference page.

How To

To view and modify the html of a page, select the Text tab in the editor and add the lang attribute to the correct block(s) of text.

Screenshot highlighting the location of the text tab in the editor.

Defining the Language In Documents

Identifying the language in documents such as PDFs and Word documents is also important and is required to meet accessibility guidelines.


WCAG Success Criterion 3.1.1 requires that web pages specify the default language of the page.

WCAG Success Criterion 3.1.2 requires that pages with parts in different languages have the languages of those parts specified too.

WebAIM’s Document and Content Language – there is a great audio recording demonstrating the issues a screen reader has pronouncing English text that has the language attribute of “cs” (Czech).