The rule: English stays where it was
English pages keep their root addresses: /pricing is still /pricing. Spanish goes under /es and Brazilian Portuguese under /pt. There's no [locale] segment above every page, so nothing that already ranked or was linked had to move.
Two more rules came with it. We never redirect by the browser's language: the header has a language switch and the pages carry hreflang. And prices stay in US dollars in every language, written "USD 1,500" outside English, in each language's number format.
export const LOCALES = ["en", "es", "pt"] as const;
export function localePath(path: string, locale: Locale): string {
if (locale === DEFAULT_LOCALE) return path;
return path === "/" ? `/${locale}` : `/${locale}${path}`;
}One route group, and one root layout, per language
Next.js lets a route group have its own root layout. We have three for the public site: app/(site) for English, app/(es)/es and app/(pt)/pt. Each renders the page shell with its own locale, so <html lang> is right on every page: en, es or pt-BR.
The route files are thin. A page is a component in components/pages/ that takes a locale, and each route file only renders it with its language and its metadata.
// app/(es)/es/pricing/page.tsx
export const metadata: Metadata = pageMetadata("/pricing", "es");
export default function Page() {
return <PricingPage locale="es" />;
}Words in dictionaries, content in typed files
Interface words (menus, buttons, headings, form errors) live in one JSON file per language. en.json is the reference. If es.json or pt.json is missing a key, the typecheck fails; if one has an extra key, our check does. The typecheck catches the missing words; the check catches the extra ones and the missing pages. Each of the three has the same 419 message keys.
Running copy, like the services and the method, lives in lib/content.ts with translation files that hold only words. Ids, stacks, sources and prices come from the English file, so a translation can't drift from them.

- languages, each its own route group
- 3
- message keys in each language's dictionary
- 419
Telling search engines which page is which
Every page that exists in more than one language lists all its versions in its metadata, and x-default points to the English one. The sitemap lists each version too, each entry naming the others. Google's guide asks for that: each version lists itself and all the others, and a link must be returned, or the annotations may be ignored.
A code that isn't supported
We write numbers for Latin American Spanish with es-419, but the hreflang and <html lang> value is plain es: Google says codes like es-419 aren't supported there. Portuguese uses pt-BR. The two live apart in LOCALE_INFO, one field for the tag and one for how numbers are written.
One list says which pages exist in which language
Not every page is translated, and that's deliberate. The legal pages stay in English, the long guides are adapted one at a time, and the blog exists in English and Spanish. One function, availablePaths(locale), says what each language has. The language switch, the hreflang links, the sitemap and every internal link read it, so they can't disagree.
| English | 29 pages |
|---|---|
| Spanish | 20 pages |
| Portuguese | 13 pages |
When a visitor switches language on a page the target doesn't have, the switch sends them to that language's home page instead of a 404. Links from a translated page to an English-only one go to the English page, and the interface says so.
const has = (other: Locale) =>
available[other].includes(path) || prefixes[other].some((prefix) => path.startsWith(prefix));
// ...
href={localePath(current || has(other) ? path : "/", other)}A check keeps the languages in step
Three things run in CI. The typecheck fails when a dictionary misses a key. npm run check:i18n fails when a dictionary has a key en.json doesn't, and when a page that availablePaths says a language has has no route in that language's group. And npm run check:seo measures every title and description in every language, because a translation runs longer.
The typecheck catches the missing words; the check catches the extra ones and the missing pages.
Adding a fourth language is mechanical: add it to LOCALES and to the few words code puts around prices, write its dictionary and content file, and copy a route group; the checks list what you forgot.
What this gets you
- English addresses never change, so nothing already indexed moves.
- The language is right in the HTML of every page, not set later by script.
- The list of pages per language lives in one place, and CI fails when it drifts.
- Translating a page takes a route file and some words.
If you're planning a site for more than one market, see what fits or send us a brief. A person reads it.


