Translating AgendaViva into Spanish looks like a matter of changing text. As soon as you start, the questions are different: whether each language gets its own address, who chooses the language for someone arriving at /, how a component knows which language it's in, where the translations of what organizers write live, how you say "1 spot" and "2 spots" in a language with four plural forms. These are decisions about routes, caching and data, and they're made once.

Next.js provides the pieces: a dynamic segment, root params and proxy.ts. The translation itself isn't the framework's business. In this lesson you'll set up the public area in English and Spanish, without libraries, to understand what's underneath; at the end you'll see what a library solves.

  1. Scope: a separate branch

This change moves almost every route. So that you can study it without dragging it along, it's done on a branch of the project, and modules 10 and 11 continue in English, with the usual routes:

git switch -c languages     # When you finish the lesson, go back to your main branch

The functional scope is limited too, and that's the norm in a real project:

Area Translated? Reason
Home page, guide, event pages and venues Yes What a visitor sees
Booking Text yes; the account stays in English The minimum to complete the task
Dashboard and admin No It's used by local staff
v1 API No Its codes are identifiers, not text
Emails Not in this lesson They'd require storing each person's language

Every area you add costs translation forever: every new piece of text has to be written, reviewed and maintained in every language. It's the question worth asking before any technical one.

  1. Where the language goes

Strategy Example Assessment
A cookie only /events One address with two contents: it can't be shared, indexed or served from the shell
Prefix on all of them /en/events, /es/events Explicit; the folder matches the address
Prefix except for the main one /events, /es/events Keeps the addresses; requires rewriting in the proxy, prefetches included
Domains agendaviva.example, agendalive.example For organizations with a presence in each country

The first is ruled out by everything you've built: reading the cookie in the layout would leave the page without a shell. We choose the second. Its price is that the English addresses change, and that's paid for with redirects.

Language isn't country. es isn't a flag, and someone in London may read Spanish. Use language codes (en, es, ca) and add a region (en-GB) only if the content differs.

  1. The restructuring

The segment must be above the root layout, because <html lang> depends on it. And the areas that aren't translated need their own:

app/
├── [lang]/
│   ├── layout.tsx              Root layout: <html lang={lang}>
│   ├── not-found.tsx
│   └── (public)/               Home page, events and venues
├── (internal)/
│   ├── layout.tsx              Root layout: <html lang="en">
│   ├── (account)/              sign-in, sign-up
│   ├── (dashboard)/            dashboard, admin
│   └── (personal)/             my-bookings, account, with PublicLayout
├── api/  images/
├── global-error.tsx  global-not-found.tsx
└── favicon.ico  icon.svg  manifest.ts  robots.ts  sitemap.ts

app/layout.tsx no longer exists: there are two root layouts. That has three consequences:

  • Going from one to the other reloads the entire document. From /es/events to /sign-in there's no client-side navigation. Within each area, there is.
  • There's no layout for general 404s. app/not-found.tsx stops working. The intended piece is global-not-found.tsx, which writes its own document and is still experimental (experimental.globalNotFound). For the branch it's acceptable: a fixed page, in both languages.
  • [lang] captures anything. /whatever matches with lang = 'whatever'. It has to be rejected, and we'll do that in the proxy.

What's common to both roots (fonts, theme, globals.css, base metadata) is extracted so it isn't written twice: the body, into an HtmlDocument component, and the metadata, into a constant.

3.1. The vocabulary

// lib/i18n/languages.ts (neutral)
export const LANGUAGES = ['en', 'es'] as const
export type Language = (typeof LANGUAGES)[number]

export const DEFAULT_LANGUAGE: Language = 'en'
export const LANGUAGE_COOKIE = 'agendaviva-language'
export const LANGUAGE_NAMES: Record<Language, string> = { en: 'English', es: 'Español' }

export function isLanguage(value: string | undefined): value is Language {
  return LANGUAGES.some((language) => language === value)
}

export function localizePath(language: Language, path: string): string {
  return path === '/' ? `/${language}` : `/${language}${path}`
}

You'll see examples that check with value in dictionaries. It's a trap: 'constructor' in {} is true, so /constructor would pass as a language and fail further down. Compare against the list.

3.2. The root layout

// app/[lang]/layout.tsx
import { HtmlDocument } from '@/components/html-document'
import { isLanguage, DEFAULT_LANGUAGE, LANGUAGES } from '@/lib/i18n/languages'
import { lang } from 'next/root-params'
import '../globals.css'

export function generateStaticParams() {
  return LANGUAGES.map((value) => ({ lang: value }))
}

export default async function LanguageLayout({ children }: LayoutProps<'/[lang]'>) {
  const value = await lang()
  return <HtmlDocument lang={isLanguage(value) ? value : DEFAULT_LANGUAGE}>{children}</HtmlDocument>
}

next/root-params, stable since 16.3, exports one function for each dynamic segment that sits above the root layout, named after the folder: that's why it has to be a valid identifier, and [site-lang] wouldn't be. The difference from params is that it can be called from any Server Component or server function, without passing anything from hand to hand.

  • This await doesn't break the shell: the values are known through generateStaticParams. With Cache Components it's mandatory to provide at least one value for each root param.
  • It doesn't work in Client Components, Server Actions or Route Handlers. There, the language has to arrive some other way.
  • It does work inside 'use cache', and it becomes part of the entry's key.

Event pages are now generated per language: the generateStaticParams of events/[slug] runs once for each one, so the 50 become 100 and the build makes twice as many queries. With five languages you'd have to rethink the number (05-05).

  1. The text

One dictionary per language, in TypeScript, loaded only on the server:

// lib/i18n/dictionaries/en.ts
export const en = {
  home: { title: 'What’s on in Vallenar del Río', upcoming: 'Upcoming events' },
  guide: {
    title: 'Event guide',
    total: { one: '{n} event', other: '{n} events' },
    empty: 'No events match these filters.',
  },
  event: { canceled: 'This event has been canceled.', book: 'Book' },
  categories: {
    concert: 'Concert',
    theater: 'Theater',
    exhibition: 'Exhibition',
    workshop: 'Workshop',
  },
}

export type Dictionary = typeof en

// lib/i18n/dictionaries/es.ts
import type { Dictionary } from './en'

export const es: Dictionary = {
  home: { title: 'Qué hacer en Vallenar del Río', upcoming: 'Próximos eventos' },
  // … if a key is missing, or there's an extra one, it doesn't compile
}
// lib/i18n/server.ts
import { notFound } from 'next/navigation'
import { lang } from 'next/root-params'
import type { Dictionary } from './dictionaries/en'
import { isLanguage, DEFAULT_LANGUAGE, type Language } from './languages'

const LOADERS: Record<Language, () => Promise<Dictionary>> = {
  en: () => import('./dictionaries/en').then((mod) => mod.en),
  es: () => import('./dictionaries/es').then((mod) => mod.es),
}

export async function getLanguage(): Promise<Language> {
  const value = await lang()
  if (value === undefined) return DEFAULT_LANGUAGE // (internal) area
  if (!isLanguage(value)) notFound()
  return value
}

export async function getTexts(): Promise<Dictionary> {
  return LOADERS[await getLanguage()]()
}
// app/[lang]/(public)/page.tsx
export default async function HomePage() {
  const texts = await getTexts()
  return (
    <>
      <h1 className="text-3xl font-bold">{texts.home.title}</h1>
      <h2 className="mt-8 mb-4 text-xl font-semibold">{texts.home.upcoming}</h2>
      <UpcomingEvents />
      {/* … the events in your district, unchanged … */}
    </>
  )
}
  • The type comes from English. A key missing in Spanish is a compile error, not a gap on the page. What the type doesn't catch is a translation that was never done: that has to be reviewed.
  • Dictionaries don't reach the browser. Only the text already in place travels. next/root-params also acts as server-only: importing it from the client breaks the build.
  • With two root layouts, the type of lang() is string | undefined, because (internal) doesn't have that segment. Thanks to the default value, Header works in both areas without knowing which one it's in.
  • notFound() is called in getLanguage, which inner pages and layouts use, and not in the root layout: above it there's no not-found.tsx to show.
  • Complete sentences. Don't assemble "Only" + n + "spots left": word order changes between languages. Use placeholders.

4.1. Client Components

A client component receives the text it needs, through props, not the dictionary:

<FavoriteButton eventId={event.id} title={event.title} texts={texts.favorites} />

Only strings and objects: a function from the dictionary can't cross over (03-03), and that's why the placeholders are {n} and not (n) => …. If many deeply nested islands need text, a context with part of the dictionary avoids repeating it (03-04). Passing the whole thing would put everything written on the site into every page.

4.2. Server Actions and messages

An action can't read the root param. There are two solutions. The first is to pass it the language with bind, and validate it like any data coming from outside. The second, and better, is for it to return not sentences but keys, and have whoever renders them translate them:

