Question presented to candidate: "We need English, German and French versions of the site with locale-prefixed URLs. How do you set up i18n in the App Router?"
What a strong answer should cover:
- The next.config
i18noption is a Pages Router feature; in the App Router you build routing yourself with a[lang]dynamic segment. - Detect the preferred locale in Proxy from the Accept-Language header or a cookie, and redirect
/to/en,/deand so on. - Load translation dictionaries in Server Components, so translations do not ship as client JavaScript.
- Use
generateStaticParamsfor the locales so each language is prerendered, anddynamicParams = falseto reject unknown ones. - Next.js 16.3 added
next/root-paramsto read the rootlangparam anywhere in Server Components (not in Client Components, Server Actions or Route Handlers); sethtml langandalternates.languagesfor SEO.
Clarifying questions expected:
- "Sub-paths or domains per locale?" β both work with Proxy.
- "Is content translated or just the UI?" β decides where translations come from.
Code / implementation expected: Yes β a [lang] segment, a dictionary loader and the Proxy redirect.