A site of mine sat online for months in four languages. Search Console showed one.
It was not a penalty. It was not thin content, and it was not a shortage of inbound links. All four versions existed, the copy was translated, and the language switcher in the header worked every time I clicked it. To Google, that site still spoke a single language.
It took me longer than I would like to admit to find out why, because the mistake was not in anything I had read about SEO. It was in one line of JavaScript I had written months earlier without a second thought.
This piece is about that line and the other decisions that determine whether a multilingual site gets indexed whole or in quarters. The examples are React i18n and Next.js because that is where I work, but the reasoning holds for Astro, Nuxt or Rails. The search engine has no idea which framework you used. It only sees the HTML that arrived.
The Symptom: Four Languages, One Set of Results
Diagnosis starts in Search Console, under Performance, filtered by page. If your site ships four languages and the list of pages with impressions only contains addresses from one of them, you already have your answer.
The second clue is the count. Say you published forty pages: ten articles in four languages. The indexing report shows ten. Not eleven, not thirty-eight. Exactly a quarter. That clean fraction is not a coincidence, it is the signature of this problem.
The third clue is the bluntest. Paste the URL of a translated page into URL Inspection. When Google says the page is unknown, it is not being coy. It has never found that address, often because that address does not exist.
What an I18n Library Solves, and What It Does Not
Before blaming the tool, it helps to pull apart two things that usually get lumped together.
Translation is the problem of picking the right sentence for each language. Libraries like react-i18next, next-intl and react-intl (from FormatJS) handle it: where strings live, interpolation, plurals, dates and numbers. A good chunk of that work is not even theirs. Dates, numbers, currency and plural selection come from JavaScript's built-in Intl APIContract that defines how one program asks another for data or actions: which endpoints to call, what to send and what comes back. On the web, usually HTTP with JSON. (MDN), which sits on Unicode CLDR data. That is why English has two plural forms and Arabic has six: the categories zero, one, two, few, many and other are defined in CLDR, and the message syntax most libraries accept is ICU MessageFormat.
Addressing is a different problem. No translation library decides on its own whether /pt/blog exists, writes your hreflang tags, or makes sure the language switcher is a real link. Some, like next-intl, help with routing if you set it up. The responsibility still sits with your application.
Mixing the two up is how a team ends up saying "our site has i18n" while three quarters of it is invisible in search. Having i18n set up is necessary and not enough: the text is translated, and nobody can reach it.
The Crawler Does Not Click Your Switcher
This is the point that trips up almost everyone, me included.
A browser with a person behind it is a rich environment. It has navigator.language, it has localStorage, it has someone willing to click and wait for the screen to change. A crawler has none of that. It requests a URL, reads the HTML, renders the JavaScript when it can, and follows the links it finds. Google is blunt about which links count: only <a> elements with an href attribute (Google Search Central, crawlable links).
So if the page language lives in React state, the crawler sees the initial value. Every time. A useState('en') is en for Googlebot on every visit. What it indexed was not the English version out of preference. It was the only version that existed from where it stood.
Which leads to the consequence that solves the whole mystery: one URL does not rank in four languages. There is one address, so there is one thing to index. The other three translations did not lose the contest. They never entered it.

