angular / angular-cli

CLI tool for Angular
https://cli.angular.dev
MIT License
26.78k stars 11.98k forks source link

Bug: ng xi18n --ivy does not extract i18n tokens from libraries #18871

Closed kyubisation closed 4 years ago

kyubisation commented 4 years ago

🐞 Bug report

Command (mark with an x)

Is this a regression?

This works with ng xi18n

Description

ng xi18n --ivy does not extract i18n tokens from libraries, whereas ng xi18n is able to extract it from libraries compiled with ViewEngine.

πŸ”¬ Minimal Reproduction

https://github.com/kyubisation/xi18n-ivy-library-viewengine Run npm ci && npm test (which build the ViewEngine and Ivy libraries and runs xi18n) and check messages.xlf

🌍 Your Environment



Angular CLI: 10.1.3
Node: 12.9.1
OS: win32 x64

Angular: 10.1.3
... animations, cli, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1001.3
@angular-devkit/build-angular   0.1001.3
@angular-devkit/core            10.1.3
@angular-devkit/schematics      10.1.3
@schematics/angular             10.1.3
@schematics/update              0.1001.3
ng-packagr                      10.1.0
rxjs                            6.6.3
typescript                      4.0.3

Anything else relevant?

petebacondarwin commented 4 years ago

This is by design. The ng xi18n --ivy only processes the application files. It is possible to process libraries for their i18n messages using the standalone extractor tool.

node_modules/.bin/localize-extract -s "node_modules/**/*.js" -f xlf -o library-messages.xlf

We are looking at how this can be incorporated into the CLI.

kyubisation commented 4 years ago

Ok, that is unfortunate. Nevertheless thanks for the answer and the workaround. πŸ‘

kyubisation commented 4 years ago

I quickly tested this with our code base and it works as expected. We will adapt angular-t9n to deal with this. Thanks again for the quick answer. πŸ˜ƒ

angular-automatic-lock-bot[bot] commented 4 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.