Skip to content

No polyfill entry breaks $localize.  #27786

@jnizet

Description

@jnizet

Which @angular/* package(s) are the source of the bug?

core, localize

Is this a regression?

No

Description

In zoneless mode (i.e. with provideExperimentalZonelessChangeDetection() and without the zone.js polyfill), as soon as an i18n attibute is present in a template, an error is displayed about $localize() not being loaded, even after having executed ng add @angular/localize.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

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.)

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 18.0.2
Node: 20.12.2
Package Manager: npm 10.5.0
OS: darwin x64

Angular: 18.0.1
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1800.2
@angular-devkit/build-angular   18.0.2
@angular-devkit/core            18.0.2
@angular-devkit/schematics      18.0.2
@angular/cli                    18.0.2
@schematics/angular             18.0.2
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.6

Anything else?

Adding the explicit import mentioned in the error message to the main.ts file, or adding @angular/localize/init to the polyfill, fixes the issue.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions