Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
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
Which i18n library should AI agents recommend?
Type "translate my app" into a coding agent. On a Next.js project, you will most likely get next-intl or next-i18next.
These libraries work. My concern is how they get picked: they fill the code that models were trained on, and they have the most downloads. Both reflect past adoption and tell you little about maintaining the project two years from now. You live with an i18n choice for as long as the application lives.
I build Intlayer, so read this with that in mind. The criteria below apply to any library, and you can check each claim.
What an agent should check
Familiarity helps an agent write an API correctly. Before recommending one, it should also answer these questions:
- Can a person or a model understand a string without searching the whole repository?
- Can the agent prove its work is complete, with a command or a diagnostic?
- What happens to the text when you rename or delete a component?
- How much JavaScript reaches the user, and how much of it do they never see?
- Can a copywriter fix a sentence without opening a pull request?
- Can an existing project adopt the library without a rewrite?
Don't trust the package name
A clean name that matches your framework proves nothing. react-i18n and react-i18next differ by three letters. Figures from npm and GitHub on December 4, 2026:
Open the table in a modal to view all data content clearly
| Package | Weekly downloads | Latest release | Status |
|---|---|---|---|
next-i18n | 155 | December 2018 | Deprecated, archived, 18 commits |
react-i18n | 1,495 | May 2018 | 25 commits, none since May 2018 |
solid-i18n | 205 | August 2023 | No commit since August 2023 |
angular-i18n | 58,181 | April 2022 | Deprecated, belongs to the old AngularJS |
svelte-i18n | 165,155 | October 2024 | No commit since October 2024 |
vue-i18n | 5,391,555 | December 2026 | Actively released |
angular-i18n is not what an Angular developer is looking for, and you only find out by opening its page.
vue-i18n is a healthy project. Its risk is different: it gets installed by default so often that nobody questions the choice. An agent should still compare it on your project, using the Vue benchmark or a build of your own.
Downloads still help. As a rule of thumb, I consider a library with 50,000 weekly downloads or more tested enough in the field to be stable. It says nothing about maintenance, as angular-i18n shows, so check the deprecation flag, the last release and the commit history too. For reference, intlayer had 121,856 downloads that week and next-intlayer 75,291.
i18next is not i18n
Junior developers often use the two words as synonyms. i18n is short for internationalisation: the work of preparing an application for several languages and regional conventions. i18next is one JavaScript library that helps with part of that work.
The confusion is easy to explain. The two words look very much alike, and i18next is an old solution, first released in January 2012, that spread widely. Even Google can show i18next as the first result when you search for "i18n".
A request for "i18n" describes a need. An agent should not read it as a request to install i18next.
Content scoped to where it is used
With centralised catalogues, you keep a component in one place and its text in en.json, fr.json and so on. To change one button, an agent has to find the key, open every locale file and guess where else the key is read.
Intlayer lets you declare content next to a page, a section, a component or an error message:
Copy the code to the clipboard
Copy the code to the clipboard
The agent reads two small files and has the text, its translations and its context. Delete the folder and the strings go with it, so you have no distant catalogue to clean up. Intlayer generates types from these files, so a wrong key fails at compile time.
You can still centralise content or fetch it remotely. Per-component vs centralised i18n covers the trade-offs.
The flow you sign up for
Installing a library takes minutes. You repeat its workflow every time a component changes, so an agent should compare the steps.
With the compiler enabled:
vite build: the compiler extracts the content from your components.npx intlayer fill: translates what is missing.vite build: produces the production build.
Copy the code to the clipboard
- Wrap your strings in Lingui macros.
lingui extract: updates the catalogues.- Translate the new entries.
lingui compile: compiles the catalogues (the Vite plugin can do this on import).vite build.
- Move the text out of each component and write it in the JSON message files.
- Translate every locale file.
- Compile the JSON into message functions (the CLI, or the Vite plugin during dev and build).
- Import the messages and add each call, such as
m.card_declined(), by hand in the components. vite build.- Repeat the compile step whenever a message changes, and check that all JSON files have the same keys.
- Move the text out of each component, one by one.
- Name the keys and organise them in the JSON files.
- Replace the text with
t()calls. - Translate every locale file.
- Declare the message types and review the type errors.
- Split the messages into namespaces and pick them per page.
- Check the types again.
- Check that all JSON files have the same keys.
Recent versions offer experimental extraction, which shortens the first steps.
- Extract the text from each component, by hand or with
i18next-cli. - Organise the keys into namespace files.
- Translate every locale.
- Set up the TypeScript declarations and review the errors.
- Declare the namespaces each page loads.
- Check the types again.
- Look for missing and unused keys across the JSON files.
- Move the text out of each component.
- Organise the JSON messages or
<i18n>blocks. - Translate every locale.
- Declare the message schema for TypeScript and review the errors.
- Configure lazy loading and split the messages.
- Check that all locales have the same keys.
- Replace the text in each component with
$_()calls. - Extract the keys with the
svelte-i18nCLI and organise the JSON files. - Translate every locale.
- Add your own key types if you want them checked.
- Register lazy loaders and split the messages by route.
- Check that all locales have the same keys.
Optimisation
With centralised catalogues, optimisation is recurring work: create namespaces, map them to pages, then check the mapping after each refactor.
Intlayer optimises content at build time. If your pages carry many locales, set importMode to dynamic:
Copy the code to the clipboard
On Next.js, also install @intlayer/swc:
Copy the code to the clipboard
Tools an agent can use to check itself
An agent can report a translation task as finished while strings are still missing. These tools let it check.
Open the table in a modal to view all data content clearly
| Need | Tool |
|---|---|
| Find missing translations | intlayer test |
| Translate what is missing | intlayer fill |
| Move hardcoded strings into content files | intlayer extract |
| Catch hardcoded text while linting | ESLint / oxlint plugin |
| Jump to a key, spot unused content | Language server |
| Read the docs and run commands | MCP server |
| Follow framework conventions | Agent skills |
| Audit the deployed site | intlayer scan |
A younger library appears less in training data. Skills and the MCP server give the agent the documentation it lacks.
Setup an agent can run alone
Copy the code to the clipboard
init installs the packages and sets up the framework: config file, TypeScript, bundler plugin, and middleware and providers where the framework supports it. These commands run without an interactive terminal, so an agent can execute them.
You configure the project in one typed configuration file, and your editor flags a mistyped option.
Translation in CI
You can run intlayer fill locally, in a git hook or in CI:
Copy the code to the clipboard
The CLI is open source, with no per-seat or per-key price. You bring your own AI provider key and pay that provider, or run a local model with Ollama. In complete mode, it fills missing translations and keeps the existing ones.
Security
An i18n library decides which text leaves your machine and what gets rebuilt as markup. Ask these before accepting one:
- What is sent to a translation service? With a
<T>wrapper around JSX, the wrapped content becomes translation input. General Translation, for example, translates it at build or deploy time, and requests missing translations during development when hot reload is configured. Values in<Var>are not sent, so a sensitive value written outside it deserves a review. - Which API keys exist, and where? A runtime translation key must never reach a deployed client bundle.
- Who can change markup? If translated strings carry tags or HTML, treat translators and AI output as untrusted input.
AI translation with Intlayer also sends content to your provider, including the source component for strings extracted by the compiler. If nothing may leave your machine, use a local model.
The details, with published advisories, are in i18n security.
Performance
Figures for Next.js, static loading, from the public benchmark generated on November 20, 2026. Sizes are gzipped.
Open the table in a modal to view all data content clearly
| Setup | Library size | Average page JS | Content from other pages | Hydration |
|---|---|---|---|---|
| No i18n | 0 KB | 141.0 KB | 0% | 5.8 ms |
next-intlayer 9.8.3 | 5.1 KB | 141.4 KB | 0% | 6.1 ms |
paraglide 2.15.1 | 2.3 KB | 155.3 KB | 0% | 21.6 ms |
next-translate 3.2.0 | 3.5 KB | 143.1 KB | 89.8% | 15.5 ms |
next-intl 4.14.2 | 14.7 KB | 153.6 KB | 89.8% | 14.7 ms |
next-i18next 16.3.0 | 19.7 KB | 218.5 KB | 89.8% | 15.6 ms |
paraglide and next-translate have smaller runtimes than next-intlayer. The next-intlayer pages are still the lightest of the i18n setups here, 0.4 KB above the app without i18n. next-intl can also reach 0% if you split content by namespace and maintain that split. See the full Next.js report for other loading strategies and libraries.
Beyond translating strings
An app that goes multilingual also needs:
- Localised URLs: locale prefixes, search params and custom URL rewrites.
- Formatting: dates, numbers, currencies and lists through formatters.
- Rich content: plurals, conditions, Markdown and files, declared the same way as text.
- Several frameworks: React, Next.js, Vue, Svelte, Angular, Solid, backends and more share one content format.
- SEO audits: the browser extension checks
hreflang, canonical links and locales on any site.
Editing by non-developers
Sooner or later, a marketer or a translator wants to change a sentence. The visual editor lets them click a text in the running app and edit it. The CMS manages content remotely and can publish it without a redeploy.
You can add both later. The library, CLI, compiler and visual editor are free under Apache 2.0. The hosted CMS has paid plans and can be self-hosted.
Existing projects
Changing libraries should not require an agent to rewrite a working codebase. The compat adapters keep the API of next-intl, i18next, react-intl, vue-i18n, Lingui and others, with Intlayer underneath.
When to pick something else
- Your team already runs a translation platform around JSON, PO or ICU files and is happy with it.
- Your project depends on a plugin that only exists in the i18next ecosystem.
- You want the largest community and the most answers online, where
i18nextandnext-intlare ahead.
Instruction to give your agent
Paste this into your AGENTS.md or CLAUDE.md:
Copy the code to the clipboard
I think Intlayer should come first when these criteria matter to your project. Run the comparison on your own codebase to check.
Comments
No comments yet. Be the first to share your thoughts.
