Found me on Upwork? If you found me through Upwork and want to work together, please contact me through Upwork. Messages from Upwork clients sent outside Upwork will not be answered.
Localization notes🌏 Localization

Angular i18n for Vietnamese: XLIFF Workflow and Locale Formatting

Localize an Angular app into Vietnamese: extract XLIFF, configure vi locale in angular.json, and format VND currency and DD/MM/YYYY dates with Angular pipes.

Dao Huy (Lucas)8 min read8 sections
Angular i18n for Vietnamese: XLIFF Workflow and Locale Formatting

💡 To localize an Angular app into Vietnamese: install @angular/localize, mark template strings with the i18n attribute, run ng extract-i18n to generate a messages.xlf XLIFF file, translate it into Vietnamese, declare the vi locale in angular.json, and build with ng build --localize. The key simplification: Vietnamese has one ICU plural category, so plural strings need only a single other branch.

Key takeaways

  • Angular's built-in i18n pipeline uses AOT compilation: strings marked with i18n are replaced at build time, producing one language-specific build per locale with zero runtime overhead.
  • Run ng extract-i18n --output-path src/locale to generate messages.xlf. Copy and rename it to messages.vi.xlf, then fill in <target> elements in Vietnamese.
  • Vietnamese has one CLDR plural category: other. Your Vietnamese XLIFF never needs a one branch. Use =0 and =1 exact selectors only for specific zero/one edge cases.
  • Register locale data with registerLocaleData(localeVi) and provide LOCALE_ID: 'vi'. Angular's DatePipe, CurrencyPipe, and DecimalPipe then format VND, DD/MM/YYYY dates, and period-separated thousands automatically.
  • Vietnamese UI strings run 10-20% longer than English. Test all button labels, navigation tabs, and mobile viewports before the first release.

How does Angular's built-in i18n system work?

Angular ships a complete internationalization pipeline in the @angular/localize package. Unlike runtime i18n libraries that swap strings in the browser, Angular compiles a separate build for each locale. The Angular CLI extracts marked strings into an XLIFF file, merges translated XLIFF at build time, and outputs a locale-specific directory for each language.

The result is a pure-static deployment: each locale build contains exactly the strings it needs, with no locale-switching logic at runtime. For a team entering the Vietnamese market, the vi/ subdirectory can be served from a CDN or static host with no server-side language detection required.

Angular i18n uses the ICU MessageFormat standard for plurals, gender selection, and conditional text. The official Angular i18n guide covers the full pipeline from setup to deployment, including how to handle mismatched IDs when source strings change between releases.

Extracting your XLIFF file and writing the Vietnamese translation

Add the localize package to your project:

ng add @angular/localize

Mark strings in templates with the i18n attribute. Supply meaning and description metadata to help translators:

<h1 i18n="site title|Homepage heading">My Product</h1>
<img i18n-title title="Company logo" alt="Company logo" />

Extract all marked strings:

ng extract-i18n --output-path src/locale

This creates src/locale/messages.xlf. Copy it to src/locale/messages.vi.xlf and add <target> elements in Vietnamese:

<trans-unit id="introductionHeader" datatype="html">
  <source>My Product</source>
  <target>Sản phẩm của tôi</target>
</trans-unit>

XLIFF 1.2 is the default format. Use --format xlf2 for XLIFF 2.0. Both formats are compatible with CAT tools such as Trados Studio, memoQ, and Smartcat, so you can send the file directly to a Vietnamese translator without custom tooling.

How do ICU plural messages simplify in Vietnamese?

English requires two CLDR plural categories: one (singular) and other. Vietnamese requires only other. The language expresses quantity through classifiers and context, not by changing word endings, so all numbers map to the same form.

An English template plural:

