vue-cli-plugin-i18n
vue-cli-plugin-i18n copied to clipboard
Translation generation?
What about a translation generator command?
The goal is to permit the user to write translation keys or raw language text directly on the template like $t('hello !') and then the command extract the translation and push it on the files for you.
Here is a PHP example: https://symfony.com/doc/current/translation.html#extracting-translation-contents-and-updating-catalogs-automatically
WDYT?
it could be a track : https://vue-starter.herokuapp.com/docs/docs/npm-scripts.html#development
Hi! I'm working on this topic.
Currently I’m writing a small and simple script to manage it with static analysis, you can find it here: vue-i18n-extract
My goal is to have something that analyses code statically for key usages in order to:
- Report keys that are missing in the language files
- Report unused keys in the language files
- Add automatically missing keys in the language files
- Remove automatically missing keys in the language files
- Report duplicated keys
The core part is done. My goal is to implement the remaining features within 2 weeks.
Should we think about an integration in the next future?
Feel free to have a look and give feedbacks :)
@pixari
I'm very interesting your project!
In my personal experience I just found difficult to keep the language files and the placeholders in the .vue files in sync.
from why section of your project, I've been just recognizing same issue which you wrote in the document.
I'll plan to develop similar some features to you that improves DX at vue-cli-plugin-i18n.
If your project can also provide an API, maybe, I'll easily to integrate.
Hello @kazupon,
that's great. The API will be available in 2 weeks.
I plan the following API:
- Read, parse and convert a language file into a JS object
- Return unused entries comparing a language file and the strings extracted from one/multiple vue/js files
- Return missing entries comparing a language file and the strings extracted from one/multiple vue/js files
- Write new entries in language file
- Delete entries in language file
- Generate a new language file
You need something else or something more specific, feel free to open one or more issues. ==> https://github.com/pixari/vue-i18n-extract/issues
Hello @kazupon,
vue-i18n-extract made some progress.
The first API are up and running:
- analyzeVueFiles: extract i18n strings from a path (glob patterns are allowed)
- analyzeLanguageFiles: build a Js Object from language files (glob patterns are allowed)
- analyzeI18n: does the magic. It compares the i18n strings with the language files and return the analysis
- logReport: show (as console.log) an analysis
In next days I will provide real documentation and I will implement other API.
https://github.com/pixari/vue-i18n-extract
Cheers.
@pixari Thanks! I'll try to check it later!
move to vue-cli-plugin-i18n, due to be able to provide i18n command of CLI Service.
This is a topic of huge interest for me. Do you need help somehow? Testing, documenting, anything I could do?
@erickwilder Thanks. We have not made anything yet at this moment, as we are going to start now. when It's starting to look good, We might ask for your cooperation. 🙏
Thanks @erickwilder.
@kazupon: this week I'm going to do all the open issues. Would you like somehow to plan something together or you will just check the library at the end?
@pixari Are you working on your own repo (https://github.com/pixari/vue-i18n-extract/issues) or are you moving everything to a branch here? There are many open issues in the original repo - we could sync so that some work could be done in parallel
@erickwilder I am still working on my repo because I still have to "sync" with Kazupon and because there's no much too do.
The core part is done.
It would be great if you would like to help me!
@pixari I've checked your project. I have some requests. I'll feedback to your project with GitHub Issues later.
@pixari I've checked your project. I have some requests. I'll feedback to your project with GitHub Issues later.
Perfect! I'm looking forward to it.
Hello @kazupon, @pixari. Thank you guys for working on this topic. Is there any progress about this?
Hi guys. Today I write this feature on python. It works like, Django makemessages.
If someone want to integrate my utility - you're welcome. Or you can use it simply - add files to your project and run it.
https://github.com/yevheniidehtiar/vue-i18n-generate