Mobile
State what language your site is written in
Your page never says which language it is written in, so every tool that reads it has to guess.
Why it matters
The language of a page is set in one attribute at the very top of the file. Without it, search engines can show your page to people searching in a different language, a screen reader may read your English content with the wrong pronunciation, and browsers offer to translate pages that are already in the right language. This is also the one accessibility rule every audit checks, because a visitor who cannot see the page needs to be told what language to expect.
How you would notice it
- A browser offers to translate your page even though it is already in the right language.
- Search engines show your pages to people searching in another language.
- A visitor using a screen reader hears your content pronounced oddly.
What to do
Stage 1
- Open the file that holds the top of every page. In most site builders this is a single layout or theme file; in a hand-built site it is index.html.
- Find the opening html tag at the very top of that file and add a lang attribute.
A regional variant is also accepted, such as en-US or en-GB, if your audience is country specific.
<html lang="en">Stage 2
- Use the two letter code for your language. English is en, Spanish is es, French is fr, German is de.
A wrong code is worse than none at all: it tells a screen reader to use the wrong pronunciation rules on every page.
<html lang="en">
<body>
...
</body>
</html>Stage 3
- If your site mixes languages, such as an English page with a French section, mark only that section.
Leave the whole page set to the main language and mark the exceptions inside it.
<p lang="fr">Bonjour et bienvenue. Appelez-nous pour un devis gratuit.</p>How to check it worked
Confirm it worked
Open your site and use View Source. The first html tag should show your language code. Then re-run the Siege Test and confirm the Document language check turns green.