October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk2 min

How to Add the Angular Localize Package

Install Angular’s localize package with the CLI, understand its TypeScript changes, and see the next steps for translations and localized builds.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

From the root of your Angular workspace, run ng add @angular/localize. The Angular CLI adds the package and updates TypeScript configuration so Angular’s localization features are available. This setup does not create translations or configure localized builds; those are separate steps.

Add the package

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

    As an Amazon Associate I earn from qualifying purchases.

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

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

When to use the runtime option

If your application needs $localize at runtime, run ng add @angular/localize --use-at-runtime. With this option, the package is placed in dependencies rather than the default devDependencies. In a workspace with multiple projects, add --project followed by the project name to select the project for the schematic.

What installation sets up—and what it does not

Installing the package enables Angular localization features, but it is only one part of preparing an application for multiple locales. Angular distinguishes internationalization—the preparation of a project for use in different locales—from localization, which builds project versions for those locales. The broader workflow includes configuring locales, extracting text for translation, and building localized variants. Angular’s internationalization overview explains the distinction.

Configure locales and translations

Choose locale identifiers

Angular locale IDs use Unicode locale identifiers based on BCP 47 tags. The source locale defaults to en-US; choose the source and target locales deliberately because regional variants can use different formatting conventions. Angular’s locale-ID guide describes the identifiers.

Extract text and select a translation format

Use ng extract-i18n to generate a source translation file from the application’s marked text. Angular documents ARB, JSON, XLIFF 1.2, XLIFF 2, and XMB extraction formats. The command supports options including --format, --out-file, and --output-path; consult the translation-file guide for their usage and configuration.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Build localized variants

In the workspace build configuration, define the source and target locales, associate target locales with their translation files, and configure the locale variants to build. Then use ng build --localize to produce localized builds. Angular includes the necessary locale data for this build option; the initial installation includes en-US. Locale data is provided by @angular/common, with global locale variants available under @angular/common/locales/global. The localized-build guide covers the configuration and build process.

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

Test a localized development build

Angular’s development server supports one localized locale at a time. If you need to work with multiple locales, build the localized variants with the configured build process rather than expecting the development server to serve them all simultaneously. See Angular’s localized-build guidance.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.