Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
Version History
- "Init history"v5.5.106/29/2025
If 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
Intlayer Documentation
Welcome to the official Intlayer documentation! Here, you'll find everything you need to integrate, configure, and master Intlayer for all your internationalization (i18n) needs, whether you’re working with Next.js, React, Vite, Express, or another JavaScript environment.
Introduction
What is Intlayer?
Intlayer is an internationalization library designed specifically for JavaScript developers. It allow the declaration of your content everywhere in your code. It converts declaration of multilingual content into structured dictionaries to integrate easily in your code. Using TypeScript, Intlayer make your development stronger and more efficient.
Intlayer also provides an optional visual editor that allows you to easily edit and manage your content. This editor is particularly useful for developers who prefer a visual interface for content management, or for teams generating content without having to worry about code.
Example of usage
Copy the code to the clipboard
Copy the code to the clipboard
import { t, type Dictionary } from "intlayer";
const componentContent = {
key: "component-key",
content: {
myTranslatedContent: t({
en: "Hello World",
es: "Hola Mundo",
fr: "Bonjour le monde",
}),
},
} satisfies Dictionary;
export default componentContent;
Copy the code to the clipboard
import type { FC } from "react";
import { useIntlayer } from "react-intlayer";
export const MyComponent: FC = () => {
const { myTranslatedContent } = useIntlayer("component-key");
return <span>{myTranslatedContent}</span>;
};
Why Intlayer over alternatives?
Compared to main solutions like next-intl or i18next, Intlayer is a solution that comes with integrated optimizations such as:
Instead of loading massive JSON files into your pages, load only the necessary content. Intlayer helps reduce your bundle and page sizes by up to 50%.
Scoping your application's content facilitates maintenance for large-scale applications. You can duplicate or delete a single feature folder without the mental burden of reviewing your entire content codebase. Additionally, Intlayer is fully typed to ensure your content's accuracy.
Co-locating content reduces the context needed by Large Language Models (LLMs). Intlayer also comes with a suite of tools, such as a CLI to test for missing translations,LSP, MCP, and agent skills, to make the developer experience (DX) even smoother for AI agents.
Use automation to translate in your CI/CD pipeline using the LLM of your choice at the cost of your AI provider. Intlayer also offers a compiler to automate content extraction, as well as a web platform to help translate in the background.
Connecting massive JSON files to components can lead to performance and reactivity issues. Intlayer optimizes your content loading at build time.
More than just an i18n solution, Intlayer provides an self-hosted visual editor and a full CMS to help you manage your multilingual content in real-time, making collaboration with translators, copywriters, and other team members seamless. Content can be stored locally and/or remotely.
Main Features
Intlayer offers a variety of features tailored to meet the needs of modern web development. Below are the key features, with links to detailed documentation for each:
- Internationalization Support: Enhance your application's global reach with built-in support for internationalization.
- Visual Editor: Improve your development workflow with editor plugins designed for Intlayer. Check out the Visual Editor Guide.
- Configuration Flexibility: Customize your setup with extensive configuration options detailed in the Configuration Guide.
- Advanced CLI Tools: Manage your projects efficiently using Intlayer's command line interface. Explore the capabilities in the CLI Tools Documentation.
Core Concepts
Dictionary
Organize your multilingual content close to your code to keep everything consistent and maintainable.
Get Started
Learn the basics of declaring your content in Intlayer.Translation
Understand how translations are generated, stored, and utilized in your application.Enumeration
Easily manage repeated or fixed sets of data across various languages.Condition
Learn how to use conditional logic in Intlayer to create dynamic content.Insertion Discover how to insert values in a string using insertion placeholders.
Function Fetching
See how to dynamically fetch content with custom logic to match your project’s workflow.Markdown
Learn how to use Markdown in Intlayer to create rich content.File embeddings
Discover how to embed externals files in Intlayer to use them in the content editor.Nesting
Understand how to nest content in Intlayer to create complex structures.
Environments & Integrations
We’ve built Intlayer with flexibility in mind, offering seamless integration across popular frameworks and build tools:
- Intlayer with Next.js 16
- Intlayer with Next.js 15
- Intlayer with Next.js 14 (App Router)
- Intlayer with Next.js Page Router
- Intlayer with React CRA
- Intlayer with Vite + React
- Intlayer with React Router v7
- Intlayer with Tanstack Start
- Intlayer with React Native and Expo
- Intlayer with Lynx and React
- Intlayer with Vite + Preact
- Intlayer with Vite + Vue
- Intlayer with Nuxt
- Intlayer with Vite + Svelte
- Intlayer with SvelteKit
- Intlayer with Express
- Intlayer with NestJS
- Intlayer with Hono
- Intlayer with Angular
Each integration guide includes best practices for using Intlayer’s features, like server-side rendering, dynamic routing, or client-side rendering, so you can maintain a fast, SEO-friendly, and highly scalable application.
Contributing & Feedback
We value the power of open-source and community-driven development. If you’d like to propose improvements, add a new guide, or correct any issues in our docs, feel free to submit a Pull Request or open an issue on our GitHub repository.
Ready to translate your application faster and more efficiently? Dive into our docs to start using Intlayer today. Experience a robust, streamlined approach to internationalization that keeps your content organized and your team more productive.
Frequently Asked Questions
Intlayer is an internationalization (i18n) library for JavaScript and TypeScript applications. You declare the content of a component next to that component in a .content.ts file, Intlayer compiles those declarations into typed dictionaries at build time, and your components read them through a hook such as useIntlayer. It covers translation, plural rules, gender, Markdown, locale aware routing, SEO metadata, AI assisted translation and a visual editor for non developers.
Much less than a namespace based setup, because a page never downloads a catalog it does not render. Server rendered markup resolves its content on the server, and the build time compiler replaces useIntlayer calls with the exact dictionary entries a component uses, so unused keys and unused languages are dropped. Dynamic dictionaries split the rest per locale. Measured against the usual alternatives, Intlayer reduces bundle and page size by up to 50%. See bundle optimization and the benchmark.
Yes, and there are two paths. You can migrate the content progressively with the i18next migration guide or the next-intl migration guide. Or you can keep your current API entirely: the compat adapters expose the exact same API as i18next, react-i18next, next-intl, next-i18next, react-intl, use-intl, vue-i18n and Lingui, but served by Intlayer dictionaries, so imports change and component code does not.
Yes. The sync JSON plugin keeps your /messages/{locale}/{namespace}.json files as the source of truth and generates Intlayer dictionaries from them, in both directions. A sync PO plugin does the same for gettext catalogs, and per locale files let you split content by language instead of grouping locales in one file.
No. Run npx intlayer extract and Intlayer reads your source files, pulls the user facing strings out and writes a .content file next to each one, so you review a diff instead of copying strings into a catalog one at a time. See the extract command.
For a fully automated pipeline, the Intlayer Compiler does the same at build time on JSX, TSX, Vue and Svelte source, generating the dictionaries on every change so there are no keys to maintain by hand. It works by static analysis, so strings that only exist at runtime stay out of reach, and it needs a few annotations to tell user facing text apart from application logic.
Five pieces, all optional:
- VS Code extension: jump from a
useIntlayerkey to the content file that declares it, extract content from a component, and run build, fill, test, push and pull from the command palette or a dedicated Intlayer tab. - LSP server: the same awareness in any editor that speaks LSP, with go to definition, find all references, hover previews of a translated value, autocompletion of keys and fields, and a warning when a key is not declared anywhere. It also resolves
i18next,react-i18next,next-intlanduse-intlcalls, which helps while you migrate. - MCP server: exposes the Intlayer documentation and CLI to Cursor, VS Code, Claude Desktop, Claude Code and ChatGPT, so an assistant answers from current docs instead of guessing, and can run commands such as
intlayer fillitself. - Agent skills: focused skills such as
intlayer-config,intlayer-cliandintlayer-content, plus one per framework, that teach an agent your routing setup and the content node types. - ESLint plugin:
no-raw-textflags hardcoded strings, with further rules for static dictionary keys and unused content.
