Language of Parts [SC3-1-2-xml-lang]

Test info
Possible Results

Test info

Test for Success Criterion 3.1.2


Checked Elements: descendent-or-self::body[@xml:lang]
This test checks the value of the xml:lang attributes.

Short Description

If an element has xml:lang attribute, it should also contains a lang attribute with the same value.

How to Repair

The language of an element can be specified by its lang and xml:lang(optional) attributes.
If you use xml:lang for a element you need to add lang attribute with the same value as well.

The value of the lang and xml: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 Contradicting language attributes.

The attributes lang and xml:lang are contradicting

Failed No lang is specified

The xml:lang is specified for the element but no lang attribute found

Passed Element with equal lang and xml:lang

The element contains a lang attribute with the same value to xml:lang.