New Tool Radar

AI Design Workflows

How to Check the Page Language in an AI Design

Check that each page in an AI design declares its language so screen readers pronounce it correctly.

Schematic diagram: steps to check wcag 3.1.1 language of page on an AI-designed page — with a practice result of 4 of 6 checks passing and 2 failing for the fictional Maple Corner bilingual site.

An AI design tool can lay out a page that looks finished and still fail the accessibility rule it was supposed to follow. WCAG 3.1.1 Language of Page is the rule this guide checks: the default human language of each web page can be programmatically determined. A design that passes by eye can still fail it, so check the rule itself, not the look of the page.

What the rule asks

WCAG 3.1.1 Language of Page asks that the default human language of each web page can be programmatically determined. The rule is written for the reader who cannot see the page the way you do, so the check has to be made from that reader’s point of view: keyboard only, colour removed, or screen reader only.

How to check it

Open the page source and read the lang attribute on the html element, then compare it with the words on the page.

  1. Confirm the html element carries a lang attribute
  2. Confirm the value is a valid language tag, such as en or de
  3. Confirm the value matches the language most of the page is written in
  4. Confirm each language version of the site carries its own value
  5. Confirm passages in a second language are marked with their own lang attribute

Practice check: fictional Maple Corner

The table below is fictional practice material, with fictional values. It is the expected result for the practice page, worked out against the WCAG Understanding page, not a run of any accessibility tool.

Check As shown Result
Attribute present html carries lang=“en” Pass
Valid tag en is a valid language tag Pass
Matches content page is written in English Pass
German version German pages carry lang=“de” Pass
French passage a French quote has no lang attribute Fail — mark it lang=“fr”
Underscore tag one page uses lang=“en_US” Fail — use a hyphen: en-US

Four of the six checks pass, and two fail. The passing checks show the design follows the rule in most places, but the two failing checks would block a reader on every visit if they went out unchecked.

Expected result. We checked the Maple Corner bilingual site against WCAG 3.1.1 Language of Page. We did not run any accessibility tool on the page.

Limits

  • No accessibility tool was run on the Maple Corner bilingual site, and Maple Corner is fictional. The table above is the expected result for the practice page, not a test of any product.
  • This guide checks one criterion on one page. A page that passes this check can still fail other criteria; check each rule separately.
  • Ratios in this guide are the thresholds from the WCAG Understanding page. A ratio of 4.499:1 fails a 4.5:1 requirement; ratios are not rounded.
  • It does not check the design’s brand colours. A design that passes this check can still use the wrong brand colour; check colours separately.

Sources

See all