Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: The global function $localize is missing. Please add import '@angular/localize'; to your polyfills.ts file #86

Closed
felipe-L-C opened this issue Oct 23, 2019 · 3 comments

Comments

@felipe-L-C
Copy link

felipe-L-C commented Oct 23, 2019

Hello i'm using coreui angular but when i run ng test i get this error:

0 specs, 0 failures, randomized with seed 29334
Error during loading: Uncaught Error: The global function $localize is missing. Please add import '@angular/localize'; to your polyfills.ts file. in http://localhost:9876/_karma_webpack_/vendor.js line 70502.

I searched in several places and found no solution ...

@xidedix
Copy link
Member

xidedix commented Oct 24, 2019

Hi @felipelc454

Angular 9 introduced a global $localize() function that needs to be loaded if you use i18n.

Run :
ng add @angular/localize from the Angular CLI
or
npm install @angular/localize --save

Then make sure you have:

  • @angular/localize as a dependency in your app's package.json
  • import '@angular/localize/init' in your polyfills.ts

Please let us know if it helps.

@felipe-L-C
Copy link
Author

Thank you, my problem is run resolved...

@xidedix
Copy link
Member

xidedix commented Oct 24, 2019

Thanks for the follow-up!

see also: https://next.angular.io/guide/migration-localize#why-is-my-tslint-failing

@xidedix xidedix closed this as completed Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants