Skip to content
SilktideHelp

Invalid language for page

When a page declares its language, the language code must be written correctly. Silktide reports pages whose declared language is empty or not a recognizable code, which stops browsers and from using it.

Why this matters

A relies on the page's declared language to pronounce its text correctly. A broken declaration like lang="" or lang="english" is worse than useless: the page appears to declare a language, but software cannot act on it, so pronunciation, translation offers, and spellchecking all fall back to guesswork.

This is success criterion 3.1.1 (Language of Page), a requirement - part of the most basic conformance level.

How to fix it

Correct the lang attribute on the page's opening tag to a valid language code: a two or three letter language, optionally followed by a region.

<!-- Problem: empty and invalid declarations -->
<html lang="">
<html lang="english">

<!-- Fix: a well-formed language code -->
<html lang="en">
<html lang="en-US">

This is usually set once in your page template. Declaring the correct language also improves how Silktide tests your content - see how languages work.

How Silktide tests this

  1. Find the <html> element of each page.
  2. Examine its lang attribute, and its xml:lang attribute if present.
  3. Report an attribute that is present but empty.
  4. Report an attribute whose value is not well-formed: the language part must be 2 or 3 letters (such as en or fr), and any region part that follows must be 2 or 3 letters (such as US or GB).
  5. Pages with no language attribute at all are covered by the separate Page language check.

Troubleshooting

My language tag is valid but was reported

Silktide validates the language and region parts of the tag. Rarer forms of valid tag, such as those with a four-letter script code like zh-Hans, can be reported even though they are technically valid. If you confirm your tag is correct, the finding.

Learn more

Last updated

Was this page helpful?

Invalid language for page | Silktide Help