jshmrtn / vue3-gettext

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

`$locale/app.po` hard-coded into locale compile script #49

Open BusterNeece opened 11 months ago

BusterNeece commented 11 months ago

Hey all! Thanks for your work in bringing this very useful tool to Vue 3.

I'm trying to use the JSON compiler tool to assist in building translations for my app, but I'm noticing that the paths for the individual locales are hard-coded in a few places.

In my case, my folder structure looks like:

translations
|  es_ES.UTF-8
|  |  LC_MESSAGES
|  |  |  default.po

I can override the folder name by just setting the locale name as es_ES.UTF-8/LC_MESSAGES (although that feels a little hacky), but the extractor hard-codes in the app.po path afterwards. That isn't the namespace I use for my translations, and renaming it would involve a lot of downstream difficulty.

Would it be possible to have the locales config optionally be a callback function returning the path for each locale's translation? Similar to the existing map call that's done on the library side, but checking if the config value is a function and then calling that instead to yield the locales to work with and their respective paths.

lzurbriggen commented 11 months ago

@BusterNeece

That isn't the namespace I use for my translations

the namespace and .po-file names don't have to match, do they? also check out flat: true in the output settings, maybe that fits your needs better.

we will consider adding something like this for the next major version that will have quite a few breaking changes, but i'm afraid we cannot justify investing much time in this project at the moment.

feel free to open a PR and implement it yourself if this is very important to you.