Storing translation as JSON files (without TS sugar) #182
-
Hi @mechkg , @lukashroch! I have an idea regarding the vue-i18n translation files. I am about to add two new languages to the code base, which will bring an overall number of default languages to 6. It would be painful enough to update all of the languages if something was added or changed in the prompts survey or admin interface. So, I thought about two options:
Have something along these lines:
Ideally, it will allow running a CLI script that checks English JSON files and syncs all the other languages with them (either automatically or manually).
Any thoughts? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Maintaining lang files will become a chore once the numbers grow, that's for sure. Especially when there are lots of moving parts. Having translations as JSON files should be fine though. I think it's already supported and new vue-i18n for Vue3 might actually have better TS support for JSON (https://vue-i18n.intlify.dev/guide/advanced/typescript.html) also vue-i18n bundler https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n I wouldn't duplicate number of files, like having both So the only thing I would watch out is not to introduce some unnecassary incompatibility with vue3. I think we might just need some overall top-level Re 2, I'm not sure what separate repo would solve in this case? But generally speaking ... please no submodules/subrepositories, they are so much pain :-( Btw I wonder if we should duplicate admin part, as it looks to me it is not yet translated anywhere with those newly added languages? So at the moment it just creates work for us to update |
Beta Was this translation helpful? Give feedback.
Maintaining lang files will become a chore once the numbers grow, that's for sure. Especially when there are lots of moving parts.
Having translations as JSON files should be fine though. I think it's already supported and new vue-i18n for Vue3 might actually have better TS support for JSON (https://vue-i18n.intlify.dev/guide/advanced/typescript.html) also vue-i18n bundler https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n
I wouldn't duplicate number of files, like having both
common.ts
andcommon.json
, you can just have latter and load then from top level. Basically, convert.ts
to.json
.So the only thing I would watch out is not to introduce some unnecassary i…