SEO · Checked once per domain
Language declaration (lang attribute)What it checks and how to fix it
What it checks
Reads the lang attribute of the home page's <html> element. Fails when it is missing or empty, warns when it is not a valid BCP 47 language tag (for example en-UK instead of en-GB), and passes when it is valid.
Why it matters
Screen readers use the lang attribute to choose a pronunciation; without it they read the page with the user's default voice, which garbles any other language. Browsers use it to offer translation and hyphenate text, and search engines as one signal of who the page is for. Its absence is a WCAG 3.1.1 failure.
How to fix it
Declare the page's language on the root element with a valid BCP 47 tag: an ISO 639-1 language code, optionally
followed by an ISO 3166-1 region code.
<!DOCTYPE html>
<html lang="en-GB">
In a Rails layout, follow the current locale:
<html lang="<%= I18n.locale %>">
Mark passages in another language with their own lang, for example <blockquote lang="fr">.