Cropster / ember-l10n

A GNU gettext based localization workflow for Ember
MIT License
15 stars 7 forks source link

Translations in TypeScript files are ignored #36

Closed Znegl closed 6 years ago

Znegl commented 6 years ago

When extracting translations from an Ember project using TypeScript, all translations in *.ts files are ignored.

I fixed the bug localy by changing directories.map(dir => `${dir}/**/*.js`) to directories.map(dir => `${dir}/**/*.ts`) inside of _extractFromJS (which in turn breaks JS support).

I would like to create a pull request with a better fix, but before I do that, it would be nice to know if you prefer a new function called _extractFromTS or if I should just expand on the JS function to include *.ts files as well.

arm1n commented 6 years ago

Hey there! Thanks for reporting this. Yes, at the moment only JS files are supposed to be extracted, so we have to ideally add some configuration setting with a meaningful default. A quick way would be to setup the glob path with ${dir}/**/*.{ts, js}. There's also a PR from my colleague waiting for review and merge, so we could also include this one in the next version - PRs are welcome, thank you :)

mydea commented 6 years ago

I added this minimal solution to #35. I guess in the future it would be nice to make this whole lookup process more customizable, e.g. by making this part: /**/*.{js,ts} customizable.

Znegl commented 6 years ago

Sounds great! Then I wont do anything for now.

arm1n commented 6 years ago

This was fixed with v2.1.0.