IntlPull
Tutorial
10 min read

Angular + ngx-translate: Der komplette Guide für Echtzeit-Übersetzung [2026]

Lerne, wie du Echtzeit-Übersetzung in Angular mit ngx-translate implementierst. Kompletter Setup-Guide, Code-Beispiele und Best Practices für 2026.

IntlPull Team
IntlPull Team
Feb 5, 2026
On this page
Summary

Lerne, wie du Echtzeit-Übersetzung in Angular mit ngx-translate implementierst. Kompletter Setup-Guide, Code-Beispiele und Best Practices für 2026.

Einführung

Obwohl @angular/localize die offizielle Lösung für Performance ist, bleibt ngx-translate extrem beliebt für Apps, die einen dynamischen Sprachwechsel ohne Neuladen der Seite erfordern.

Installation

Terminal
npm install @ngx-translate/core @ngx-translate/http-loader

Konfiguration

In deinem app.module.ts (oder app.config.ts für Standalone-Apps):

TypeScript
1import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
2import { TranslateHttpLoader } from '@ngx-translate/http-loader';
3import { HttpClient } from '@angular/common/http';
4
5export function HttpLoaderFactory(http: HttpClient) {
6  return new TranslateHttpLoader(http);
7}
8
9@NgModule({
10  imports: [
11    TranslateModule.forRoot({
12      loader: {
13        provide: TranslateLoader,
14        useFactory: HttpLoaderFactory,
15        deps: [HttpClient]
16      }
17    })
18  ]
19})
20export class AppModule { }

Verwendung

Injiziere den TranslateService in deine Komponenten.

TypeScript
1export class AppComponent {
2  constructor(private translate: TranslateService) {
3    translate.setDefaultLang('en');
4    translate.use('de');
5  }
6}

In deinem HTML:

HTML
<h1>{{ 'HOME.TITLE' | translate }}</h1>

Verwaltung von JSON-Dateien mit IntlPull

Deine Übersetzungsdateien leben in assets/i18n/de.json. Um sie synchron zu halten:

Terminal
npx @intlpullhq/cli pull --output src/assets/i18n

Fazit

Wenn dein kritischer Bedarf der sofortige (Runtime) Sprachwechsel ist, ist ngx-translate auch 2026 noch der König. Für die meisten anderen Fälle erwäge die Migration zu @angular/localize.

Tags
angular
ngx-translate
i18n
lokalisierung
tutorial
2026
IntlPull Team
IntlPull Team
Engineering

Building tools to help teams ship products globally. Follow us for more insights on localization and i18n.