Language Declaration

  • Identify the primary natural language of a document and language changes.
  • Identifying the language of the document is important for screen readers.
  • Language declaration is important for accessibility because it allows braille translation software to substitute control codes for accented characters. Speech synthesizers that support multiple languages will be able to orient and adapt to the pronunciation and syntax that are specific to the language of the page, speaking the text in the appropriate accent with proper pronunciation.


Immediately following the doctype declaration should be the <html> tag with attributes declaring the language of the document.


XHTML: <html xmlns="" xml:lang="en" lang="en">

HTML5: <html xml:lang="en" lang="en">

The two language attributes specify the version of xml is written in English and that the document is written in English.

If you are just indicating a language change on a phrase or word use a <span> or <div> tag with the lang attribute.

Example: <span lang="es" xml:lang="es">Espanol</span>

Language codes may be found at the Library of Congress.


Class Example (Before, Problems, After)

WCAG Guideline

3.1.1 Language of page: The default human language of each Web page can be programmatically determined.

3.1.2 Language of parts: The human language of each passage or phrase in the content can be programmatically determined except for proper names, technical terms, words of indeterminate language, and words or phrases that have become part of the vernacular of the immediately surrounding text.