squirrelscan
GitHub

Internationalization audit rules: hreflang and lang

Audit rules for multilingual sites: the lang attribute on the html element, and hreflang tags with x-default and a self-reference.

Internationalization rules cover two declarations. The lang attribute on the html element says what language this page is in, which a screen reader uses to pick a voice. The hreflang tags say which other language or region versions exist, which is what stops them competing with each other in search. Both are cheap to get right and quietly wrong on a lot of sites.

Run only these rules

squirrel audit https://example.com --rule-include i18n

Where to start

These carry the highest severity and weight in the category.

Rules

RuleWhat it flagsSeverityScope
hreflang: x-default and the self-referencing taghreflang tells search engines which language version to show. squirrel checks for x-default and a self-reference on any page that has them.infoPer-page
lang attribute on <html>: declaring the page’s languageWithout a lang attribute a screen reader guesses which voice to use and may read the page in the wrong language. squirrel checks it and its format.warningPer-page

Key terms

  • hreflang: Link annotations that tell search engines which language or regional versions of a page exist, with x-default as the fallback.
  • lang attribute: The lang attribute on <html> (and on passages) that declares the language, so screen readers pick the right voice.

Accessibility checks that the lang value is a valid language code, that lang on passages is valid, and that lang and xml:lang agree.

Learn more

Disable all Internationalization rules

[rules]
disable = ["i18n/*"]

Type to search…

↑↓ navigate↵ openesc close