Translation.io client for Vue.js
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.
Installation
npm install @translation/vue --save
Configuration
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
: Either key
or source
default_empty
: Only for the key type. If true, it'll push the key as the source translation.
Usage
Init
Itialize your project and push existing translations to Translation.io with:
translation-vue init
Sync
Send new translatable keys/strings and get new translations from Translation.io.
translation-vue sync
Sync & Purge
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.