Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
Version History
- Add loadJSON pluginv7.0.601/11/2025
- Change to syncJSON pluginv7.0.029/10/2025
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 automate your react-i18next JSON translations using Intlayer
What is Intlayer?
Intlayer is an innovative, open-source internationalisation library designed to address the shortcomings of traditional i18n solutions. It offers a modern approach to content management in React applications.
See a concrete comparison with react-i18next in our react-i18next vs. react-intl vs. Intlayer blog post.
Why Combine Intlayer with react-i18next?
While Intlayer provides an excellent standalone i18n solution (see our React integration guide), you might want to combine it with react-i18next for several reasons.
Intlayer offers a rich set of advanced features that go beyond traditional i18n tools. It helps you:
- Automatically detect and fill missing translations to streamline localization.
- Test and validate your translations directly in your development or CI/CD workflows.
- Manage content per component, enabling a clean, scalable, and maintainable structure across your app.
- Externalize your content, making it easily editable by your whole team (developers, translators, and content managers).
However, react-i18next remains an excellent and widely adopted i18n solution thanks to its mature ecosystem, broad community support, and extensive plugin compatibility.
By combining Intlayer with react-i18next, you get the best of both worlds, react-i18next’s stability and ecosystem maturity, with Intlayer’s modern content management, automation, and developer experience improvements.
This guide explains how to leverage Intlayer as an adapter for react-i18next, allowing you to:
- Gradually migrate from react-i18next to Intlayer.
- Keep existing react-i18next plugins and workflows.
- Automate your JSON translations in CLI or CI/CD pipelines.
- Test, sync, and manage translations more effectively.
Table of Contents
Step-by-Step Guide to Set Up Intlayer with react-i18next
Step 1: Install Dependencies
Install the necessary packages:
Copy the code to the clipboard
npm install intlayer @intlayer/sync-json-plugin --save-devnpx intlayer initPackage descriptions:
- intlayer: Core library for internationalisation management, content declaration, and building
- @intlayer/sync-json-plugin: Plugin to export Intlayer content declarations to react-i18next compatible JSON format
Step 2: Implement the Intlayer plugin to wrap the JSON
Create an Intlayer configuration file to define your supported locales:
If you also want to export JSON dictionaries for react-i18next, add the syncJSON plugin:
Copy the code to the clipboard
import { Locales, type IntlayerConfig } from "intlayer";import { syncJSON } from "@intlayer/sync-json-plugin";const config: IntlayerConfig = { internationalization: { locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH], defaultLocale: Locales.ENGLISH, }, plugins: [ syncJSON({ source: ({ key, locale }) => `./locales/${locale}/${key}.json`, }), ],};export default config;The syncJSON plugin will automatically wrap the JSON. It will read and write the JSON files without changing the content architecture.
If you want to make that JSON coexist with Intlayer content declaration files (.content files), Intlayer will proceed as follows:
Copy the code to the clipboard
1. Load both JSON and content declaration files and transform them into an Intlayer dictionary.2. If there are conflicts between the JSON and the content declaration files, Intlayer will merge all those dictionaries. This depends on the priority of the plugins and that of the content declaration file (all are configurable).If changes are made using the CLI to translate the JSON, or using the CMS, Intlayer will update the JSON file with the new translations.
To see more details about the syncJSON plugin, please refer to the syncJSON plugin documentation.
Git Configuration
It is recommended to ignore auto-generated Intlayer files:
Copy the code to the clipboard
# Ignore files generated by Intlayer.intlayerThese files can be regenerated during your build process and do not need to be committed to version control.
VS Code Extension
For an improved developer experience, install the official Intlayer VS Code Extension: