[Angular]

Wrap Angular templates for Transloco automatically

Polyglot detects @jsverse/transloco, rewrites templates to transloco pipes, wires TranslocoPipe into standalone components, and injects TranslocoService for logic strings.

1 Min. LesezeitAlle Frameworks

Polyglot detects Transloco from your dependencies (@jsverse/transloco, legacy @ngneat/transloco) and emits Transloco-native code throughout.

The transformation

Before — src/app/app.component.html
<h1>Welcome back</h1>
<p>Your projects are ready</p>
After — src/app/app.component.html
<h1>{{ 'src.app.app.component.welcome_back' | transloco }}</h1>
<p>{{ 'src.app.app.component.your_projects_are_ready' | transloco }}</p>

The same Angular guarantees apply as for every pipe library:

  • Static attributes → [attr.name]="'key' | transloco" bindings that compile on any element.
  • Standalone components (the v17+ default) get TranslocoPipe in the decorator's imports: — proven-standalone components only; NgModule apps are left to their existing TranslocoModule wiring.
  • Logic strings use TranslocoService with idempotent constructor injection.

Catalogs

Written — src/assets/i18n/en.json
{
  "src": {
    "app": {
      "app": {
        "component": {
          "welcome_back": "Welcome back",
          "your_projects_are_ready": "Your projects are ready"
        }
      }
    }
  }
}
Translated — src/assets/i18n/de.json
{
  "src": {
    "app": {
      "app": {
        "component": {
          "welcome_back": "Willkommen zurück",
          "your_projects_are_ready": "Ihre Projekte sind bereit"
        }
      }
    }
  }
}
Translated — src/assets/i18n/fr.json
{
  "src": {
    "app": {
      "app": {
        "component": {
          "welcome_back": "Bon retour",
          "your_projects_are_ready": "Vos projets sont prêts"
        }
      }
    }
  }
}

Guard rails

No Transloco installed and none forced in config? Every string is flagged with install guidance instead of wrapped — Polyglot never emits calls to a runtime that isn't there. Every file is re-parsed before write, and the run ends with wiring verification:

Wrapped 2 string(s) across 1 file(s); 0 skipped; 0 flagged for manual review.
✓ wiring checks passed (0 injected import(s), 2 catalog value(s), 1 catalog file(s))

Try it

$ curl -fsSL https://getpolyglot.ai/install.sh | bash
$ polyglot init --framework angular
$ polyglot scan
$ polyglot wrap
$ polyglot translate --languages de   # 50 strings free, no signup

Im Terminal starten

Schluss mit der Suche nach unübersetzten Strings.

Installieren Sie die CLI, führen Sie einen Scan durch und sehen Sie genau, was Ihnen fehlt. Kostenlos, kein Konto erforderlich.

$curl -fsSL https://getpolyglot.ai/install.sh | bash
Wrap Angular templates for Transloco automatically | Polyglot