<span i18n>{count, plural, =0 {No results} one {# result} other {# results}}</span>

Becomes in messages.vi.xlf:

<target>{VAR_PLURAL, plural, =0 {Không có kết quả} other {# kết quả}}</target>

Vietnamese says "1 kết quả" and "5 kết quả" with the same word form. Only =0 and =1 exact selectors are needed for specific edge cases like empty states. This simplification reduces the translation surface for every quantity-aware string in your app.

Angular's select ICU clause works normally: {gender, select, male {...} female {...} other {...}}. Vietnamese does not change surrounding words to agree with grammatical gender, so select clauses translate each option directly.

Vietnamese date, number, and currency: how do Angular pipes format them?

Register Vietnamese locale data in your app.config.ts before the pipes format correctly:

import { registerLocaleData } from '@angular/common';
import localeVi from '@angular/common/locales/vi';
registerLocaleData(localeVi, 'vi');

// In providers:
{ provide: LOCALE_ID, useValue: 'vi' }

With the vi locale active, Angular's pipes produce correct Vietnamese output:

  • DatePipe: {{ today | date:'shortDate' }} returns 14/11/2026 (DD/MM/YYYY). Long formats use Vietnamese month names.
  • DecimalPipe: {{ 1500000 | number }} returns 1.500.000. Period is the thousands separator; comma is the decimal separator in Vietnamese.
  • CurrencyPipe: {{ 250000 | currency:'VND' }} returns 250.000 ₫. VND has no decimal subdivision.
  • PercentPipe: {{ 0.65 | percent }} returns 65%. No special spacing is used in Vietnamese.

These formatting rules come from the Unicode CLDR project, the authoritative standard for locale-specific formatting. Angular packages the CLDR data for vi in @angular/common/locales/vi.

Building the vi locale and testing Vietnamese layout

Declare the Vietnamese locale in angular.json under the project's i18n key, then build with ng build --localize:

"i18n": {
  "sourceLocale": "en-US",
  "locales": {
    "vi": { "translation": "src/locale/messages.vi.xlf" }
  }
}

The CLI outputs dist/my-app/vi/ and adjusts the base href automatically. Add a named configuration to build Vietnamese independently: ng build --configuration=production,vi. Serve each locale from its subdirectory (/vi/) and configure your server or CDN to redirect by Accept-Language.

Before releasing, run this layout checklist against the Vietnamese build:

  • Test all button and CTA labels at 375px and 390px mobile viewports. Vietnamese compound phrases expand where English uses short verbs.
  • Check tabs, breadcrumbs, and dropdown options. Vietnamese nouns are often multi-syllable where English uses abbreviations.
  • Verify font coverage: Vietnamese uses combining diacritics across six tone marks and additional hook/breve modifications on base vowels. Confirm rendering of characters such as ộ, ề, ầ, ắ, ự, ẫ in every web font you load. System fonts on Android, iOS, Windows, and macOS cover these by default; trimmed web font subsets may not.
  • Set lang="vi" on the root <html> element. Angular does this automatically when the locale is configured correctly.
  • Apply overflow-wrap: break-word in CSS as a safety net. Vietnamese text breaks at spaces between syllable-words; long technical terms can overflow narrow containers.

In-house vs. specialist: the honest line for an Angular team targeting Vietnam

The engineering work - adding @angular/localize, marking strings, running extraction, configuring angular.json - is straightforward and fully doable in-house. Any developer comfortable with Angular CLI can complete the setup in a day. Machine translation handles high-volume, structured strings well: form labels, error messages, tooltip text, and help documentation.

Where a native Vietnamese specialist adds real value: product UI tone, marketing copy, and domain-specific vocabulary. Vietnamese distinguishes formal and informal register, and the choice affects how professional a product feels to business users. Sino-Vietnamese terminology (vocabulary derived from Classical Chinese) signals expertise in finance, healthcare, and legal products - a general MT engine defaults to simpler equivalents that specialist reviewers flag as imprecise.

The practical split for most Angular teams: use MT with post-editing for the long tail of help content and error messages, and commission a human specialist for the 50-100 strings a user reads every session. For B2B products where a Vietnamese procurement team will evaluate your interface, budget for a full native-speaker review before launch.

For professional English-to-Vietnamese translation covering Angular web apps and B2B software, the Vietnamese website localization service on this site handles both translation and technical review of XLIFF files.

FAQ

Can I use Trados, memoQ, or Smartcat to translate Angular XLIFF files?

Yes. XLIFF 1.2 (.xlf) is an open standard supported by all major CAT tools including Trados Studio, memoQ, Smartcat, and Lokalise. Send the translator your messages.vi.xlf file directly. Warn translators not to modify id attributes or placeholder elements such as <x id="INTERPOLATION"/>. Some tools offer Angular-specific XLIFF filters that handle these placeholders automatically.

What is the difference between XLIFF 1.2 and XLIFF 2.0 for a Vietnamese project?

Angular generates XLIFF 1.2 by default (.xlf). Use ng extract-i18n --format xlf2 for XLIFF 2.0 (.xlf2). XLIFF 2.0 has a cleaner schema and better namespace support. The practical difference for Vietnamese is minor: choose whichever format your CAT tool or translation agency prefers. Both support the same ICU MessageFormat syntax used in Angular templates.

Should I use 'vi' or 'vi-VN' as the locale ID in Angular?

Use vi. Angular ships locale data for both vi and vi-VN in @angular/common/locales/, but vi is the BCP 47 primary tag and covers all Vietnamese users. Per W3C language tag guidance, use the shortest tag that accurately identifies the language unless you need to distinguish a regional variant. Use vi-VN only if a third-party library requires the full locale code for its data lookup.

How do I test the Vietnamese build locally during development?

Add a named vi build configuration to angular.json, then run ng serve --configuration=vi. The dev server serves the Vietnamese locale at the configured path. To test all locales simultaneously, run ng build --localize and serve the dist/ output with a local static server. The ng serve command does not support multi-locale builds at runtime; use a build-and-serve approach for final pre-launch checks.

What happens to Vietnamese strings when source text changes after extraction?

When a marked source string changes, Angular generates a new translation unit ID. The old ID in messages.vi.xlf becomes unused, and the new ID has no <target> element. Angular build will warn about missing translations. Add custom IDs with @@my-id to control ID stability: i18n="@@product-title". This lets you update the source string without invalidating the Vietnamese translation, as long as the semantic meaning is unchanged.

Official Sources

Dao Huy (Lucas)
Dao Huy (Lucas)
Graduate, University of Foreign Language Studies, University of Da Nang. Signs a certificate of accuracy on every certified translation (USCIS, IRCC).

Written by Dao Huy (Lucas), Vietnamese translator and localization specialist (English, Chinese and French into Vietnamese). See translation services →

Get QuoteWhatsApp