From 5dfbcd56319a42cc146eee94e8dc716c27817c0e Mon Sep 17 00:00:00 2001 From: vikerman Date: Wed, 16 Oct 2019 11:58:25 -0700 Subject: [PATCH] fix(core): add CLI instructions when localize polyfill is missing (#33199) PR Close #33199 --- integration/side-effects/snapshots/core/esm2015.js | 2 +- integration/side-effects/snapshots/core/esm5.js | 2 +- packages/core/src/core.ts | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/integration/side-effects/snapshots/core/esm2015.js b/integration/side-effects/snapshots/core/esm2015.js index 4a4b8bf84e..e74eaf1bfd 100644 --- a/integration/side-effects/snapshots/core/esm2015.js +++ b/integration/side-effects/snapshots/core/esm2015.js @@ -13,5 +13,5 @@ const __global = "undefined" !== typeof global && global; const _global = __globalThis || __global || __window || __self; if (ngDevMode) _global.$localize = _global.$localize || function() { - throw new Error("It looks like your application or one of its dependencies is using i18n.\n" + "Angular 9 introduced a global `$localize()` function that needs to be loaded.\n" + "Please add `import '@angular/localize/init';` to your polyfills.ts file."); + throw new Error("It looks like your application or one of its dependencies is using i18n.\n" + "Angular 9 introduced a global `$localize()` function that needs to be loaded.\n" + "Please run `ng add @angular/localize` from the Angular CLI.\n" + "(For non-CLI projects, add `import '@angular/localize/init';` to your polyfills.ts file)"); }; diff --git a/integration/side-effects/snapshots/core/esm5.js b/integration/side-effects/snapshots/core/esm5.js index e969f1091b..5ed318e20d 100644 --- a/integration/side-effects/snapshots/core/esm5.js +++ b/integration/side-effects/snapshots/core/esm5.js @@ -15,5 +15,5 @@ var __global = "undefined" !== typeof global && global; var _global = __globalThis || __global || __window || __self; if (ngDevMode) _global.$localize = _global.$localize || function() { - throw new Error("It looks like your application or one of its dependencies is using i18n.\n" + "Angular 9 introduced a global `$localize()` function that needs to be loaded.\n" + "Please add `import '@angular/localize/init';` to your polyfills.ts file."); + throw new Error("It looks like your application or one of its dependencies is using i18n.\n" + "Angular 9 introduced a global `$localize()` function that needs to be loaded.\n" + "Please run `ng add @angular/localize` from the Angular CLI.\n" + "(For non-CLI projects, add `import '@angular/localize/init';` to your polyfills.ts file)"); }; diff --git a/packages/core/src/core.ts b/packages/core/src/core.ts index 11511b64ce..5375bdb0d6 100644 --- a/packages/core/src/core.ts +++ b/packages/core/src/core.ts @@ -47,6 +47,7 @@ if (ngDevMode) { throw new Error( 'It looks like your application or one of its dependencies is using i18n.\n' + 'Angular 9 introduced a global `$localize()` function that needs to be loaded.\n' + - 'Please add `import \'@angular/localize/init\';` to your polyfills.ts file.'); + 'Please run `ng add @angular/localize` from the Angular CLI.\n' + + '(For non-CLI projects, add `import \'@angular/localize/init\';` to your polyfills.ts file)'); }; }