ngx-i18nsupport: Extraction stopped working after Angular upgrade 12 -> 13

> ng run pt-client:xliffmerge

An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for schema ID
See "/private/var/folders/q7/665kbmk952b7b_1dr7hyxybcwwrrp9/T/ng-9gMGfZ/angular-errors.log" for further details.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! pt-client@0.0.6 tool:i18n:merge: `ng run pt-client:xliffmerge`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the pt-client@0.0.6 tool:i18n:merge script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/bernhard.behrendt/.npm/_logs/2021-11-04T15_05_50_035Z-debug.log

I’ve actually tried to solve in Pull Request #196 which break actually on jasmine test part

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 15
  • Comments: 17

Most upvoted comments

I created a xliff merge tool that nicely integrates with Angular CLI and (probably) caters most needs of former users of this tooling: https://github.com/daniel-sc/ng-extract-i18n-merge Feedback welcome! 😃

+1 for a maintained fork or a native solution, merging xliff’s is essential!

For anyone using XLIFF 2.0: I created some lighweight tooling to merge translations - see https://dev.to/danielsc/angular-i18n-update-workflow-25p6 (probably this could be I extended this for XLIFF 1.2 as well!)

I use now the following workaround: Created a new folder parallel to my project and run:

npm install @angular/core@12
npm install @ngx-i18nsupport/ngx-i18nsupport

In the file you have to fix a bug: node_modules/@ngx-i18nsupport/ngx-i18nsupport/src/xliffmerge/xliff-merge.js:35 Replace i = 1 with i = 2.

Then switch back to your actual Angular project.

There I created a xliffmerge.json as written there https://github.com/martinroob/ngx-i18nsupport/tree/master/projects/xliffmerge But I also merged the options from my angular.json into it.

Then I can run this to merge: node ../other-installation/node_modules/@ngx-i18nsupport/ngx-i18nsupport/src/xliffmerge/main.js --profile xliffmerge.json

I hope this helps. Maybe someone has an easier fix.

Hey we’ve ported back to Angular 12 and postponed the upgrade. Actually we could also imagine to extend this lib by our own as it’s really a very good way to keep translations in sync within the angular-cli flow. As it’s a paid project I’ve to wait, until my client raises up this translation issue in priority.

@martinroob Do you have any plans for this project in the future?

I can highly Daniel’s project above. I replaced xliff merge with it in our rather complicated i18n workflow and it’s working great. He made a few bug fixes and enhancements for me extremely quickly, too.

Hi guys, i got the same problem as you. I have try to update the lib but i’m stuck with this problem on the command line : SyntaxError: Cannot use import statement outside a module

I started with this PR but fixed 2-3 more problems because I was not able to compile the code on my machine (node 14.18.2). I am able to compile ngx-i18nsupport and ngx-i18nsupport-lib. I did not attempt to compile tooling because I am not using it for my project.

To do this first change the version of the packages by the relative path because there is a dependency between the libs. Then I run yarn run buildall (it didn’t work with npm). The command crashes at the toolings level and to finish the build I do cd projects / xliffmerge && yarn run build. The lib compiles successfully but I cannot run the xliffmerge command from my terminal … I’m getting stuck here

I think we will have to fork, the author seems to have disappeared and don’t want to give any sign of life.

My code : https://github.com/filol/ngx-i18nsupport

@BernhardBehrendt @martinroob