// Before
return { status: 'error', message: 'There aren’t enough spots left.', … }
// On the branch
return { status: 'error', reason: 'not-enough-spots', spotsLeft: 2, … }

It's what we did with flash messages in 06-04: the cookie stores a key, and today you see another of its reasons. The v1 API follows the same criterion: code is stable and message, indicative. For Zod errors, the schemas return keys instead of sentences.

  1. Dates, numbers and plurals

Intl is in the browser and in Node.js, and it knows each language's rules. You don't have to translate the months.

// lib/i18n/format.ts
import type { Language } from './languages'

const REGIONS: Record<Language, string> = { en: 'en-GB', es: 'es-ES' }

function perLanguage<T>(create: (region: string) => T): Record<Language, T> {
  return { en: create(REGIONS.en), es: create(REGIONS.es) }
}

const DATE_TIME = perLanguage(
  (region) =>
    new Intl.DateTimeFormat(region, {
      weekday: 'long', day: 'numeric', month: 'long',
      hour: '2-digit', minute: '2-digit',
      timeZone: 'Europe/Madrid', // Doesn't depend on the language
    }),
)
const NUMBER = perLanguage((region) => new Intl.NumberFormat(region))
const PLURAL = perLanguage((region) => new Intl.PluralRules(region))

export function formatDateTime(date: Date, language: Language): string {
  return DATE_TIME[language].format(date)
}

export function interpolate(template: string, values: Record<string, string | number>): string {
  return template.replace(/\{(\w+)\}/g, (match, key: string) =>
    Object.hasOwn(values, key) ? String(values[key]) : match,
  )
}

type Forms = Partial<Record<Intl.LDMLPluralRule, string>> & { other: string }

export function choosePlural(language: Language, n: number, forms: Forms): string {
  const form = forms[PLURAL[language].select(n)] ?? forms.other
  return interpolate(form, { n: NUMBER[language].format(n) })
}
en-GB es-ES
formatDateTime Friday 12 May at 20:30 viernes, 12 de mayo, 20:30
NUMBER with 12345.6 12,345.6 12.345,6
choosePlural with 1 and 2 1 event, 2 events 1 evento, 2 eventos
  • The time zone is still Vallenar's, in any language: the concert takes place there.
  • Plain en uses the United States format, with the month first and a twelve-hour clock. For our audience, en-GB is easier to understand.
  • Plural isn't n === 1. Spanish also has a many form, for "un millón de eventos", Polish has four in total and Japanese just one. Intl.PluralRules knows which one applies, and ?? forms.other covers the ones you haven't written.
  • Formatters are created once, in the module: they're expensive and don't store anything about anyone.
  • There's also Intl.RelativeTimeFormat ("tomorrow"), Intl.ListFormat ("Downtown, Riverside and Northside") and Intl.Collator for sorting.

  1. Who chooses the language

The address rules: /es/events is Spanish, whoever comes. You only have to decide on /, which has no language. The order is: what the person chose (cookie), what their browser asks for (Accept-Language), the default language.

// lib/i18n/negotiate.ts
import { isLanguage, DEFAULT_LANGUAGE, type Language } from './languages'

// 'ca,es;q=0.9,en;q=0.8' → 'es'
export function negotiateLanguage(header: string | null): Language {
  const preferred = (header ?? '')
    .slice(0, 500)
    .split(',')
    .map((part) => {
      const [tag, ...params] = part.trim().toLowerCase().split(';')
      const weight = params.map((p) => p.trim()).find((p) => p.startsWith('q='))
      return { language: tag.split('-')[0], weight: weight ? Number(weight.slice(2)) : 1 }
    })
    .filter(({ weight }) => weight > 0)
    .sort((a, b) => b.weight - a.weight)
    .map(({ language }) => language)

  return preferred.find(isLanguage) ?? DEFAULT_LANGUAGE
}

It only compares the main part (es-MX is es) and discards zero or unreadable weights. With regional variants the rules get more complicated, and it's better to use @formatjs/intl-localematcher with negotiator, which is what the documentation suggests.

The existing proxy (07-02 and 08-04) grows in three places:

// proxy.ts (changes on the branch)
const NO_PAGE_PATH = '/no-page/path' // With a single segment it would match [lang]
const NO_LANGUAGE = new Set([
  'api', 'dashboard', 'admin', 'sign-in', 'sign-up', 'my-bookings', 'account',
])

