Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
Version History
- "Update Solid useIntlayer API usage to direct property access"v8.9.05/4/2026
- "Release stable version"v8.0.01/26/2026
- "Add init command"v8.0.012/30/2025
- "Initial 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
Translate your Angular 19 (Webpack) website using Intlayer | Internationalization (i18n)
Table of Contents
Why Intlayer over alternatives?
Compared to main solutions like ngx-translate or angular-l10n, Intlayer is a solution that comes with integrated optimizations such as:
Intlayer is optimized to work perfectly with Angular by offering component-level content scoping, lazy-loaded translations, and all the features needed for scaling internationalization (i18n).
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.
Step-by-Step Guide to Set Up Intlayer in an Angular Application
See Application Template on GitHub.
Install Dependencies
Install the necessary packages using npm:
bashCopy codeCopy the code to the clipboard
npm install intlayer angular-intlayernpm install @angular-builders/custom-webpack --save-devnpx intlayer initintlayer
The core package that provides internationalization tools for configuration management, translation, content declaration, transpilation, and CLI commands.
angular-intlayer The package that integrates Intlayer with Angular application. It provides context providers and hooks for Angular internationalization.
@angular-builders/custom-webpack Required to customize the Webpack configuration of Angular CLI.
Configuration of your project
Create a config file to configure the languages of your application:
intlayer.config.tsCopy codeCopy the code to the clipboard
import { Locales, type IntlayerConfig } from "intlayer"; const config: IntlayerConfig = { internationalization: { locales: [ Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH, // Your other locales ], defaultLocale: Locales.ENGLISH, }, }; export default config;Through this configuration file, you can set up localized URLs, middleware redirection, cookie names, the location and extension of your content declarations, disable Intlayer logs in the console, and more. For a complete list of available parameters, refer to the configuration documentation.
Integrate Intlayer in Your Angular Configuration
To integrate Intlayer with the Angular CLI, you need to use a custom builder. This guide assumes you are using Webpack (default for many Angular projects).
First, modify your
angular.jsonto use the custom Webpack builder. Update thebuildandserveconfigurations:angular.jsonCopy codeCopy the code to the clipboard
{ "projects": { "your-app-name": { "architect": { "build": { "builder": "@angular-builders/custom-webpack:browser", // replace "@angular-devkit/build-angular:application", "options": { "customWebpackConfig": { "path": "./webpack.config.ts", "mergeStrategies": { "module.rules": "prepend" }, }, "main": "src/main.ts", // replace "browser": "src/main.ts", // ... }, }, "serve": { "builder": "@angular-builders/custom-webpack:dev-server", // replace "@angular-devkit/build-angular:dev-server", }, }, }, },}Make sure to replace
your-app-namewith the actual name of your project inangular.json.Next, create a
webpack.config.tsfile at the root of your project:webpack.config.tsCopy codeCopy the code to the clipboard
import { mergeConfig } from "angular-intlayer/webpack";export default mergeConfig({});The
mergeConfigfunction configures Webpack with Intlayer. It injects theIntlayerPlugin(to handle content declaration files) and sets up aliases for optimal performance.Declare Your Content
Create and manage your content declarations to store translations:
Your content declarations can be defined anywhere in your application as soon they are included into the
contentDirdirectory (by default,./src). And match the content declaration file extension (by default,.content.{json,ts,tsx,js,jsx,mjs,cjs,md,mdx,yaml,yml}).For more details, refer to the content declaration documentation.
Utilize Intlayer in Your Code
To utilize Intlayer's internationalization features throughout your Angular application, you need to provide Intlayer in your application configuration.
src/app/app.config.tsCopy codeCopy the code to the clipboard
import { ApplicationConfig } from "@angular/core";import { provideRouter } from "@angular/router";import { provideIntlayer } from "angular-intlayer";import { routes } from "./app.routes";export const appConfig: ApplicationConfig = { providers: [ provideRouter(routes), provideIntlayer(), // Add the Intlayer provider here ],};Then, you can use the
useIntlayerfunction within any component.src/app/app.component.tsCopy codeCopy the code to the clipboard
import { Component } from "@angular/core";import { RouterOutlet } from "@angular/router";import { useIntlayer } from "angular-intlayer";@Component({ selector: "app-root", standalone: true, imports: [RouterOutlet], templateUrl: "./app.component.html", styleUrl: "./app.component.css",})export class AppComponent { content = useIntlayer("app");}And in your template:
src/app/app.component.htmlCopy codeCopy the code to the clipboard
<div class="content"> <h1>{{ content().title }}</h1> <p>{{ content().congratulations }}</p></div>Intlayer content is returned as a
Signal, so you access the values by calling the signal:content().title.Change the language of your content
OptionalTo change the language of your content, you can use the
setLocalefunction provided by theuseLocalefunction. This allows you to set the locale of the application and update the content accordingly.Create a component to switch between languages:
src/app/locale-switcher.component.tsCopy codeCopy the code to the clipboard
import { Component } from "@angular/core";import { CommonModule } from "@angular/common";import { useLocale } from "angular-intlayer";@Component({ selector: "app-locale-switcher", standalone: true, imports: [CommonModule], template: ` <div class="locale-switcher"> <select [value]="locale()" (change)="setLocale($any($event.target).value)" > @for (loc of availableLocales; track loc) { <option [value]="loc">{{ loc }}</option> } </select> </div> `,})export class LocaleSwitcherComponent { localeCtx = useLocale(); locale = this.localeCtx.locale; availableLocales = this.localeCtx.availableLocales; setLocale = this.localeCtx.setLocale;}Then, use this component in your
app.component.ts:src/app/app.component.tsCopy codeCopy the code to the clipboard
import { Component } from "@angular/core";import { RouterOutlet } from "@angular/router";import { useIntlayer } from "angular-intlayer";import { LocaleSwitcherComponent } from "./locale-switcher.component";@Component({ selector: "app-root", standalone: true, imports: [RouterOutlet, LocaleSwitcherComponent], templateUrl: "./app.component.html", styleUrl: "./app.component.css",})export class AppComponent { content = useIntlayer("app");}
Configure TypeScript
Intlayer uses module augmentation to get benefits of TypeScript and make your codebase stronger.


Ensure your TypeScript configuration includes the autogenerated types.
Copy the code to the clipboard
{ // ... Your existing TypeScript configurations "include": [ // ... Your existing TypeScript configurations ".intlayer/**/*.ts", // Include the auto-generated types ],}Git Configuration
It is recommended to ignore the files generated by Intlayer. This allows you to avoid committing them to your Git repository.
To do this, you can add the following instructions to your .gitignore file:
Copy the code to the clipboard
# Ignore the files generated by Intlayer.intlayerVS Code Extension
To improve your development experience with Intlayer, you can install the official Intlayer VS Code Extension.
Install from the VS Code Marketplace
This extension provides:
- Autocompletion for translation keys.
- Real-time error detection for missing translations.
- Inline previews of translated content.
- Quick actions to easily create and update translations.
For more details on how to use the extension, refer to the Intlayer VS Code Extension documentation.
Go Further
To go further, you can implement the visual editor or externalize your content using the CMS.