Languages within the body [SC3-1-2-lang]

Test info
Possible Results

Test info

Test for Success Criterion 3.1.2


Checked Elements: descendent-or-self::body[@lang]
This test checks that lang attributes within the body of a web page are correct

Short Description

This test is applied to all elements with lang attribute in the body of the web page (including the body element itself). If the value of lang attribute is on the list of languages (BCP 47: the test would pass. Otherwise, test would fail. Description:

How to Repair

The language of an element can be specified by its lang attributes.

The value of the lang is composed from a sequence of one or more "subtags" divided by "-", each of which refines or narrows the range of language. It has to conform to BCP 47.
Examples of valid language tags are
  • nb – for Norwegian Bokmal
  • nn – for Norwegian Nynorsk
  • en – for English
  • en-US – for English as used in the USA
Further Information:

WCAG 2.0

Principle 3: Understandable
Information and the operation of user interface must be understandable.
WCAG 2.0: Principle 3
Guideline 3.1: Readable
Make text content readable and understandable. Understanding Guideline 3.1
Success Criterion 3.1.2: Language of Parts (Level AA)
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. (Level AA) Understanding: Success Criterion 3.1.2

Possible Results

Failed Value of lang attribute for the element is incorrect

Unknown language code.

Passed Correct lang attributes

The lang attributes of elements within the body of the page are correct.