voko is a powerful, interactive CLI tool for managing i18n (internationalization) in your JavaScript and TypeScript projects. It automates the setup, translation, and synchronization of locale files using popular translation engines.
- Interactive Setup: Easy-to-use wizard to configure your languages and preferences.
- Multi-Engine Support: Use Google Translate, DeepL, LibreTranslate, or Yandex.
- Automatic Translation: Automatically translates missing keys in your locale files.
- Strict Sync: Optionally remove keys that are no longer present in your base language file.
- CI/CD Friendly: Supports CLI flags for automated environments.
- Framework Agnostic: Works with any project structure (React, Vue, Node.js, etc.).
Spanish (es), French (fr), German (de), Italian (it), Portuguese (pt), Dutch (nl), Russian (ru), Polish (pl), Ukrainian (uk), Swedish (sv), Danish (da), Finnish (fi), Norwegian (no), Greek (el), Czech (cs), Romanian (ro), Hungarian (hu)
Chinese (Simplified) (zh), Chinese (Traditional) (zh-TW), Japanese (ja), Korean (ko), Hindi (hi), Arabic (ar), Turkish (tr), Vietnamese (vi), Thai (th), Indonesian (id), Malay (ms), Bengali (bn), Hebrew (he)
English (US) (en), Spanish (Mexico) (es-MX), Portuguese (Brazil) (pt-BR), French (Canada) (fr-CA)
Swahili (sw), Amharic (am), Yoruba (yo), Zulu (zu), Afrikaans (af)
English (Australia) (en-AU)
You can use voko directly with npx or install it globally/locally.
# Run directly
npx @yashkhare0/voko-cli init
# Install globally
npm install -g voko-cli
# Install as dev dependency
npm install -D voko-cli
pnpm add -D voko-cli
yarn add -D voko-cliRun the init command to set up your project. This will create a voko.config.json file.
npx @yashkhare0/voko-cli initYou will be prompted for:
- Base Language File: The path to your source of truth (e.g.,
src/locales/en.json). - Base Language: The language code of your base file (e.g.,
en). - Target Languages: Select from a list of regions or choose specific languages.
- Translation Engine: Choose your preferred service (Google, DeepL, etc.).
- API Key: If required, provide the name of the environment variable storing your API key.
Non-Interactive Mode (Flags):
npx @yashkhare0/voko-cli init \
--base-file src/locales/en.json \
--base-lang en \
--languages es,fr,de \
--engine deepl \
--api-key-env DEEPL_API_KEYRun the sync command to update your locale files. This will:
- Read your base language file.
- Find missing keys in your target language files.
- Translate the missing values.
- Write the updates to the files.
npx @yashkhare0/voko-cli syncStrict Mode:
To remove keys from target files that are no longer in the base file:
npx @yashkhare0/voko-cli sync --strictYour configuration is stored in voko.config.json:
{
"baseLanguage": "en",
"baseFile": "src/locales/en.json",
"languages": ["es", "fr"],
"engine": "deepl",
"apiKeyEnvVar": "DEEPL_KEY"
}If you are using an engine that requires an API key (DeepL, Yandex, etc.), make sure the environment variable you specified in the config is set in your environment or a .env file.
# .env
DEEPL_KEY=your-api-key-hereTo test the package locally before publishing:
npm link
cd /path/to/test/project
voko-cli initnpm testnpm run lint
npm run formatThis project uses semantic-release for automated versioning and publishing to npm.
-
Get an NPM Access Token:
- Go to npmjs.com
- Navigate to Account Settings → Access Tokens
- Generate a new "Automation" token
-
Add Token to GitHub Secrets:
- Go to your repository settings
- Navigate to Secrets and variables → Actions
- Add a new secret named
NPM_TOKENwith your token value
Versioning is fully automated based on commit messages:
feat:commits → minor version bump (0.1.0 → 0.2.0)fix:commits → patch version bump (0.1.0 → 0.1.1)BREAKING CHANGE:in commit body → major version bump (0.1.0 → 1.0.0)
Example commits:
git commit -m "feat: add language presets for EU and Asia"
git commit -m "fix: correct translation API handling"
git commit -m "feat!: redesign config format
BREAKING CHANGE: config format has changed"When you push to the main branch:
- Tests and linting run automatically
- If tests pass, semantic-release determines the new version
- A GitHub release is created with changelog
- The package is published to npm
Contributions are welcome! Please see CONTRIBUTING.md for details.
MIT
If you encounter errors related to API keys (e.g., with DeepL or Google Translate), ensure that:
- You have correctly set the environment variable in your shell or
.envfile. - The environment variable name matches what is in
voko.config.json. - Your API key has sufficient quota and permissions.
If voko or voko-cli is not found, try running it with npx:
npx @yashkhare0/voko-cli syncOr ensure your global installation path is in your system's PATH.