Document Language

Field: Accessibility Ā· Also called: Lang entry, language attribute

In document accessibility, the document language is the default human language declared in a file’s metadata (for a PDF, the /Lang entry in the document catalog), which screen readers use to choose pronunciation. WCAG 2.1 Success Criterion 3.1.1 requires that it be programmatically determinable.

Requirement

WCAG 2.1 Success Criterion 3.1.1, Language of Page (Level A), states: “The default human language of each Web page can be programmatically determined.” W3C technique PDF16 describes meeting it for PDF files by setting the /Lang entry in the document catalog.

There are several places a language can be declared, and it is sometimes practical to set it in more than one, such as the lang attribute on the html element, the /Lang entry in a PDF, or the language settings stored in the XML inside a Microsoft Office document. Most authoring tools handle this. The key point is to assign a valid BCP 47 language tag, the IETF standard built on ISO language and country codes. For U.S. governments that publish primarily in English, en-US or en is the correct value for the vast majority of documents.

Distinctions

  • Declared vs. assumed. When no language is declared, most screen readers fall back to the user’s own configured language, so an English document often reads correctly for an English-speaking user. The requirement is still unmet, because the language is not programmatically determined from the document.
  • Legacy formats. Older formats, including WordPerfect 6.0a, had no language attribute. For these, an organization-wide default or an algorithmically detected language can supply the value.

Sources

See also

Go deeper

Articles