rxaviers / react-globalize-compiler

I18n support for React applications using Globalize
MIT License
5 stars 2 forks source link

Failes to extract messages from files compiled with TypeScript #9

Closed unindented closed 8 years ago

unindented commented 8 years ago

It looks like react-globalize-compiler is not able to extract messages from files compiled with TypeScript instead of Babel. Do you think it'd be possible to support TypeScript?

rxaviers commented 8 years ago

I believe so, it requires transforms similar to these ones: https://github.com/rxaviers/react-globalize-compiler/tree/master/lib/extract-transforms.

The ideal solution would not be using these transforms and instead keeping a table of variables (per scope) dynamically generated from require("globalize"), or define(["globalize"...) calls, orimport` declaration. But, that is much more complex. The transforms are not great, but easier and gets the job done.

Do you want to implement that? Basically, you need to observe the output generated from TypeScript and check which variables are created, are they always the same. Just let me know if you have any questions.

unindented commented 8 years ago

I fell back to using globalize and globalize-compiler, as I don't have the time to contribute those transforms right now. I'll try to revisit in the future.

rxaviers commented 8 years ago

Ok, thanks. I'm closing it for now then. We could reopen it anytime.