After updating our Angular app from version 14.0.4 to version 15.1.3 (also tried 15.1.2 before) we get the following error when trying to access the app:
Uncaught Error: It looks like your application or one of its dependencies is using i18n.
Angular 9 introduced a global `$localize()` function that needs to be loaded.
Please run `ng add @angular/localize` from the Angular CLI.
(For non-CLI projects, add `import '@angular/localize/init';` to your `polyfills.ts` file.
For server-side rendering applications add the import to your `main.server.ts` file.)
So the problem is, that we already did those steps many updates ago. As you can see also from the description, this is sth. introduced with version 9. But we are running version 14 (and earlier) without any issues of this kind. The app compiles without errors and this is a run-time error.
I also tried re-running the mentioned command ng add @angular/localize
after the version update, which just adds @angular/localize
to the types array in the tsconfig, but it still fails with the same error.
I did the update following the recommended angular update website (https://update.angular.io/?l=3&v=14.0-15.0) and also updated all other co-dependencies to the newest version (like material, NgRx, typescript etc.)
We use $localize
either directly in components, for example:
private readonly onLabel = $localize`:@@common_onLabel:`;
Or also in a shared way like this:
export const i18nD = $localize`:@@components_timeDisplay_shortDaysFormat:` as 'd';
I would appreciate any ideas or steps I could try, because I'm running out of ideas what to try next.