// Inside proxy(), after maintenance
const first = pathname.split('/')[1]
if (!first) return redirectToLanguage(request)
if (!isLanguage(first) && !NO_LANGUAGE.has(first)) {
  return NextResponse.rewrite(new URL(NO_PAGE_PATH, request.url))
}

// … the private area, same as in 08-04 …

const match = /^\/(en|es)\/events\/([^/]+)$/.exec(pathname)
// … and the earlier logic with match[2]; the lowercase redirect keeps match[1]

function redirectToLanguage(request: NextRequest): NextResponse {
  const remembered = request.cookies.get(LANGUAGE_COOKIE)?.value
  const destination = request.nextUrl.clone()
  destination.pathname = `/${
    isLanguage(remembered) ? remembered : negotiateLanguage(request.headers.get('accept-language'))
  }`
  const response = NextResponse.redirect(destination, 307)
  response.headers.set('Vary', 'Accept-Language, Cookie')
  return response
}
  • Negotiation only happens on /, and with a 307. A permanent redirect would pin the language in the browser.
  • Anyone already in a language isn't redirected. If someone shares /es/…, it must be shown in Spanish. Redirecting based on the browser would also prevent search engines, which usually crawl with no preference or in English, from seeing the other versions.
  • The cookie is validated: anyone can edit it.
  • An unknown first segment is a 404, without ever reaching [lang]. The NO_LANGUAGE list has to be maintained when you add routes or files in public/, which also go through the matcher; a test (10-04) can go through them so nobody forgets.
  • /dashboard still requires the same. The language doesn't change authorization, which lives in the data.

The old addresses are fixed and don't need code:

// next.config.ts, inside redirects()
{ source: '/events/:path*', destination: '/en/events/:path*', permanent: false },
{ source: '/venues/:path*', destination: '/en/venues/:path*', permanent: false },
{ source: '/whats-on/:slug', destination: '/en/events/:slug', permanent: true }, // No chain

Temporary until you're sure, and permanent afterwards (07-02). Internal links carry the prefix through localizePath, so they don't depend on the redirect on every click; and watch out for paths written inside components, of which there are many: createEventsUrl, EventCard, Pagination.

6.1. The switcher

// components/language-switcher.tsx
'use client'

import Link from 'next/link'
import { usePathname, useSearchParams } from 'next/navigation'
import { LANGUAGE_COOKIE, type Language, LANGUAGES, LANGUAGE_NAMES } from '@/lib/i18n/languages'

function remember(language: Language): void {
  document.cookie = `${LANGUAGE_COOKIE}=${language}; path=/; max-age=31536000; samesite=lax`
}

export function LanguageSwitcher({ current }: { current: Language }) {
  const rest = usePathname().replace(/^\/[^/]+/, '')
  const query = useSearchParams().toString()

  return (
    <ul className="flex gap-3">
      {LANGUAGES.map((language) => (
        <li key={language}>
          <Link
            href={`/${language}${rest}${query && `?${query}`}`}
            hrefLang={language}
            lang={language}
            aria-current={language === current ? 'true' : undefined}
            onClick={() => remember(language)}
          >
            {LANGUAGE_NAMES[language]}
          </Link>
        </li>
      ))}
    </ul>
  )
}

They're links: they work without JavaScript, can be opened in another tab and search engines follow them. Each name is in its own language ("Español", not "Spanish"), with lang so a screen reader pronounces it correctly, and without flags. It leads to the same page with the same filters. The hooks require <Suspense> (02-03), with two links to the home pages as the fallback. The cookie is a preference with no value to an attacker, so the browser can write it.

  1. Search engines

Each version must declare the others with hreflang. The rules most often broken: addresses are absolute, the list includes the page itself, and it's reciprocal; if one doesn't point to the other, it's ignored.

// lib/metadata.ts (on the branch, createMetadata also receives the language)
const OG_LOCALE: Record<Language, string> = { en: 'en_GB', es: 'es_ES' }

function alternates(language: Language, path: string): Metadata['alternates'] {
  const versions = Object.fromEntries(LANGUAGES.map((other) => [other, localizePath(other, path)]))
  return {
    canonical: localizePath(language, path),
    languages: {
      ...versions,
      'x-default': path === '/' ? '/' : localizePath(DEFAULT_LANGUAGE, path),
    },
  }
}
  • canonical is the page's own version, never the English one: the Spanish one isn't a copy.
  • x-default is where to send anyone who doesn't fit any of them; for the home page, the address that negotiates.
  • In the sitemap, each entry carries the same ones in alternates.languages, with absolute addresses. One of the two methods is enough; using both forces you to keep them identical.
  • generateMetadata can call getTexts, but opengraph-image.tsx, which is a special Route Handler, can't: it receives the language through params.
  • inLanguage in the JSON-LD, if the event takes place in a specific language. It's the event's language, not the page's.

