Skip to main content
Next.js lets you configure routing and rendering to support multiple languages. This covers:
  • Internationalized routing — Routing based on locale (sub-path or domain)
  • Localization — Translating content based on the user’s preferred locale

Terminology

  • Locale — An identifier for a set of language and formatting preferences:
    • en-US — English as spoken in the United States
    • nl-NL — Dutch as spoken in the Netherlands
    • nl — Dutch, no specific region

Routing overview

Detect the user’s preferred locale using the Accept-Language request header and redirect to the appropriate locale path.

Detect and redirect

Use libraries like @formatjs/intl-localematcher and negotiator to match the best locale:

Dynamic locale segment

Nest all pages under app/[lang]/ so the router passes the locale to every layout and page:
The root layout can also use the locale:

Localization

Translate content using dictionary files. Maintain separate JSON files per locale:
Create a getDictionary function to load translations:
Fetch the dictionary in your page and render translated content:
Because all layouts and pages in app/ default to Server Components, translation files do not increase the client-side JavaScript bundle size.

Static rendering

Generate static routes for all locales using generateStaticParams:

Libraries

For more advanced use cases, these libraries provide additional features like pluralization, date/number formatting, and React hooks:

next-intl

Full-featured i18n with server and client support.

next-international

Type-safe i18n for App Router.

paraglide-next

Compile-time i18n with zero runtime overhead.

lingui

Comprehensive i18n with message extraction.