Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 9 introduced a global '$localize()' function that needs to be loaded

I'm getting the following error in my new angular project setup.

Installed Packages and its versions

ERROR Error: Uncaught (in promise): 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 add import '@angular/localize'; to your polyfills.ts file. 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.

Note: I came from the following. It suggests falling back to old version. https://github.com/angular/angular/issues/32508

like image 972
Balaganesan Ravichandran Avatar asked Sep 16 '19 08:09

Balaganesan Ravichandran


People also ask

What is angular localize init?

@angular/localize/initlinkThe @angular/localize package exposes the $localize function in the global namespace, which can be used to tag i18n messages in your code that needs to be translated.

What is the use of angular localize?

Angular Internationalizationlink Localization is the process of building versions of your project for different locales. The localization process includes the following actions. A locale identifies a region in which people speak a particular language or language variant.

What is extract i18n?

1. Angular CLI provides extract-i18n command to extract the marked text in the component into a source language file. 2. The extract-i18n command is run from project root directory as following. ng extract-i18n.


1 Answers

You need to make sure you have the @angular/localize package first:

npm install @angular/localize --save

Then, import '@angular/localize/init' in your polyfills.ts file just like the error says

like image 160
rhino5oh Avatar answered Nov 03 '22 19:11

rhino5oh