About This HTML Issue
The lang attribute on <html> holds a value with a piece longer than 8 characters, which no BCP 47 language tag allows.
A language tag is made of subtags separated by hyphens, such as en, en-US or zh-Hant-TW. BCP 47 caps every subtag at 8 characters, so the validator rejects the value before it even checks whether the language exists. A primary language subtag is normally only two or three letters long.
Two mistakes cause this most often. The first is writing the language name instead of its code, as in lang="portuguese" instead of lang="pt". The second is a template placeholder that was never filled in: a theme or CMS outputs lang="$language" literally because the variable was not replaced, and $language is 9 characters long. In that case, fix the template so it prints the real code, or hardcode the code if the site has a single language.
Screen readers read lang to pick a pronunciation, and browsers use it for hyphenation, spell checking and translation prompts, so a broken value hurts real visitors too.
Invalid example
<!DOCTYPE html>
<html lang="$language">
<head>
<title>Welcome</title>
</head>
<body>
<p>Welcome to our site.</p>
</body>
</html>
Valid example
<!DOCTYPE html>
<html lang="en">
<head>
<title>Welcome</title>
</head>
<body>
<p>Welcome to our site.</p>
</body>
</html>
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.