This test belongs to 3.1.1 Language of Page.
This test checks that the primary language of the content is specified correctly by the language attribute of the
- H57: Using language attributes on the html element
- eGovMon test for H57
- BCP 47: Tags for the Identification of Languages
- IANA language subtag registry
- The comparison of language-code 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 assumes that the language of the web page has been specified in the
langattribute of the
<html>element (see also SC3-1-1-html). The
xml:langattribute is not taken into account because tests have shown, that
xml:langis ignored by screenreaders.
- There are different possible definitions of "primary language" of a web page:
- language of the majority of content
- language of interface
- language of the intended audience
This test does not prescribe which of these definitions to use as long as one of them is used.
Note that all language changes must be marked correctly independent of the chosen definition. This is covered by 3.1.2 Language of Parts.
|Success Criterion||3.1.1 Language of Page|
|Test subject||single web page|
|User expertise and skills||no prior knowledge|
|User profile||Knowledge of the languages used in the web page|
L1 = value of
Select a continuous run of text from one or more consecutive
p-elements. If no
p-elements exist, select any text from the body of the web page. The text should be at least 300 characters in length and not contain any language changes, i.e. lang-attributes on the element or its parent. If no such text is found, continue with Step 2.
Use a language identification algorithm to check if L1 is the language of the selected text.
If yes, return
Else continue with Step 2.
Present the page to the user.
Question: Is L1 the primary language of this page?
Note that language code L1 should be presented in human readable form, e.g. using the description from the language subtag registry.
Help text: "Primary language" means the language of the majority of the text on the page or the language of the interface (navigation menu etc.) of the page.
If yes, return
|ErrorMessage||The primary language of the page is not specified correctly.|