martinroob / ngx-i18nsupport

Some tooling to be used for Angular i18n workflows
MIT License
283 stars 69 forks source link

Extraction stopped working after Angular upgrade 12 -> 13 #197

Open BernhardBehrendt opened 2 years ago

BernhardBehrendt commented 2 years ago
> 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

DarkAtra commented 2 years ago

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

dhcode commented 2 years ago

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.

jtammen commented 2 years ago

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…

joseluiz98 commented 2 years ago

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.

fknet commented 2 years ago

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.

jtammen commented 2 years ago

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 (-:

DaSchTour commented 2 years ago

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.

BernhardBehrendt commented 2 years ago

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?

Raphyyy commented 2 years ago

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

filol commented 2 years ago

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

BernhardBehrendt commented 2 years ago

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.

wallace41290 commented 2 years ago

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

daniel-sc commented 2 years ago

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 commented 2 years ago

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

Andrew-Marks-Trisept commented 2 years ago

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.

telmaco commented 2 years ago

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 🎉😊

sistla001 commented 2 years ago

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.