Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

From the root of your Angular workspace, run ng add @angular/localize. Angular’s CLI adds the package and updates TypeScript configuration for localization; translated content and localized builds require separate setup.

Add the package with Angular CLI

  1. Open a terminal in the root directory of your Angular workspace.

  2. Run ng add @angular/localize. The schematic adds @angular/localize to devDependencies by default, adds types: ["@angular/localize"] to TypeScript configuration, and adds /// <reference types="@angular/localize" /> at the top of main.ts. Angular’s package setup guide describes these changes.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose runtime or standard installation

Use the standard command when the package is needed for Angular’s usual localization workflow. If your application uses $localize at runtime, run ng add @angular/localize --use-at-runtime instead. That option places the package in dependencies rather than devDependencies. In a workspace with multiple projects, add --project to select the project, for example ng add @angular/localize --project=my-app. The CLI options are documented in the Angular guide.

What installation does—and what it does not do

Installing the package enables Angular localization features; it does not provide translations or configure finished builds for other locales. Angular distinguishes internationalization, preparing an application for different locales, from localization, building versions for those locales. Its documented workflow includes identifying translatable text, extracting it for translation, and formatting locale-specific data. See Angular’s internationalization overview.

Configure locales and translations

Choose locale identifiers

Angular locale IDs are Unicode locale identifiers based on BCP 47 tags. The source locale defaults to en-US; choose the intended regional locale deliberately because conventions such as dates and numbers can vary between regional variants. Details are in Angular’s locale ID guide.

Set up and extract translation files

Configure the source and target locales in the workspace build configuration and associate each target locale with its translation file. To generate a source translation file, use ng extract-i18n. Angular documents ARB, JSON, XLIFF 1.2, XLIFF 2, and XMB extraction formats, with options including --format, --out-file, and --output-path. Refer to the translation-file guide for configuration and format details.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build localized variants

After configuring locales and translation files, build the localized variants with ng build --localize. Angular includes locale data when this option is used; the initial installation includes en-US. Locale data is part of @angular/common, and global locale variants are available under @angular/common/locales/global. The development server supports one localized locale at a time. See Angular’s guide to merging translations.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi