Skip to content
Angular i18n

Angular i18n Solution

Standalone components, signals, and SSR support for Angular applications.

Sync
npx lefine strings pull
Runtime
@ngx-translate/core
lefine · @ngx-translate/core
01Terminal
npm install @ngx-translate/core
02src/app/lefine.loader.ts
import { Injectable, inject } from '@angular/core'import { HttpClient } from '@angular/common/http'import { TranslateLoader } from '@ngx-translate/core'import { Observable } from 'rxjs'// TranslateLoader's contract: one Observable of messages per language.// The files are the ones `lefine strings pull` wrote.@Injectable({ providedIn: 'root' })export class LefineLoader implements TranslateLoader {  private http = inject(HttpClient)  getTranslation(lang: string): Observable<Record<string, unknown>> {    return this.http.get<Record<string, unknown>>(`/assets/locales/${lang}.json`)  }}
03src/app/app.component.html
<!-- app.component.html --><h1>{{ 'home.title' | translate }}</h1><p>{{ 'home.greeting' | translate: { name: 'World' } }}</p><!-- ICU plurals authored in the Lefine dashboard --><p>{{ 'cart.items' | translate: { count: 3 } }}</p><app-locale-switcher />
'home.greeting' | translate: { name: 'World' }
Hello, World
In a template

In a template

The translate pipe and the service both read from the loader, so nothing in your components knows about the CDN.

01/Setup

Runtime translations in Angular, in three steps

Angular's built-in i18n compiles one bundle per locale. For translations that change without a rebuild, ngx-translate reads them from Lefine at runtime.

  1. 01

    Install the loader dependencies

    ngx-translate provides the pipe, the service and the loader contract; core fetches and caches the messages.

    terminalbash
    npm install @ngx-translate/corenpx lefine loginnpx lefine strings pull -o src/assets/locales# pull writes src/assets/locales/en.json, de.json, ...# Run it again after each publish (or in your build) to refresh them.
  2. 02

    Write a TranslateLoader backed by the CDN

    TranslateLoader asks for an Observable per language, so rxjs from() around getMessages is the whole adapter.

    src/app/lefine.loader.ts
    import { Injectable, inject } from '@angular/core'import { HttpClient } from '@angular/common/http'import { TranslateLoader } from '@ngx-translate/core'import { Observable } from 'rxjs'// TranslateLoader's contract: one Observable of messages per language.// The files are the ones `lefine strings pull` wrote.@Injectable({ providedIn: 'root' })export class LefineLoader implements TranslateLoader {  private http = inject(HttpClient)  getTranslation(lang: string): Observable<Record<string, unknown>> {    return this.http.get<Record<string, unknown>>(`/assets/locales/${lang}.json`)  }}
  3. 03

    Provide it and switch at runtime

    One provider in bootstrapApplication, then use() changes language with no page reload and no per-locale build.

    src/main.ts
    import { bootstrapApplication } from '@angular/platform-browser'import { importProvidersFrom } from '@angular/core'import { provideHttpClient } from '@angular/common/http'import { TranslateModule, TranslateLoader } from '@ngx-translate/core'import { AppComponent } from './app/app.component'import { LefineLoader } from './app/lefine.loader'bootstrapApplication(AppComponent, {  providers: [    provideHttpClient(),    importProvidersFrom(      TranslateModule.forRoot({        defaultLanguage: 'en',        loader: { provide: TranslateLoader, useClass: LefineLoader },      })    ),  ],})
02/Switching locale

Quick Start

Add i18n to your Angular app with pipes and services.

src/app/locale-switcher.component.ts
import { Component, inject } from '@angular/core'import { TranslateModule, TranslateService } from '@ngx-translate/core'@Component({  selector: 'app-locale-switcher',  standalone: true,  imports: [TranslateModule],  template: `    <select (change)="switchTo($any($event.target).value)">      <option *ngFor="let l of languages" [value]="l.code">{{ l.name }}</option>    </select>  `,})export class LocaleSwitcherComponent {  private translate = inject(TranslateService)  // The locales you pulled, one file each.  languages = [    { code: 'en', name: 'English' },    { code: 'de', name: 'Deutsch' },  ]  switchTo(lang: string) {    // use() calls the loader, which GETs /assets/locales/<lang>.json.    this.translate.use(lang)  }}
03/Capabilities

Features

  • Standalone components support
  • Signals support
  • Translation pipes
  • i18n directives
  • Injectable services
  • Lazy loading modules
  • Angular SSR (@angular/ssr)
  • AOT compilation support
  • No Angular CLI changes: one loader and one provider
04/Works with

Works with Popular Angular i18n Libraries

Lefine complements your Angular i18n library — manage translations visually, collaborate with translators, and deploy via CDN.

  • @ngx-translate/core

    The most widely used Angular translation library. Runtime translations with pipes, directives, and service injection.

    A custom TranslateLoader reads your messages from the Lefine CDN. Edit translations in our dashboard and publish — no rebuild.

  • Angular i18n (built-in)

    Angular's official i18n system with AOT compilation, ICU expressions, and build-time translation extraction.

    Import your Angular XLIFF files into Lefine to manage the translation workflow; Angular CLI still builds locale-specific bundles.

  • Transloco

    Modern, lightweight i18n library for Angular with lazy loading, rich plugins, and excellent TypeScript support.

    Sync Transloco JSON files through Lefine's GitHub integration (beta), or load them from the CDN at runtime.

How it works

Where an Angular string comes from

No per-locale bundle: the loader resolves a language at runtime and the edge answers it.

Read path — every locale load
Your Angular app

The translate pipe reads what TranslateService already loaded.

0 network calls per render

lefine

The TranslateLoader reads the file lefine strings pull wrote for each language.

60 s cache · 0 deps

CDN edge

Cloudflare worker answers from the nearest edge cache.

max-age=60 · never a 5xx

R2 object store

The published translation files the sync worker wrote.

source of truth

Fallback chain — tried in order when a hop fails
  • 01In-memory TTL cache
  • 02CDN fetch, with timeout and one retry
  • 03Persistent storage, if configured
  • 04staticData bundled with the app
  • 05Throw — after everything above missed
Write path — dashboard to app
AI or translator

Proposal reviewed in the dashboard, glossary enforced.

MCP · dashboard · CLI

Publish

Sync worker writes the locale files to R2.

lefine strings publish

CDN purge

Fire-and-forget purge of the affected keys and the manifest.

non-critical by design

Live in the app

The next getMessages() past the TTL returns the new copy.

~5 min worst case

0dependencies in core
5 minSDK cache in production; edge 60s
200CDN status, even on failure
5fallback layers before an error
Get started

Start free.

Start Building with Angular i18n

Free tier available. No credit card required.