vendure-ecommerce / ngx-translate-extract

Extract translatable (using ngx-translate) strings and save as a JSON or Gettext pot file
MIT License
51 stars 19 forks source link

Translation ignored in ts with <any> cast #50

Closed DeepSnowNeeL closed 5 months ago

DeepSnowNeeL commented 5 months ago

Hello, I recently upgraded from 8.3.0 to 9.1.1 and some keys went missing with the new extraction, after some research it looks like this line of code makes the parser crash in a .ts file

if (<any>this.editor) (<any>this.editor)._editor.updateOptions({ readOnly: this._disabled });

In this context : image

It seems related to #43

I saw that the 9.1.1 version was published 3month ago so just tried with 9.2.0-next.0 and the bug is still present

(I'd love a new preview release of 9.2.0 if you fix it so that I can swap to the newer version of the tool, we recently upgraded to angular 18 and started using the new control flow syntax :) Thanks ! )

pmpak commented 5 months ago

Hello @DeepSnowNeeL,

I'll try to double check the fix on the parser.

In the meantime could you try to change the (<any>this.editor) to (this.editor as any) and see if this workaround does the trick?

DeepSnowNeeL commented 5 months ago

Thanks for the fast reply :) It indeed does the trick, great ! I'll try the new version against my whole codebase and fix the casts for now

I'll let you close the issue or not, depending on your research. don't hesitate to ping if you need tests from me

PS : thanks a lot to your team for maintaining this fork, couldn't live without an automated way to extract translations :p

pmpak commented 5 months ago

The issue was that the initial fix was taking care only the use cases of the marker function. The service parser was still interpreting the input as TSX and treated the <T> castings as JSX template. I have now updated the parsers to ensure they all use the correct type.

michaelbromley commented 5 months ago

This fix was just published in v9.2.0 👍