angular-locale-chain Example

March 16, 2026 ยท View on GitHub

Minimal Angular app demonstrating the angular-locale-chain library with Transloco.

What it shows

Three translation files with intentionally missing keys:

Keyen.jsonpt.jsonpt-BR.json
greetingHelloOlaOi
farewellGoodbyeAdeus--
welcomeWelcome to LocaleChain----

When the active locale is pt-BR, the LocaleChainLoader deep-merges translations in this order:

  1. en.json (default locale -- lowest priority)
  2. pt.json (fallback chain: pt-BR -> pt-PT -> pt)
  3. pt-BR.json (requested locale -- highest priority)

Result for pt-BR:

  • greeting = "Oi" (from pt-BR.json)
  • farewell = "Adeus" (from pt.json via fallback chain)
  • welcome = "Welcome to LocaleChain" (from en.json via default locale)

Running

pnpm install
pnpm start
# Open http://localhost:4201

Click the language buttons to switch locales and see the fallback chain in action.