Don't publish a half-finished version. A page "in Spanish" with a translated menu and English content, indexed as Spanish, is worse than not having it at all.

  1. Database content

Dictionaries cover the interface. Titles and descriptions are written by organizers, and they have to be stored:

Design For Against
Columns title_en, title_es Simple Every language is a migration
One JSON column per text Flexible Harder indexes and constraints
A translations table Adding languages without migrating; all or nothing per language One more join
One record per language Independent Duplicates dates, spots and bookings: unacceptable here

For AgendaViva, the third. English stays in events and the rest is optional:

// lib/db/schema.ts (branch)
export const eventTranslations = pgTable(
  'event_translations',
  {
    eventId: text('event_id').notNull().references(() => events.id, { onDelete: 'cascade' }),
    language: text('language').notNull(),
    title: text('title').notNull(),
    summary: text('summary').notNull(),
    description: text('description').notNull(),
  },
  (table) => [primaryKey({ columns: [table.eventId, table.language] })],
)
// lib/data/events.ts (branch): getEventDetails(slug, language)
const t = eventTranslations

const [details] = await db
  .select({
    event: {
      ...getTableColumns(events),
      title: sql<string>`coalesce(${t.title}, ${events.title})`,
      summary: sql<string>`coalesce(${t.summary}, ${events.summary})`,
      description: sql<string>`coalesce(${t.description}, ${events.description})`,
    },
    venue: venues,
    translated: sql<boolean>`${t.language} is not null`,
  })
  .from(events)
  .innerJoin(venues, eq(events.venueId, venues.id))
  .leftJoin(t, and(eq(t.eventId, events.id), eq(t.language, language)))
  // … where and limit, unchanged
  • The language is an argument, and that way it becomes part of the cache key. It could be read with lang() inside the function, but then Route Handlers and tasks couldn't use it.
  • The tag doesn't change. event:slug is on both entries: one edit invalidates both.
  • If there's no translation, the English text is shown, saying so, and marked with lang="en", so that screen readers and translation tools handle it properly. And that version carries noindex, or its canonical points to the English one.
  • The slug is the same in both languages. Translating it improves the address a little and forces you to resolve it per language in the proxy, the switcher and the links.

Machine translation can fill the table, with a review before publishing and a flag that says so. Personal data isn't sent to an external service without a legal basis.

  1. A library

All of the above is about two hundred lines, and it covers two languages with simple text. The most widespread alternative in the App Router is next-intl, in its version 4:

By hand next-intl
Text on the server getTexts() getTranslations, useTranslations
Plurals and gender in a message choosePlural ICU syntax: {n, plural, one {…} other {…}}
Text with links or bold inside Not covered Yes
Prefixed links localizePath Its own Link, redirect and usePathname
Translated routes No Yes
Proxy Ours A ready-made one, which would have to be combined with ours
Current language next/root-params That too: it's the recommended approach in its documentation
Integration with translators No Standard formats and tools

With three languages, professional translators or formatted messages, it pays off. Before adopting it, check that the functions you use support Cache Components in your version, and look at how much it sends to the client: give each island only its share of the messages. The Next.js guide lists others.

Whichever you choose, what it doesn't save you is sections 2, 3, 7 and 8: those decisions are yours.

  1. Checking

curl -sI -H 'Accept-Language: ca,es;q=0.9,en;q=0.8' localhost:3000/ | grep -iE 'HTTP|location|vary'
curl -sI -H 'Accept-Language: es-MX' localhost:3000/ | grep -i location            # /es
curl -sI -H 'Accept-Language: es' -b 'agendaviva-language=en' localhost:3000/ | grep -i location  # /en
curl -so /dev/null -w '%{http_code}\n' localhost:3000/fr/events                    # 404
curl -so /dev/null -w '%{http_code}\n' localhost:3000/constructor                  # 404
curl -s localhost:3000/es/events | grep -oE '<html[^>]*lang="[a-z]+"'
curl -s -A 'bingbot/2.0' localhost:3000/es/venues | grep -oE 'hrefLang="[^"]+" href="[^"]+"|hreflang="[^"]+" href="[^"]+"'

