extract-18n skip some modules
Closed this issue · 3 comments
Describe the bug
I have an angular app developped with lazy-loaded modules architecture. I have a CoreModule, a SharedModule and some features modules grouped in the features folder. When I run ng extract-i18n it extract every string marked for translation inside the features folder but none of those inside CoreModule and SharedModule.
Setup/Configuration
The extract-i18n entry in my angular.json file is like below :
"extract-i18n": {
"builder": "ng-extract-i18n-merge:ng-extract-i18n-merge",
"options": {
"browserTarget": "melofeel-front:build",
"format": "xlf2",
"outputPath": "src/locale",
"targetFiles": [
"messages.fr.xlf"
],
"sort": "idAsc"
}
},
Expected behavior
I'd like to have all the marked string to appear in my messages.fr.xlf file.
Version (please complete the following information):
- Angular: 14.2.12
- OS: Win10
- nodejs: 18.12.1
- ng-extract-i18n-merge version: 2.5.1.
Hi @JleHi
Thanks for reporting this!
Would you be able to share a (minimal) reproduction? Preferably a git repo I could checkout and run npm install
with a subsequent ng extract-i18n
on to reproduce it.
Hi @daniel-sc ,
Thanks for your answer.
I've created a git repo on Github as you asked. I hope it is accessible, it's my first one : https://github.com/JleHi/repro-extract-i18n-missing-translations/
I can't post the project as it is so I made a short version of it for your tests. It has a slightly different comportment than the other: this one take the translations from CoreModule in account. But like the other the SharedModule seems to be ignored.
I've done this one in a hurry before leaving, let me know if something is wrong.
Thanks again.
@JleHi thanks for providing a reproduction!
It seems that the component in your shared module was not at all used in your application - this directly implies that the translations from this component cannot be extracted by angular (and cannot be managed by this plugin).
To prove this, I used the shared component in one of your feature components and then the i18n text is contained in the messages.(fr.)xlf - see JleHi/repro-extract-i18n-missing-translations#1
Please reopen, if there is some other problem I overlooked!