Guide 5 min read

Fix Incorrect Language Declaration

How to correct faulty lang attributes and hreflang tags on your website. Step-by-step guide for single-language and multilingual sites.

When search engines or screen readers misinterpret the language of your website, the culprit is almost always incorrect or conflicting HTML attributes. This guide walks you through fixing the problem systematically.

What the Error Report Shows You

The analysis lists the following information about your page:

  • Language: The language declared in the lang attribute • Country: The country code from the lang attribute • Detected Language: The language the crawling tool actually identified • Language Conflict: Flags discrepancies between the declared and detected language

A conflict occurs when the HTML attribute specifies a different language than the actual page content suggests.

Technical Background: Understanding HTML Language Attributes

The lang Attribute in the HTML Tag

The lang attribute is set in the opening <html> tag and defines the primary language of a page:

<html lang="en">

or with a country code:

<html lang="en-US">

This attribute is primarily relevant for screen readers and browsers. Google ignores it when determining language and analyzes the content directly instead.

The hreflang Attribute for Multilingual Websites

For international websites with multiple language versions, use hreflang. It signals to search engines which language version is intended for which users:

<link rel="alternate" hreflang="de" href="https://example.com/de/" />
<link rel="alternate" hreflang="en" href="https://example.com/en/" />

Google evaluates hreflang to direct users to the appropriate language version. Faulty implementations lead to incorrect index assignments.

Common Causes of Language Conflicts

Incorrectly Set lang Attribute

The lang attribute does not match the page content. Example: A German-language page has lang="en" in the HTML tag.

Fix: Open the affected page’s source code and correct the attribute in the <html> tag.

Mixed Content on a Single Page

The page contains text in multiple languages without clear structure. Crawlers cannot determine the primary language unambiguously.

Fix: Keep languages cleanly separated. Use the lang attribute on individual foreign-language sections:

<p lang="de">Dieser Absatz ist auf Deutsch.</p>

Missing or Generic lang Attribute

The lang attribute is completely absent or set too broadly (e.g., only lang="x-default").

Fix: Always set a language-specific lang attribute. For English-language pages: lang="en" or lang="en-US".

Faulty hreflang Implementation

On multilingual websites, hreflang references are misconfigured, incomplete, or contradictory.

Fix: Check all hreflang tags for:

  • Completeness (every language version must reference all others, including itself) • Correct language codes (ISO 639-1 for language, ISO 3166-1 Alpha-2 for country) • Bidirectional confirmation (page A references B, page B references back to A) • Valid URLs (all hreflang URLs must be reachable)

Step-by-Step Fix

Step 1: Identify the Source of the Error

Open the affected page and check the source code (right-click → “View Page Source”).

Look for: • <html lang="..."><link rel="alternate" hreflang="..." href="..." />

Compare the values against the actual page content.

Step 2: Correct the lang Attribute

Update the lang attribute in your website’s HTML template. The process varies by CMS:

CMS/SystemWhere to ChangeWordPressTheme header (header.php) or theme settingsTypo3TypoScript template (`config.htmlTag_langKey`)ShopwareTheme configuration or Twig templateCustom HTMLDirectly in the `<html>` tag on each page

Set the attribute precisely: • English-language page for the US: lang="en-US" • English-language page for the UK: lang="en-GB" • German-language page for Germany: lang="de-DE"

Step 3: Implement or Correct hreflang Tags

For multilingual websites, add hreflang tags in the <head> section of each language version:

<link rel="alternate" hreflang="de" href="https://example.com/de/" />
<link rel="alternate" hreflang="en" href="https://example.com/en/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />

Alternatively, you can implement hreflang via the XML sitemap or HTTP headers.

Important: Every language version must reference all other versions, including itself.

Step 4: Validate Your Implementation

Use these tools to verify:

  • W3C Validator: Checks HTML validity including the lang attribute • Google Search Console: Shows hreflang errors in the “International Targeting” report • Hreflang Checker Tools: Specialized tools such as Merkle Hreflang Checker or Ahrefs Site Audit

Step 5: Trigger Re-Indexing

After making corrections:

  1. Submit the affected URLs to Google Search Console for re-indexing
  2. Update your XML sitemap
  3. Monitor progress over 2–4 weeks

Google needs time to process the changes and update its index.

Edge Cases and Advanced Configurations

Regional Variants of a Language

If you offer English-language content for multiple markets (US, UK, Australia), use country codes:

<link rel="alternate" hreflang="en-US" href="https://example.com/us/" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/gb/" />
<link rel="alternate" hreflang="en-AU" href="https://example.com/au/" />

x-default for Multilingual Home Pages

The x-default hreflang defines a fallback page for users whose language is not specifically served:

<link rel="alternate" hreflang="x-default" href="https://example.com/" />

Set x-default to a language selection page or the primary version of your website.

Dynamic Content and JavaScript Rendering

For JavaScript-based websites (React, Vue, Angular), the lang attribute must already be present in the initially delivered HTML. Set it in server-side rendering or in the static HTML shell.

Why Google Ignores the lang Attribute

Google analyzes the actual text content of a page to determine its language. The lang attribute is not taken into account because it is too frequently set incorrectly.

Nevertheless, the attribute remains important for:

  • Accessibility: Screen readers use lang attributes to ensure correct pronunciation • Browser features: Automatic translation suggestions are based on the lang attribute • Other search engines: Not all crawlers ignore the attribute

For SEO, what matters most is: clean language versions with correct hreflang and consistent content.

Monitoring and Ongoing Checks

Review regularly:

  1. Google Search Console: “International Targeting” section for hreflang errors
  2. Crawling Tools: Screaming Frog, Sitebulb, or Ryte identify language conflicts
  3. Manual Spot Checks: Open key pages and verify both source code and rendering

Set up alerts for new errors as they appear. Exercise extra caution after website relaunches or template changes.

Summary

  • Set the lang attribute in the <html> tag for accessibility and browser compatibility • Implement hreflang tags correctly and completely for multilingual websites • Identify language conflicts systematically through source code review • Validate using W3C Validator and Google Search Console • After corrections, actively trigger re-indexing and monitor results

Correct language declaration is the foundation of international SEO and accessible websites. Investing time in a clean implementation pays off in the long run.

Need help with the implementation?

As an SEO freelancer with over 20 years of experience, I help you implement technical SEO professionally — fair, direct, and without long-term contracts.

Christian Synoradzki

Über den Autor

Christian Synoradzki

SEO-Freelancer

Mehr als 20 Jahre Erfahrung im digitalen Marketing. Fairer Stundensatz, keine Vertragsbindung, direkter Ansprechpartner.