jshmrtn / vue3-gettext

Translate Vue 3 applications with gettext.
https://jshmrtn.github.io/vue3-gettext/
MIT License
66 stars 23 forks source link

use vue-gettext-extract on typescript files #4

Closed underdoeg closed 2 years ago

underdoeg commented 2 years ago

Is there a way toe extract translations from typescript *.ts files?

lzurbriggen commented 2 years ago

@underdoeg This was an oversight. I added .ts files to the extract script and created release 1.1.0. I plan to make this more flexible/configurable in the future.

Please let me know if this works for you!

underdoeg commented 2 years ago

That was quick.

I think it works on your side but I think easygettext doesn't like my generated typescript file.

 could not read: './src/api/generated/apigen.ts' using acorn as parser
Trace: TypeError: Cannot read property 'type' of undefined

An exclude config would be nice now because this file doesn't include any translations. But I think we can close this issue.

lzurbriggen commented 2 years ago

@underdoeg I'll find a solution for this, but it may take a while. I wanted to implement configuration files and make easygettext (that we use for extraction) fully configurable.

For now you could just copy and adjust gettext_extract.js to fit your use case, it's a bit messy but not super complex.