Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Wrong lang attribute (en on a French page): how to fix it

PRF-321Low impactOther toolBy FunnelGuardPublished Updated
On this page

What this issue is

The lang attribute sits on the opening <html> tag, for example <html lang="fr">. It declares the main language of the page. This issue happens when the declared language does not match the visible text, most often lang="en" left on a French page.

It usually comes from a theme or template built in English and then translated by hand or with a plugin, without the language setting being updated. WCAG 2.2 covers it under success criterion 3.1.1 (Language of Page). Criterion 3.1.2 (Language of Parts) covers passages in another language inside a page.

Why it costs you leads or sales

The impact is usually low, but real for some visitors. Screen readers choose a pronunciation voice from the lang value. French text read with English rules is hard to understand, so blind and low-vision visitors may leave before they reach your form or checkout.

Browsers also use the value. A wrong code can trigger a pointless translate prompt, or mess with hyphenation, quote styles and spell checking. Search engines mostly work out the language from the content itself, so treat this as an accessibility and quality fix rather than a ranking lever.

What a visitor experiences

lang="en" on a French page

  • Screen reader pronounces French words with English rules
  • Browser may offer to translate a page that is already French
  • Fails WCAG 3.1.1 in an accessibility audit

lang="fr" on a French page

  • Screen reader switches to a French voice
  • No false translate prompt
  • Passes the language-of-page check

How to check if your site has it

Check the lang value on a page
  1. View the page source

    Open the French page, right-click and choose View page source. Look at the first lines for the <html> tag.

  2. Or read it from the console

    Open DevTools, go to Console and run document.documentElement.lang. It returns the value the browser sees, including changes made by JavaScript.

  3. Compare with the visible text

    The value should match the main language of the page. Check each language version separately, as only some may be wrong.

  4. Run an accessibility checker

    Tools such as Lighthouse (in Chrome DevTools) or axe DevTools flag a missing or invalid lang. A well-formed but wrong value like en on French text may need your own eye, so also check pages by hand.

Console checkjavascript
console.log(document.documentElement.lang);
// Expected on a French page: "fr" (or "fr-FR", "fr-CA")

How to fix it

Use a valid language code from the BCP 47 standard: a two-letter language code, optionally with a region, such as fr, fr-FR, fr-CA or fr-BE. Set it per page, not once for the whole site, if you run several languages.

Set the correct lang by platform
  1. Set the site language

    Go to Settings > General > Site Language and choose Français. WordPress outputs language_attributes() in the theme, which prints lang="fr-FR".

  2. Check the theme header

    In header.php the tag should read <html <?php language_attributes(); ?>>. If a value like lang="en" is hard-coded, replace it with that call (use a child theme).

  3. Multilingual plugins

    If you use WPML, Polylang or TranslatePress, make sure the French language is set up with the right locale. These plugins change the lang value per page when the theme uses language_attributes().

Correct markuphtml
<!-- Main language of the page -->
<html lang="fr">

<!-- A passage in another language inside the page -->
<p>Notre slogan : <span lang="en">Just do it</span>.</p>

How to confirm it's fixed

Confirm the fix
  • document.documentElement.lang returns fr (or a fr-xx value) on French pages
  • English pages still return en
  • View source shows the right value, not only the rendered DOM
  • Lighthouse accessibility audit has no lang errors
  • A screen reader such as NVDA or VoiceOver reads the page with French pronunciation
  • Chrome no longer offers to translate the French page

How to prevent it happening again

Habits that keep lang correct
  • Add a lang check to your launch checklist for every new language version
  • Never copy an English template and translate only the text
  • Generate the value from the page language instead of hard-coding it
  • Run an accessibility scan after theme or plugin updates
  • Re-check the value after changing your multilingual plugin

How FunnelGuard handles this

This issue is outside what FunnelGuard checks. FunnelGuard runs your customer journeys (forms, checkouts, bookings), tracking hits and lead delivery on a schedule. It does not audit the HTML language attribute. The kind of tool that fits is an accessibility checker or code linter, such as Lighthouse, axe DevTools or WAVE, which read the page markup and test it against WCAG rules.

FunnelGuard is still useful for the revenue side of the same pages: it can tell you whether the French lead form still submits and the tracking still fires after you change templates.

Questions people ask

Why is my French page marked as English?

Your theme or template probably has lang="en" in the <html> tag, and the French content was added without updating it. Change it to lang="fr" in the theme or the site language setting.

What does the lang attribute do on an HTML page?

It tells browsers, screen readers and other tools what language the page is written in. Screen readers use it to pick the right voice and pronunciation, and browsers use it for translation prompts, spell checking and hyphenation.

How do I change the lang attribute in WordPress?

Go to Settings > General > Site Language and choose the language. The theme prints it through language_attributes() in the <html> tag. If the theme hard-codes lang="en", edit header.php in a child theme.

Does a wrong lang attribute hurt SEO?

Not directly in most cases, because search engines detect the language from the visible text. Use hreflang for language targeting. The wrong lang value is mainly an accessibility and user-experience problem.

Should I use fr or fr-FR in the lang attribute?

Both are valid. Use fr if the page suits all French speakers, and fr-FR, fr-CA or fr-BE if the wording is specific to a region. Pick one and use it consistently.

How do I mark a few English words on a French page?

Add lang="en" to the element that wraps those words, for example <span lang="en">Just do it</span>. The page lang stays fr, and screen readers switch voice for that passage.

Can FunnelGuard detect a wrong lang attribute?

No. This is outside what FunnelGuard checks. Use an accessibility tool such as Lighthouse, axe DevTools or WAVE to find it.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.