From Automated WCAG Monitoring Community Group
Jump to: navigation, search

This test belongs to 3.1.1 Language of Page.


Version 1

Previous versions

Version 0: For review

Version 0.1: For review


This test checks that the primary language of the web content can be programmatically determined.



  • The comparison of language codes does not look for exact matches. Technique H57 states: "Use of the primary code is important for this technique." which means that region subtags can be ignored in the comparison, i.e. "en-GB" is the same as "en".
  • This test checks the lang attribute of the <html> element. The xml:lang attribute is not taken into account because tests have shown, that xml:lang is ignored by screenreaders. (Both Jaws 15 with FF and IE and NVDA with FF go by lang attribute, xml:lang is ignored.) The xml:lang attribute is checked by a separate test: SC3-1-1-xml-lang.

Test properties

Property Possible values
Test name Primary language of page
Success Criterion 3.1.1 Language of Page
Test mode automatic
Test environment DOM
Test subject single web page
User expertise and skills
User profile

Test procedure


Test mode: earl:automatic

Select the html element.

Step 1

Test mode: earl:automatic

If lang attribute exists:
L1 = value of lang attribute.
Continue with #Step2.

elseif neither lang nor xml:lang are specified, return

Property Value
TestCase SC311-html
Identifier SC311-html-fail1
Outcome failed
ErrorMessage No language attribute found.
Pointer position

else (only xml:lang exists)
Do nothing. (This case is covered by SC3-1-1-xml-lang.)

Step 2

Test mode: earl:automatic

Compare L1 to BCP 47.

If L1 is not on the list, return

Property Value
TestCase SC311-html
Identifier SC311-html-fail2
Outcome failed
ErrorMessage Unknown language code.
Pointer position
Info L1

Note that this step also fails if L1 contains only whitespace or is empty.

Else, return

Property Value
TestCase SC311-html
Identifier SC311-text-pass1
Outcome passed
Pointer position