Skip to content

$localize is not found after ng add with cli v15.0.0-next.4 and ng v15.0.0-next.5 #47677

@cexbrayat

Description

@cexbrayat

Command

add

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

14.2.5

Description

Angular v15.0.0-next.5 contains the fix from @alan-agius4 to properly add the @angular/localize polyfill in a CLI app now that the polyfills.ts file is gone. 400a6b5

The polyfill is added when running ng add, but it looks like using $localize still doesn't work.

Error: src/app/app.component.ts:9:11 - error TS2304: Cannot find name '$localize'.

9   title = $localize`i18n-next`;

Minimal Reproduction

npx @angular/cli@15.0.0-next.4 new i18n-next --defaults
cd i18n-next
npm i
ng add @angular/localize@15.0.0-next.5 --skip-confirmation

then update app.component.ts with:

title = $localize`i18n-next`;

and run:

ng extract-i18n --output-path src/locale/

The same repro using the stable release of the CLI and fwk works out of the box.

Exception or Error

Error: src/app/app.component.ts:9:11 - error TS2304: Cannot find name '$localize'.

9   title = $localize`i18n-next`;

Your Environment

Angular CLI: 15.0.0-next.4
Node: 16.17.0
Package Manager: npm 6.14.17
OS: darwin arm64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1500.0-next.4
@angular-devkit/build-angular   15.0.0-next.4
@angular-devkit/core            15.0.0-next.4
@angular-devkit/schematics      15.0.0-next.4
@angular/cli                    15.0.0-next.4
@schematics/angular             15.0.0-next.4
rxjs                            7.5.7
typescript                      4.7.4

Anything else relevant?

No response

Metadata

Metadata

Assignees

Labels

area: i18nIssues related to localization and internationalizationbugregressionIndicates than the issue relates to something that worked in a previous version

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions