Accessibility Wiki

lang on inline content must be a valid tag

Rule valid-lang · Document, language & navigation · impact moderate · Static + live

↩ Back to the rules index · WCAG cross-reference

Why it matters

Phrases in another language need a correct lang so AT switches pronunciation. A malformed tag is ignored. Only elements whose subtree contains text are checked (a bad lang with nothing to pronounce has no 3.1.2 impact); well-formed private-use (x-…) and grandfathered (i-…) BCP-47 tags are accepted.

How to fix

Set a valid lang on the element wrapping the foreign-language passage.

Example

✕ Fails
<span lang="francais">Bonjour</span>
✓ Passes
<span lang="fr">Bonjour</span>

Example

✕ Fails
<span lang="en_US">Hello</span>
✓ Passes
<p lang="x-lojban">coi rodo</p>

Private-use (x-…) and irregular grandfathered (i-…) tags are well-formed BCP-47; underscores are not.

WCAG success criteria

3.1.2 Language of Parts — Level AA

Passages in a different language need their own lang attribute.

Understanding 3.1.2

Standards

This rule contributes to the following standards:

WCAG AA EN 301 549 Trusted Tester ACT

Standard Criteria
EN 301 549 9.3.1.2
Trusted Tester v5 11.b
ACT (WCAG SC) 3.1.2

References

Generated from the EqualWeb accessibility engine’s rule metadata. Back to top ↑