Closed tcitworld closed 2 years ago
Hi @tcitworld, I just released 2.2.0-alpha.1 with this feature.
Enable it in the config using config.output.splitJson
and make sure your config.output.jsonPath
(if set) ends with a directory, not a json file.
The locale json files containe their own locale keys, so postloading could work like this:
import italian from "./it_IT.json";
const language = useGettext();
language.translations = {
...language.translations,
...italian,
};
Please test this prerelease and let me know if it works for you.
Looks perfect, I can even load locales dynamically using this.
Released with 2.2.0
Using
gettext-compile
it was possible to export each language in their own JSON file, so that it can be dynamically loaded, something like:In
next
gettext_compile.ts
doesn't support that. This could be handled with asplit
option underoutput
ingettext.config.js
.