Loading Translations (with or without AOT)
Angular can load translations at build time (AOT) or runtime (JIT).
Build-time example:
ng build --localizeRuntime example using loadTranslations() in Angular 17+:
import { loadTranslations } from "@angular/localize";
loadTranslations({ "Hello, {{ name }}!": "Bonjour, {{ name }}!",});Explanation:
- AOT embeds translations in compiled code
- Runtime allows switching locales without rebuilding