Why is this an issue?

This is a template rule. It checks that the language code present in any lang HTML attribute belongs to the user-configured list of ISO 639-1 language codes. This applies to any HTML element carrying the lang attribute, not only the <html> element. Create a custom rule from this template to define which ISO 639-1 language codes the attribute must accept.

How to fix it

Update the lang value to one of the ISO 639-1 language codes configured in the template.

Code examples

Noncompliant code example

For a given configured list of ISO 639-1 language codes, for instance fr,es,en,ca:

<html lang="de"> <!-- Noncompliant: "de" is not in the configured language codes list -->
  <head>
    <title>Example</title>
    <meta charset="utf-8" />
  </head>
  <body>
    <p lang="it">Benvenuto sul nostro sito</p> <!-- Noncompliant: "it" is not in the configured language codes list -->
  </body>
</html>

Compliant solution

<html lang="en">
  <head>
    <title>Example</title>
    <meta charset="utf-8" />
  </head>
  <body>
    <p lang="fr">Bienvenue sur notre site</p>
  </body>
</html>

Resources

Related rules