Go through the Spanish version looking for leftover English: loading text, errors, aria-label attributes, titles and social images are the ones that slip through. An effective trick is a fake third language that writes every text between square brackets: anything you see without them doesn't go through the dictionary, and it also checks whether the design copes with longer text.

Common Mistakes and Tips

  • The language only in a cookie: one address, two contents.
  • Redirecting by Accept-Language on every page.
  • A 308 when negotiating.
  • Flags to represent languages.
  • Assembling sentences from pieces, or plurals with n === 1.
  • Passing the whole dictionary to a Client Component.
  • Reading next/root-params in an action or a Route Handler.
  • canonical of every version pointing to the main one.
  • Non-reciprocal hreflang, or without the page itself.
  • Validating the language with in.
  • Changing the time zone along with the language.
  • Forgetting the language in the cache key: English gets served in the Spanish version.
  • Translating the interface and not the content, and advertising it as translated.

Exercises

Exercise 1: negotiating

With languages en and es, say where / leads in each case: (a) es-MX,es;q=0.9,en;q=0.8; (b) fr-FR,fr;q=0.9; (c) en;q=0,es;q=0.1; (d) es;q=abc,en;q=0.5; (e) no header and the cookie es; (f) header en and cookie <script>. What would you have to change to add Catalan, and which text stops being valid?

Solution

  • (a) /es. (b) /en, by default. (c) /es: q=0 means "I don't want it". (d) /en: Number('abc') is NaN, and NaN > 0 is false. (e) /es. (f) /en: the cookie isn't a language and the header is used.

For Catalan you add 'ca' to LANGUAGES, and TypeScript points out what's missing: LANGUAGE_NAMES, LOADERS, REGIONS, OG_LOCALE. The proxy needs the change by hand, because the (en|es) expression is hard-coded: better to build it with LANGUAGES.join('|'). And EVENT_LIMITS, the organizer's text and the translated data grow in the same way. The example 'ca,es;q=0.9…' → 'es' in the comment becomes 'ca'.

Exercise 2: a mixed-up cache

After translating the listings, /es sometimes shows English titles. Explain why and fix it in two ways. Which one wouldn't work if this function is also called by app/api/v1/events/route.ts?

let currentLanguage: Language = 'en'

export async function listUpcomingEvents(limit = 6) {
  'use cache'
  cacheLife('listings')
  return queryUpcoming(limit, currentLanguage)
}

Solution

currentLanguage is a module variable: it's shared by every visitor (03-04), and besides it's not part of the key. The first request fixes the result for both versions. The tags are missing too.

// 1. As an argument: it goes into the key
export async function listUpcomingEvents(language: Language, limit = 6) {
  'use cache'
  cacheLife('listings')
  cacheTag(EVENTS_TAG, VENUES_TAG)
  return queryUpcoming(limit, language)
}

// 2. With the root param, read inside: Next.js adds it to the key
const value = await lang()

The second doesn't work for the API: the next/root-params getters don't work in Route Handlers. With the first, the API passes 'en'.

Exercise 3: estimating

The city council asks for "the same thing in German and French, it's just translating". Write the list of what it costs, separating what's done once per language from what's repeated forever, and propose a small, useful first delivery.

Solution

Once per language: dictionary, formats, a design review with long text (German grows), metadata and social images, hreflang and sitemap, emails, legal text, tests, and a person to review and proofread it.

Forever: every new interface text times the number of languages; every event, translated or marked as unavailable; support for whoever writes in that language; more pages at build time and more cache entries.

First delivery: only the event page and booking, with the interface translated and the English description flagged as such and not indexed. Measure how much it's used over one summer. If it works, translate the fifty most visited events. It's cheaper to expand than to withdraw a language whose addresses have already been shared.

Conclusion

Internationalization starts with the address: one segment per language, above the root layout, which next/root-params makes available to any Server Component and which becomes part of the cache key. The proxy negotiates only on the home page and rejects whatever isn't a language; dictionaries stay on the server, actions return keys, Intl knows the rules and translated content lives in its own table. The versions announce each other, and none presents itself as translated if it isn't. Now go back to your main branch: the project continues in English and with the usual routes.

That's the end of module 9. AgendaViva has a look of its own in light and dark mode, posters and fonts sized to fit, pages that describe themselves and a clear path towards other languages. Every improvement has added something the browser downloads or runs, and so far we've trusted that the result was fast and that nothing broke. Module 10, Performance, Testing and Observability, replaces trust with measurements, and it begins with Core Web Vitals in Next.js.

© Copyright 2026. All rights reserved