The Reciprocity Rule Nobody Quotes
Say each language already has its own URL. The next step is telling the search engine those pages are the same thing in different languages. That is what hreflang does: it lists the localized versions of a page. It can live in the <head>, in an HTTP header or in the sitemapFile, usually XML, that lists the URLs of a site with their update dates, helping search engines discover and crawl the pages..
<link rel="alternate" hreflang="en" href="https://example.com/blog/post" />
<link rel="alternate" hreflang="pt-BR" href="https://example.com/pt/blog/artigo" />
<link rel="alternate" hreflang="es" href="https://example.com/es/blog/articulo" />
<link rel="alternate" hreflang="x-default" href="https://example.com/blog/post" />Google's documentation has a condition that slips past on a quick read: if two pages don't both point to each other, the tags are ignored (Google Search Central, localized versions). The reason is sound. Without that rule, any site could declare itself a translation of yours.
In practice, reciprocity breaks for a dull reason. Each language has its own slug, because translating the URL is part of the job. The alternates for the English page get built from one source, the Portuguese page's from another, and the two disagree. Each version announces a different set.
What I do is keep a single function that returns the full set of alternates and call it on all four pages. If every version derives from the same list, they cannot drift apart. That function follows three rules, all from the same Google page:
- URLs are absolute, with
https://and the domain. A bare/pt/blogdoes not count. - The page lists itself, with its own language.
- There is an
x-default, which is where anyone who speaks none of the options lands.
The codes follow BCP 47: a lowercase language, an optional region after the hyphen, as in pt-BR or fr-CA. The W3C has a short guide to language tags that is worth five minutes.
Where Each Language Lives
There are three ways to give each language its own address, and Google compares them in managing multi-regional and multilingual sites.
A country domain (example.co.uk, example.fr) is the strongest geographic signal. It is also the most expensive: one domain per market, and the authority each one earns does not add up with the others. It makes sense when you run a real operation in each country.
A subdomain (pt.example.com) sits in the middle. Easy to host somewhere else, weaker as a geographic signal.
A subdirectory (example.com/pt/) is the default for nearly everyone, and it is mine. One domain, one pool of authority, and a link someone gives the French version helps the whole site. If you do not have a marketing team per country, this decision is already made.
A URL Prefix Is Not a Language Code
This looks like a small detail until it breaks.
The prefix in the URL and the code in hreflang are different things. Nobody wants to read /pt-BR/blog in the address bar, but the search engine needs to know it is Brazilian Portuguese and not European. And the default language usually has no prefix at all: the site root already is it.
So the conversion is not string concatenation. It is a map, and it deserves to live in one file:
export const localePrefix = {
en: '',
'pt-BR': 'pt',
es: 'es',
fr: 'fr',
} as const;
export function localizedPath(path: string, locale: Locale): string {
const prefix = localePrefix[locale];
return prefix === '' ? path : `/${prefix}${path}`;
}Every time I have seen that map scattered across a codebase, the English page ended up with an hreflang pointing at /en/blog, an address that does not exist. The annotation points at a 404, reciprocity breaks, and the whole pair gets dropped.
In Next.js with the App Router, the same map feeds generateMetadata, which takes alternates in alternates.languages and writes the <link rel="alternate" hreflang> tags into the HTML (Next.js docs):
export async function generateMetadata({ params }): Promise<Metadata> {
const { locale, slug } = await params;
return {
alternates: {
canonical: absoluteUrl(locale, slug),
languages: alternatesFor(slug), // the same function on all four pages
},
};
}The Language Switcher Has to Be a Link, Not a Button
Here is the line that cost me months.
// The crawler sees nothing here. There is no address to follow.
<button onClick={() => setLocale('pt-BR')}>Português</button>// Now there is an address, and it is in the HTML.
<Link href="/pt/blog/artigo" hrefLang="pt-BR" lang="pt-BR">
Português
</Link>The difference is not cosmetic. Without <a href> in the HTML, there is no path from the crawler to the translated version, and your hreflang tags describe pages it cannot reach by navigating.
One thing that catches people: router.push() inside an onClick does not fix it either. Programmatic navigation leaves nothing in the HTML. Next's <Link> works because it renders a real anchor with a real href and only intercepts the click afterwards.
The test takes ten seconds:
curl -s https://example.com/blog/post | grep -o 'href="[^"]*/pt/[^"]*"'If nothing comes back, your switcher is invisible.
Redirecting by Browser Language Hides Content
The temptation is real: read the Accept-Language header and send every visitor straight to their language.
My rule has two parts. A URL with an explicit prefix is never redirected, because whoever opened /pt/blog already said what they want. And at the root, instead of redirecting, I show a quiet banner with a real link to the detected language. Suggesting costs one click from someone who was already in the right place. Forcing costs three quarters of the site.
If you insist on redirecting, store the choice and respect it. Redirecting someone who just switched language by hand is the fastest way to get them to close the tab.
Canonical, Sitemap and How to Actually Verify
In the sitemap, either declare the alternates with xhtml:link on each entry, or keep them only in the <head>. What matters is not having two sources saying different things.
Two more warnings that save time. The lang attribute on <html> helps screen readers and machine translation, but Google uses neither it nor hreflang to detect a page's language: it reads the text. And the International Targeting report in Search Console, where every old tutorial tells you to look, has been deprecated. Google still uses hreflang; the screen is just gone. What is left is testing what the crawler actually gets:
# 1. Are the alternates in the raw HTML, before any JavaScript?
curl -s https://example.com/pt/blog/artigo | grep hreflang
# 2. Does the translated text arrive from the server, or only after hydration?
curl -s https://example.com/pt/blog/artigo | grep -c "a word that only exists in Portuguese"
# 3. What does the search engine already know about each language?
# Search on Google: site:example.com/ptThe third is the most honest. It tells you how many pages in each language made it into the index, not how many you think you published.
The Checklist
This is the order I fix things in, and it works for any React i18n stack or outside React.
- Each language has its own URL, served already translated by the server
- The language switcher renders
<a href>in the HTML, notonClick hreflangtags are reciprocal, absolute and include the page itself- There is an
x-defaultpointing at the entry language - The URL prefix and the
hreflangcode come from the same map - Each version's
canonicalpoints at itself - No URL with an explicit prefix is redirected by
Accept-Language - If the sitemap declares alternates, it agrees with the
<head>
What I wish I had understood earlier is that none of this is SEO fine-tuningFurther training of an existing model on your own examples to adjust style, format or specialty. It changes the model's weights, unlike just editing the prompt.. It is not bonus points on top of a site that already works. It is the difference between a multilingual site and a one-language site with three translations nobody can find. The SEO basics that apply to any site, including what changes with AI search, are in the SEO and GEO guide.
The good news is that the fix tends to be small. In my case it was a prefix map, an alternates function, and a <button> that became a <Link>. The hard part, translating everything, I had done months before.
FAQ
Why does Google only index one language of my React site?
Because, as far as it can tell, there is only one address. If the language changes through component state or localStorage, the URL is the same in every language, and the crawler always gets the initial one.
Do react-i18next or next-intl fix this on their own?
No. They handle translation. A URL per language, hreflang and a link-based switcher are routing, and they are your application's job, even when the library helps you set them up.
Do I need hreflang if every language already has a URL?
It is not required for indexing, but it is what tells Google the pages are versions of each other, so it can show each person the right one.
Is the lang attribute on <html> enough?
Not for Google. It detects language from the content and does not use lang for that. Keep lang anyway, for accessibility.
Can I redirect based on the browser language?
At the root, carefully, and remembering the choice. On a URL that already carries a language prefix, no: Googlebot does not send Accept-Language and would always land on the default version.
References
- Google Search Central. Tell Google about localized versions of your page. Reciprocity, absolute URLs, self-reference and
x-default. - Google Search Central. Managing multi-regional and multilingual sites. URL structures and why to avoid automatic redirects.
- Google Search Central. How Google crawls locale-adaptive pages. Googlebot crawls from the US and sends no
Accept-Language. - Google Search Central. Make your links crawlable. Only
<a>withhrefgets followed. - Search Console Help. The International Targeting report is deprecated.
- Next.js. generateMetadata and the alternates field.
- MDN Web Docs. Intl. JavaScript's built-in date, number and plural formatting.
- Unicode CLDR. Plural rules. The plural categories for each language.
- FormatJS. ICU MessageFormat syntax.
- W3C Internationalization. Language tags in HTML and XML. The BCP 47 standard.
Published in August 2026. Revised in October 2026 with references and Google's current guidance.