This package provides a CLI to manage your Vue I18n project synchronized with Translation.io.
Currently it only supports the usage of the $t
and $tc
methods inside your .vue & .js files.
You can install it globally by running this command
npm install @translation/vue -g
This will give you access to the translation-vue
script.
If you install it locally on a specific project, you will have to use the path instead: node_modules/@translation/vue/bin/index.js
.
npm install @translation/vue --save
Go to your Translation.io account page and create a new project. Once the project is created, you'll see the configuration file. It should look like this :
{
"key": "YOUR_PROJECT_API_KEY",
"source_locale": "en",
"target_locales": ["fr-BE", "nl-BE"],
"source_path": "/src/**/*.?(js|vue)",
"translations_directory": "/src/locales/",
"translations_type": "key",
"default_empty": false
}
key
: the API key for your Translation.io projectsource_locale
: Source localetarget_locales
: Target localessource_path
: Where is located your source filestranslations_directory
: Where are located your translations filestranslation_type
: Eitherkey
orsource
default_empty
: Only for the key type. If true, it'll push the key as the source translation.
Itialize your project and push existing translations to Translation.io with:
translation-vue init
Send new translatable keys/strings and get new translations from Translation.io.
translation-vue sync
If you need to remove unused keys/strings from Translation.io, using the current application as reference.
translation-vue sync --purge
As the name says, this operation will also perform a sync at the same time.
Warning: all keys that are not present in the current application will be permanently deleted from Translation.io.