fix(core): improve the "missing `$localize`" error message (#32491)
We need to be clearer to developers who upgrade to v9 (next) and get this error, why they have a problem and what they have to do about it. Once we have a better CLI schematics story, where this import will be included by default in new applications and a CLI migration will add it when upgrading apps to v9, we could simplify or remove this error message. PR Close #32491
This commit is contained in:
parent
da42a7648a
commit
a9ff48e67f
|
@ -13,5 +13,5 @@ const __global = "undefined" !== typeof global && global;
|
||||||
const _global = __globalThis || __global || __window || __self;
|
const _global = __globalThis || __global || __window || __self;
|
||||||
|
|
||||||
if (ngDevMode) _global.$localize = _global.$localize || function() {
|
if (ngDevMode) _global.$localize = _global.$localize || function() {
|
||||||
throw new Error("The global function `$localize` is missing. Please add `import '@angular/localize';` 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 add `import '@angular/localize';` to your polyfills.ts file.");
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,5 +15,5 @@ var __global = "undefined" !== typeof global && global;
|
||||||
var _global = __globalThis || __global || __window || __self;
|
var _global = __globalThis || __global || __window || __self;
|
||||||
|
|
||||||
if (ngDevMode) _global.$localize = _global.$localize || function() {
|
if (ngDevMode) _global.$localize = _global.$localize || function() {
|
||||||
throw new Error("The global function `$localize` is missing. Please add `import '@angular/localize';` 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 add `import '@angular/localize';` to your polyfills.ts file.");
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,6 +45,8 @@ if (ngDevMode) {
|
||||||
// tslint:disable-next-line: no-toplevel-property-access
|
// tslint:disable-next-line: no-toplevel-property-access
|
||||||
global.$localize = global.$localize || function() {
|
global.$localize = global.$localize || function() {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'The global function `$localize` is missing. Please add `import \'@angular/localize\';` to your polyfills.ts file.');
|
'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\';` to your polyfills.ts file.');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue