To migrate an Angular app from ngx-translate to Paraglide JS, compile your existing assets/i18n/{locale}.json files with Paraglide (the i18next plugin reads ngx-translate's {{param}} syntax and nested keys), then replace 'KEY' | translate and translate.instant('KEY') with typed calls like m['KEY'](). Both libraries can read the same files while you move components over.
npm install -D @inlang/paraglide-js
Paraglide vs ngx-translate
ngx-translate is a widely used runtime i18n library for Angular, and it is actively maintained: v18 supports Angular 18 through 22 and adds signal-based APIs. It loads JSON files at runtime (usually over HTTP) and resolves keys when the template renders. Paraglide compiles the same messages at build time into typed functions.
- Choose Paraglide for compile-time checks on keys and parameters, translations bundled with the code (no HTTP loader, no loading state), unused-message tree-shaking, and built-in plurals and selects.
- Stay on ngx-translate if translations must change without a rebuild, you switch language without reloading and need to keep in-memory state, or you depend on its plugin ecosystem (custom loaders, compilers, missing-translation handlers).
| Paraglide JS | ngx-translate | |
|---|---|---|
| Architecture | Compiler: one generated function per message | Runtime: loader fetches JSON, parser interpolates |
| In templates | {{ m['HOME.TITLE']() }} | {{ 'HOME.TITLE' | translate }} |
| In TypeScript | m['HOME.TITLE']() (synchronous) | translate.instant(), get(), stream(), translate() signal |
| Typed keys and parameters | ✅ Generated | ❌ Keys are strings |
| Loading | Bundled with the code; unused messages removed | Fetched at runtime per language; isLoading until ready |
| Plurals / select | ✅ Built in (variants) | Via ngx-translate-messageformat-compiler |
| Locale switching | setLocale() navigates or reloads the page | translate.use() updates in place |
| Translations without a rebuild | ❌ | ✅ |
| Translation workflow | General Translation through the inlang CLI, Fink editor, Sherlock VS Code extension | JSON files; BabelEdit, ngx-translate-extract |
The rest of this page is the migration.
Overview
| ngx-translate | Paraglide JS |
|---|---|
public/i18n/en.json or src/assets/i18n/en.json | Same files, read by the i18next plugin |
"HELLO": "Hello {{name}}" | Unchanged; compiles to m.HELLO({ name }) |
Nested { "HOME": { "TITLE": … } } | Unchanged; compiles to m['HOME.TITLE']() |
provideTranslateService({ lang, fallbackLang, loader }) | project.inlang/settings.json (baseLocale, locales) and a locale strategy |
provideTranslateHttpLoader(...) | Remove; messages are compiled into the bundle |
TranslatePipe, TranslateDirective | Expose m on the component |
TranslateMessageFormatCompiler (ICU) | ICU plugin (see ICU messages) |
1. Set up Paraglide
Install Paraglide and create project.inlang/settings.json. Point the i18next plugin at your existing files; adjust pathPattern to where they are:
{
"baseLocale": "en",
"locales": ["en", "de", "fr"],
"modules": ["https://cdn.jsdelivr.net/npm/@inlang/plugin-i18next@6.5.6/dist/index.js"],
"plugin.inlang.i18next": {
"pathPattern": "./public/i18n/{locale}.json",
"contextValues": []
}
}
The plugin reads {{name}} and {{ name }} placeholders and nested or flat dotted keys, and writes translations back in the same structure. "contextValues": [] stops it from reading key suffixes like SHIPPING_FREE as an i18next context of SHIPPING; keep it unless you use i18next contexts.
Angular's build doesn't run Paraglide's Vite plugin, so compile with the CLI before serving and building:
{
"scripts": {
"i18n:compile": "paraglide-js compile --project ./project.inlang --outdir ./src/paraglide --strategy cookie preferredLanguage baseLocale",
"start": "npm run i18n:compile && ng serve",
"build": "npm run i18n:compile && ng build"
}
}
Add paraglide-js compile ... --watch alongside ng serve if you edit messages while the dev server runs. The strategy above remembers the chosen language in a cookie and falls back to the browser language, like a typical translate.getBrowserLang() setup. For Angular SSR, the locale has to be resolved per request with paraglideMiddleware; see server-side rendering.
Check your keys and parameters
Most ngx-translate files compile as they are. Check for three things:
- Lowercase plural suffixes. The i18next plugin reads keys ending in
_zero,_one,_two,_few,_manyor_other(lowercase) as plural forms of one message.item_oneanditem_otherbecomem.item({ count }). Rename such keys if they aren't plurals. Uppercase keys likeSTEP_ONEare not affected. - Dotted parameters. ngx-translate resolves
{{user.name}}from nested params. Paraglide parameters are flat, so{{user.name}}becomes a parameter literally named"user.name". Rename it to{{userName}}and pass{ userName: user.name }; ngx-translate accepts that too. {{in plain text. Any{{ … }}is read as a placeholder, as in ngx-translate.
Compile once with npm run i18n:compile; the generated src/paraglide/messages.js exports one function per key.
ICU messages
If you use ngx-translate-messageformat-compiler, your messages are ICU MessageFormat ({count, plural, one {# item} other {# items}}) with single-brace placeholders. Use the ICU MessageFormat plugin instead of the i18next plugin. It reads top-level keys only, so flatten nested files to dotted keys first; ngx-translate reads flat dotted keys as well. The svelte-i18n migration guide has a flatten script and the plugin configuration.
2. Replace call sites
Expose the generated messages on each component instead of importing TranslatePipe:
import { Component } from "@angular/core";
import { m } from "../paraglide/messages.js";
@Component({
selector: "app-home",
templateUrl: "./home.html",
})
export class Home {
protected readonly m = m;
protected readonly user = { name: "Ada" };
}
<h1>{{ m['HOME.TITLE']() }}</h1>
<p>{{ m['HOME.HELLO']({ name: user.name }) }}</p>
Messages are plain functions that return strings, so they work with OnPush and zoneless change detection: the locale doesn't change while the page is open.
| ngx-translate | Paraglide JS |
|---|---|
{{ 'HOME.TITLE' | translate }} | {{ m['HOME.TITLE']() }} |
{{ 'HOME.HELLO' | translate: { name } }} | {{ m['HOME.HELLO']({ name }) }} |
<div [translate]="'HOME.HELLO'" [translateParams]="{ name }"></div> | <div>{{ m['HOME.HELLO']({ name }) }}</div> |
[title]="'HOME.TITLE' | translate" | [title]="m['HOME.TITLE']()" |
translate.instant('HOME.TITLE', params) | m['HOME.TITLE'](params) |
translate.get(key), translate.stream(key) | m[...]() (synchronous; wrap in of() if an API needs an Observable) |
translate.use('de') | setLocale('de') from paraglide/runtime.js (navigates or reloads) |
translate.currentLang() | getLocale() |
translate.getLangs() | locales from paraglide/runtime.js |
translate.setFallbackLang('en') | baseLocale in project.inlang/settings.json |
translate.onLangChange | Not needed; a locale change loads a new page |
{{ key | translate }} with a variable key | A lookup object of message functions (dynamic keys) |
This Perl command rewrites translate pipes with a literal key in template interpolations, with no params, an object literal, or a variable. It turns {{ 'HOME.TITLE' | translate }} into {{ m['HOME.TITLE']() }} and {{ 'HOME.HELLO' | translate: { name } }} into {{ m['HOME.HELLO']({ name }) }}. Pipes in property bindings, chained pipes, and variable keys are left for you. Commit first and review the diff:
find src -name '*.html' -print0 | xargs -0 perl -pi -e 's{\{\{\s*([\x27"])([^\x27"]+)\1\s*\|\s*translate\s*(?::\s*(\{[^{}]*\}|[\w.]+)\s*)?\}\}}{my ($k, $v) = ($2, $3 // ""); "{{ " . ($k =~ /^[A-Za-z_]\w*$/ ? "m.$k" : "m[\x27$k\x27]") . "($v) }}"}ge'
Then add protected readonly m = m; and the import to each component, and search for what's left:
grep -rnE "\| *translate|translate(Params)?\]|\.instant\(|\.stream\(|translate\.get\(" src
ng build type-checks templates, so a misspelled key or missing parameter now fails the build.
3. Migrate incrementally (optional)
Both libraries read the same JSON files, so you can migrate one component at a time:
- Keep
provideTranslateServiceuntil the last pipe is gone. - Add new keys to the same files; both libraries see them after
i18n:compile. - Keep the two in the same language: pass
lang: getLocale()toprovideTranslateService, and switch languages with Paraglide'ssetLocale().
See incremental migration for the general pattern.
4. Remove ngx-translate
When no ngx-translate APIs remain:
- Remove
provideTranslateService(...)andprovideTranslateHttpLoader(...)fromapp.config.ts, and anyprovideAppInitializerthat calledtranslate.use(). - Uninstall the packages:
npm uninstall @ngx-translate/core @ngx-translate/http-loader(andngx-translate-messageformat-compilerif used). - If nothing else needs the JSON files at runtime, move them out of
public/orassets/so they aren't deployed, and updatepathPattern.
5. Translate missing locales with General Translation
The inlang CLI fills every missing key in your locale files, keeps {{placeholders}} intact, and updates translations whose source message changed. We recommend General Translation, the company that maintains Paraglide JS:
npx @inlang/cli machine translate --project ./project.inlang
The first run asks which provider to use; choose General Translation and sign in through your browser. Review the diff, then check the result:
npx @inlang/cli check --project ./project.inlang
Translating messages covers CI, coding agents, and other providers.
Next steps
- Message keys — flat vs nested keys, and dynamic keys
- Variants — plurals and selects without a separate compiler
- Strategy — how the locale is detected and stored
- Checking translations — fail CI on missing translations or unused messages
