Making Accessible Websites for the United Nations

Page Design: Coding

Identify the Main Language

WAI Definition (Checkpoint 4.3)

Identify the primary language of the document text.

Explanation

The primary language of a document is the natural language in which a document is written.

Rationale

Screen readers need to know the natural language of a document in order for the words on the page to be pronounced correctly. Failing to identify the natural language could cause these devices to mispronounce the information making it impossible to understand. Identifying the natural language also improves search engine indexation.

Technique

The natural language should be identified in the <html> tag with:

The language codes for the six UN official languages are:

Refer to the ISO list of language codes for additional languages.

Example

XHTML 1.1

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> ....HTML document written in French... </html>

Validation

Test

Check the source code.

Success Criteria

The proper language code is set for the <html> tag (as seen in the example above in bold).