ng-extract-i18n-merge icon indicating copy to clipboard operation
ng-extract-i18n-merge copied to clipboard

Usage with Nx

Open danjor opened this issue 3 years ago • 5 comments
trafficstars

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

danjor avatar May 02 '22 09:05 danjor

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 avatar May 02 '22 10:05 danjor

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

daniel-sc avatar May 04 '22 08:05 daniel-sc

"localize": "nx affected --target=extract-i18n-merge",

This is what I use for NX and it works perfectly

davidyoung77 avatar Aug 30 '22 21:08 davidyoung77

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"]
      }
    },

maxbeba avatar May 05 '23 10:05 maxbeba

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

LeLunZ avatar Jul 03 '24 13:07 LeLunZ