This rule raises an issue when an HTML element has a lang and/or xml:lang attribute, contains text content within its
subtree, and the value of the attribute does not begin with a valid two‑letter ISO 639‑1 language code.
The lang attribute is used by assistive technologies, translation tools, and search engines to correctly interpret and process text
content. If the value starts with an invalid language code — for example, a misspelled code or one not defined in ISO 639‑1 — these tools may
mispronounce text, fail to translate it correctly, or misclassify the content’s language.
By ensuring that lang and xml:lang attributes start with a valid two‑letter language code, you improve accessibility,
usability, and interoperability.
<html lang="engl">
<head>
<title>Example</title>
<meta charset="utf-8" />
</head>
<body>
<p>Welcome to our website</p> <!-- Noncompliant: "engl" does not start with a valid 2-letter code -->
</body>
</html>
<html lang="en">
<div lang="xx">
Bienvenido a nuestro sitio web <!-- Noncompliant: "xx" is not a valid ISO 639-1 code -->
</div>
</html>
<html lang="en">
<head>
<title>Example</title>
<meta charset="utf-8" />
</head>
<body>
<p>Welcome to our website</p> <!-- Valid: "en" is a valid ISO 639-1 code -->
</body>
</html>
<html lang="en">
<div lang="es">
Bienvenido a nuestro sitio web <!-- Valid: "es" is a valid ISO 639-1 code -->
</div>
</html>
lang attribute – https://html.spec.whatwg.org/multipage/dom.html#attr-lang lang global attribute – https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang