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.
- JavaScript-Powered Content Management: Harness the flexibility of JavaScript to define and manage your content efficiently.
- Type-Safe Environment: Leverage TypeScript to ensure all your content definitions are precise and error-free.
- Integrated Content Files: Keep your translations close to their respective components, enhancing maintainability and clarity.
- Simplified Setup: Get up and running quickly with minimal configuration, especially optimized for Next.js projects.
- Server Component Support: Perfectly suited for Next.js server components, ensuring smooth server-side rendering.
- Enhanced Routing: Full support for Next.js app routing, adapting seamlessly to complex application structures.
Install the necessary packages using npm:
npm install intlayer-cli
yarn add intlayer-cli
pnpm add intlayer-cli
intlayer-cli
package intend to transpile your intlayer declarations into dictionaries.
This package will transpile all intlayer files, such as src/**/*.content.{ts|js|mjs|cjs|json}
. See how to declare your Intlayer declaration files
To interpret intlayer dictionaries you can interpreters, such as react-intlayer next-intlayer
Intlayer accepts multiple configuration file formats:
intlayer.config.ts
intlayer.config.js
intlayer.config.json
intlayer.config.cjs
intlayer.config.mjs
.intlayerrc
To see how to configure available locales, or other parameters, refer to the configuration documentation here
To build your dictionaries, you can run the commands:
npx intlayer build
or in watch mode
npx intlayer build --watch
"scripts": {
"transpile": "npx intlayer build",
"transpile:watch": "npx intlayer build --watch"
}