Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
Version History
- "Update to Next.js >= 9.4.0 architecture"v9.4.022/08/2026
- "Update Solid useIntlayer API usage to direct property access"v8.9.004/05/2026
- "Update compiler options, add FilePathPattern support"v8.2.009/03/2026
- "Initial release"v8.1.623/02/2026
The content of this page was translated using an AI.
See the last version of the original content in EnglishIf you have an idea for improving this documentation, please feel free to contribute by submitting a pull request on GitHub.
GitHub link to the documentationCopy doc Markdown to clipboard
How to make multilingual (i18n) an existing Next.js application afterward (i18n guide 2026)
Adding internationalisation (i18n) to a Next.js project from day one is relatively straightforward. But what happens when you already have a mature, production-ready Next.js application built in a single language, and you need to make it multilingual afterward?
If you have ever attempted this with traditional libraries like next-intl or next-i18next, you know the nightmare:
- Hunting down hardcoded strings across hundreds of JSX/TSX files.
- Manually creating nested JSON files and inventing arbitrarily named translation keys (
pages.dashboard.header.title, etc.). - Replacing JSX text with cumbersome translation hook calls (
t('...')). - Re-architecting your entire
app/folder intoapp/[locale]/..., breaking existing routes, bookmarks, and search indexing.
In 2026, you don't have to rewrite your codebase to make your Next.js application multilingual. With Intlayer, you can retrofit internationalisation onto an existing Next.js app in minutes, using automated extraction, AI-powered translation, and non-invasive routing.
Looking for the complete, step-by-step technical guide for Next.js 16 App Router? Check out our dedicated documentation: Translate Next.js 16 with Intlayer.
Table of Contents
The Retrofit Dilemma: Why Making an Existing Next.js App Multilingual Is Hard
When internationalising an existing Next.js application, developers face three major obstacles:
- Codebase Disruption: Manually extracting strings into JSON dictionaries requires touching almost every component file. This creates massive git diffs, high merge conflict risk, and potential regression bugs.
- Routing Lock-in: Traditional i18n libraries usually force you to relocate your root layout and pages into a dynamic
[locale]segment (e.g.,/app/[locale]/page.tsx). For an established application, this can disrupt existing middleware, relative paths, and third-party integrations. - Translation Grunt Work: Once strings are extracted, populating dictionaries in 5, 10, or 20 languages involves endless copy-pasting or expensive localisation management services.
Intlayer solves these problems at the architectural level with compiler-assisted extraction, declarative dictionaries, and flexible routing.
Automated Content Extraction (No Manual String Hunting)
Option A: The CLI Extractor (npx intlayer extract)
You can run Intlayer's extraction tool directly on your codebase:
Copy the code to the clipboard
This command parses your React components, extracts user-facing strings, and automatically creates per-component content declaration files (.content.ts) right alongside your components. Your component logic remains declarative, clear, and fully type-safe without you having to manually write a single translation key.
Option B: The Intlayer Compiler (Build-Time Extraction)
With the Intlayer Compiler enabled in your configuration, you can simply keep writing your components with plain, hardcoded text in your default language. At build time, the compiler extracts the text and injects the localised content automatically:
Copy the code to the clipboard
Behind the scenes, Intlayer builds the dictionary and links the component to its localised content, completely eliminating the manual refactoring step.
In this case it will generate a src/app/page.content.ts file with the following content:
Copy the code to the clipboard
AI-Powered Translation with Your Favourite LLM
Once your content is extracted, translating it into dozens of languages shouldn't take days. Intlayer includes a built-in AI translation CLI that integrates directly with OpenAI, Anthropic, DeepSeek, or Mistral using your own API keys:
Copy the code to the clipboard
Copy the code to the clipboard
Running npx intlayer fill populates your .content.ts declarations with translations for your configured locales:
Copy the code to the clipboard
Because Intlayer provides high-level applicationContext to the LLM, generated translations preserve technical nuance, brand voice, and grammatical context far better than traditional automated tools.
To verify that no strings were missed before shipping to production:
Copy the code to the clipboard
Add Multilingual Routing Without Breaking Existing URLs
One of the biggest fears when translating an existing app is rewriting routing. Intlayer provides multiple routing strategies out of the box:
- Search Params / Cookie Mode (
search-params): Keep your exact folder structure (/app/page.tsx,/app/dashboard/page.tsx) without moving anything to[locale]. The language is switched via query parameter (e.g.,?locale=fr) or saved in cookies. - Prefix / Path-based Mode (
prefix/prefix-all-locales): If and when you are ready for SEO-friendly URLs (/fr/dashboard,/es/dashboard), Intlayer supports path routing with a simple Next.js proxy.
Configure your Next.js integration in seconds:
Copy the code to the clipboard
Wrap your root layout with IntlayerProvider:
Copy the code to the clipboard
Multilingual SEO
Make your pages discoverable globally by generating localised metadata, OpenGraph tags, and canonical hreflang headers:
Copy the code to the clipboard
Deep-Dive: Ready for the Step-by-Step Implementation?
This guide provided a high-level overview of how to retrofit internationalisation into an existing Next.js app in 2026 without architectural headaches. If you are ready to configure every part of your Next.js application step-by-step, including detailed middleware setups, static site generation (generateStaticParams), localised sitemaps, and advanced Server Component patterns, head over to our comprehensive documentation guide:
👉 Complete Guide to Translating Next.js 16 with Intlayer
Frequently Asked Questions (FAQ)
Yes. Intlayer supports routing.mode: "search-params" as well as cookie- and header-based locale detection. You can keep your existing app/ folder structure intact, making it ideal for retrofitting existing applications without breaking existing URLs or folder hierarchies.
No. You can use npx intlayer extract to automatically detect and extract hardcoded strings into localised content declarations, or use the Intlayer Compiler to transform components at build time so you can keep writing standard JSX.
Intlayer uses per-component dictionary definitions and build-time macro optimisation. Client bundles only receive the exact fields needed by the components rendered on the page, rather than importing entire namespace JSON files. In addition, React Server Components render their content on the server with zero client overhead.
Yes. Intlayer's CLI includes the npx intlayer fill command, which connects to your preferred AI provider (OpenAI, Anthropic, Mistral, DeepSeek) to generate contextual translations for missing locales across your entire project.
Comments
No comments yet. Be the first to share your thoughts.
