Defining the Language of your Web Content

Why is Defining the Language of Content Important?

In order for web browsers to accurately render text and screen readers to accurately pronounce text, the human language must be declared. This is of paramount importance for accessibility and for web page parsing and Search Engine Optimization (SEO). The default language in which the page is written must be specified, as well as any parts of the page written in a language other than the page’s defined default language.

Language of Page versus Language of Parts

Language of Page

Each web page must have the default human language of the page declared. This default language is the human language in which the all of – or the majority of – the page is written.

Language of Parts

If sections of content are written in a language different from the default language, the language of these sections must be declared.

Defining Language on Web Pages

Declaring the Default Language on Web Pages

To declare the default language of the content, utilize the ‘lang’ attribute on the opening tag of the web page. Ensure that the value of this ‘lang’ attribute corresponds to that language’s code in the ISO 639-1 Language Codes reference list.
So, for example, a page written in English would have a ‘lang’ attribute with a value of “en”.

HTML element with a 'lang' attribute with a value of "EN"

Declaring the Language of a Specific Part of a Web Page

Declaring the language of a specific part of the content is done by wrapping the text in a element and applying the ‘lang’ attribute to the opening tag. Ensure that the value of this ‘lang’ attribute corresponds to that language’s code in the ISO 639-1 Language Codes reference list.
So, for example, on a web page where the default language is English, if a paragraph, sentence, or even a single word is written in French, that section must be wrapped in a and have a ‘lang’ attribute with a value of “fr”.

French text specified as being French via a 'lang' attribute on the opening span tag

Defining Language in Microsoft Office

Similar to web pages, document created in the Microsoft Office suite of programs can also have their languages defined.
Both the default language of the document as well as the language of specific parts of the document can be defined.

Declaring the Default Language of Microsoft Office Documents

Although the Microsoft Office suite of programs is quite intelligent and can fairly accurately determine the human language of content automatically, it is always a good idea to ensure the correct default language is set. To do so, follow these steps:

  1. Select the “Review” tab from the ribbon menu.

    Microsoft Word ribbon menu with "Review" tab highlighted

  2. Select “Language” and then “Set Proofing Language”.

    Within the Review Tab, "Language" is selected with a submenu showing the option "Set Proofing Language" highlighted

  3. On the “Language” dialog box that opens, select the correct language

    Language selection dialog box with English selected

Declaring the Language of a Specific Part of a Microsoft Office Document

While the Microsoft Office suite of programs can fairly accurately determine the language of the majority of the content (the default language), it cannot reliably determine if a section or part of the content is written in another language. To set the language for specific parts of content, follow these steps:

  1. Highlight the text which is written in a language other than the default language.

    Spanish text highlighted and selected

  2. Select the “Review” tab from the ribbon menu.

    Microsoft Word ribbon menu with "Review" tab highlighted

  3. Select “Language” and then “Set Proofing Language”.

    Within the Review Tab, "Language" is selected with a submenu showing the option "Set Proofing Language" highlighted

  4. On the “Language” dialog box that opens, select the correct language.

    Language selection dialog box, "Spanish (United States)" selected

Conclusion

Now that you understand the importance of defining the language of content and how to do it on web pages and Microsoft Office documents, make sure to help out your readers and make this an integral part of your content creation process!