ng-extract-i18n-merge
ng-extract-i18n-merge copied to clipboard
Usage with Nx
Hello,
Could it be possible to support Nx by at least be able to handle both angular.json and workspace.json ? I'm using a workspace.json file instead of angular.json and target extract-i18n-merge is not added when installing ng-extract-i18n-merge package, so I can't use that command.
yarn ng add ng-extract-i18n-merge
produces
NX Cannot find project 'ng-extract-i18n-merge'
and
yarn run [PROJECT_ID]:extract-i18n-merge
yarn nx run [PROJECT_ID]:extract-i18n-merge
produces
NX Cannot find target 'extract-i18n-merge' for project [PROJECT_ID]
Thanks
I manage to have the target added by running
yarn add -W ng-extract-i18n-merge && yarn nx g ng-extract-i18n-merge:ng-add
then
yarn nx run [PROJECT_ID]:extract-i18n-merge
So it's seems to be working with Nx by using these commands.
@danjor thanks for bringing this up! I admit, that I did not work with nx yet .. to get this working seamlessly with nx, I'd need some concrete requirements. Could you help with this? (additionally I'd help if you could share your project layout (files/folders) and workspace.json)
"localize": "nx affected --target=extract-i18n-merge",
This is what I use for NX and it works perfectly
I am using this with nx workspace. Works perfect and supports nx affected.
"extract-i18n": {
"executor": "ng-extract-i18n-merge:ng-extract-i18n-merge",
"options": {
"browserTarget": "web:build",
"format": "xlf",
"outputPath": "apps/web/src/locales",
"targetFiles": ["messages.de-DE.xlf"]
}
},
Yes I am also using a similar config and everything works. (You need these in project.json)
And then you can just do: nx run <project>:extract-i18n