ngx-i18nsupport icon indicating copy to clipboard operation
ngx-i18nsupport copied to clipboard

Extraction stopped working after Angular upgrade 12 -> 13

Open BernhardBehrendt opened this issue 4 years ago • 17 comments
trafficstars

> 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! [email protected] tool:i18n:merge: `ng run pt-client:xliffmerge`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] 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

BernhardBehrendt avatar Nov 04 '21 16:11 BernhardBehrendt

hey @BernhardBehrendt, do you know anyworkaround that we could use while we wait for the PR to be merged?

also: thanks for your work! i was happy to see that you have already created an issue and a PR for this :D

DarkAtra avatar Nov 16 '21 09:11 DarkAtra

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.

dhcode avatar Nov 16 '21 17:11 dhcode

I also got hit by this after upgrading to Angular 13.

@dhcode Thanks for the workaround, works for me, as well!

Does anyone know if there is an actively maintained fork of this or maybe some alternative tool? I was thinking that there must be something out there because the problem xliffmerge solves does not seem like a very exotic problem to have…

jtammen avatar Nov 24 '21 12:11 jtammen

I have teh exatc same problema fter updating angular 12 -> 13, but didn't found any other plugins to do that feature of merging xlf files.

joseluiz98 avatar Nov 24 '21 19:11 joseluiz98

I have tried out angular-t9n for some time now, and it does support merging of xlf files! It is unfortunately not up-to-date, but does work well with Angular 13. Maybe this can be an alternative for you.

fknet avatar Nov 25 '21 06:11 fknet

I have tried out angular-t9n for some time now, and it does support merging of xlf files! It is unfortunately not up-to-date, but does work well with Angular 13. Maybe this can be an alternative for you.

@fknet Thanks for the tip, I will give it a try (-:

jtammen avatar Nov 25 '21 08:11 jtammen

I have tried out angular-t9n for some time now, and it does support merging of xlf files! It is unfortunately not up-to-date, but does work well with Angular 13. Maybe this can be an alternative for you.

For me it looks like a very different tool. I just want to have the simple merging of xliff, not a lot of stuff more. I already have tools for translations. It's really sad that this library isn't maintained anymore.

DaSchTour avatar Dec 21 '21 14:12 DaSchTour

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?

BernhardBehrendt avatar Dec 29 '21 09:12 BernhardBehrendt

Same here

According to Martin's contributions, we have no update from him since November 2019 so I'm afraid that we have to move on up with a fork or a new tool

Raphyyy avatar Dec 29 '21 13:12 Raphyyy

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

filol avatar Dec 29 '21 16:12 filol

Salut @filol thats great that you've started working on it and bringing things forward. Have you been lucky so far or can we support you maybe in the process? I've given up as it wasn't that easy afaik to integrate without npm environment and we had several other issues after upgrading to 13.x (mostly rxjs stuff).

Let me know if we can support you and I'll try to convince our client to focus on this topic asap.

BernhardBehrendt avatar Jan 12 '22 14:01 BernhardBehrendt

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

wallace41290 avatar Jan 19 '22 18:01 wallace41290

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

daniel-sc avatar Jan 20 '22 14:01 daniel-sc

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! :)

daniel-sc avatar Feb 01 '22 13:02 daniel-sc

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.

Andrew-Marks-Trisept avatar Mar 24 '22 16:03 Andrew-Marks-Trisept

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! :)

Thank you Daniel! Successfully replaced 🎉😊

telmaco avatar Apr 15 '22 12:04 telmaco

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! :)

Thank you @daniel-sc. This is exactly what I am looking for for the past 2 years or so. With angular 10, I was taking the work-around by using localize-extract multiple times (Once for libraries, then for 3rd parties), then xlf-merge to merge the messages, and then use @ngx-i18nsupport/tooling to merge into language files. All this is now just simplified with one command after upgrading to Angular 14.

sistla001 avatar Jul 23 '22 14:07 sistla001