Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk3 min

How to Merge Translations into an Angular App and Build Localized Variants

How to map translation files to locales in angular.json, build localized variants with ng build --localize, enforce complete translations, and deploy each variant.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To merge finished translations into an Angular app, declare the source locale and a translation file for each target locale in angular.json. Then build with the localize option, or run ng build --localize. The CLI emits one complete application variant per locale, and you deploy each variant at its own path or behind language detection. This guide follows Angular’s merge guide, which was checked against current documentation on 2026-10-05. CLI behavior and supported formats vary by version, so confirm against the version your project uses.

What “merging” means in Angular

Angular localizes at compile time. Merging produces a separate, complete build of the app for each locale, with translations baked in. It is not a runtime language switch inside one generated copy. Two settings work together:

As an Amazon Associate I earn from qualifying purchases.

  • The i18n configuration in the workspace maps locale identifiers to translation files.
  • The localize build option decides which of those configured locales get built.

Whether you are internationalizing (making the app locale-ready) or localizing (supplying locale-specific data and text) is explained in the internationalization overview.

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

Prerequisites

Add the localize package

Run ng add @angular/localize. If the package is missing during a localized build, the CLI can fail with an error explaining how to enable i18n. See Add the localize package.

Mark text and extract it

Angular recognizes template text marked with i18n, attributes marked with i18n-, and $localize tagged messages in code (Prepare component for translation). Running ng extract-i18n then generates a source-language translation file. Your translators fill in a copy of that file for each target locale. Angular documents XLIFF-family formats, XMB, JSON and ARB, and the merge guide also mentions XTB. Choose whichever format your translation process supports. See Work with translation files.

Step-by-step: merge and build

  1. Configure locales in angular.json. Set the source locale and map each target locale ID to its translation file. Angular’s example uses en-US as the source and French (fr) as a target. Each locale entry can also take baseHref and subPath settings.
  2. Enable localize in the build options. Use true to build every configured locale, an array of locale IDs to build a subset, or false to disable locale-specific builds.
  3. Use AOT. Ahead-of-time compilation is required to localize component templates.
  4. Build. Run ng build --localize.
  5. Build a single locale when needed. Compose a production configuration with a locale configuration, for example ng build --configuration=production,fr.

Choosing options

Decision Choices When to use which
Build breadth localize: true or an array of IDs All locales for releases; a subset to speed up targeted builds.
Development vs. production One locale per ng serve; composed configurations for deployable builds The dev server handles only one localized locale at a time, so pick one explicitly for local checks.
Missing translations error, warning (default behavior), ignore Use error if incomplete locale files must not ship.
Serving strategy Server-side language detection or locale subdirectories Depends on your hosting and URL design.

Fail the build on missing translations

Set i18nMissingTranslation to error in your build options. Any message without a translation then stops the build instead of silently falling back to the source text. With warning, the build completes but reports the gaps. ignore suppresses them.

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

What the build produces

The CLI writes each locale into its own directory beneath the output path. It sets the HTML lang attribute and adjusts the base href for each variant. Because each variant assumes its own base path, your server or CDN must route users to the right one. Deploy multiple locales covers the base href behavior and server setups in more detail.

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

Troubleshooting

  • Error about enabling i18n: @angular/localize is not installed. Run ng add @angular/localize.
  • Text still appears in the source language: the message may be unmarked, missing from the translation file, or the missing-translation level may be hiding the gap. Set it to error to surface it.
  • Component templates not localized: confirm AOT compilation is on.
  • Dev server will not show all languages: this is expected. Serve one locale per run.
  • Broken assets or routes in a variant: check baseHref and subPath against how you deploy.

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
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.