Use SimpleLocalize CLI to synchronize your local files with the Translation Editor. The CLI is available for Linux, macOS (Intel and Apple Silicon) and Windows, it does not require any additional dependencies and can be used in CI/CD pipelines. This is an open-source and codebase is available on GitHub.
Installation
You can install the CLI using the following command:
# macOS / Linux / Windows (WSL)
curl -s https://get.simplelocalize.io/2.7/install | bash
# Windows (PowerShell)
. { iwr -useb https://get.simplelocalize.io/2.7/install-windows } | iex;
The script above will download the latest version and replace the current version if installed. Troubles with CLI? See troubleshooting section.
Read Step-by-step guide on how to configure localization workflow with CLI on our blog.
Usage
simplelocalize -c config.yml [COMMAND] --apiKey <PROJECT_API_KEY> rest of parameters...
You can omit -c config.yml
and provide all parameters inline, or create simplelocalize.yml
file which is loaded as default configuration.
Available commands
init
- creates a sample configuration file,upload
- uploads translations files,download
- downloads translations files,auto-translate
- starts auto-translation for your project,pull
- downloads files from Translation Hosting,publish
- publishes translation to Translation Hosting,extract
- finds translation keys in project source code,
A list of available commands can be found on project GitHub page.
Sample configuration file
By default, CLI will try to load configuration from simplelocalize.yaml
file. You can override loaded file using -c
parameter before command name. Below is a sample configuration file:
# Project API Key
apiKey: API_KEY
# Properties used by 'upload' command
uploadPath: ./source-translations/messages_en.json
uploadLanguageKey: en-GB
uploadFormat: single-language-json
uploadOptions:
# by default, the 'upload' command only adds new keys and fills empty translations,
# add this option to overwrite existing translations with values from the uploaded file
- REPLACE_TRANSLATION_IF_FOUND
# Properties used by 'download' command
downloadPath: ./output-translations/messages_{lang}.json
downloadLanguageKeys: ['de-DE', 'fr-FR', 'pl-PL']
downloadFormat: single-language-json
downloadOptions:
- WRITE_NESTED
# Properties used by 'extract' command
searchDir: ./src
projectType: yahoo/react-intl
ignoreKeys:
- 'WELCOME'
- 'ABOUT-US'
# Properties used by 'pull' and 'publish' command
pullPath: ./src/hosting/
environment: '_production' # or '_latest', or 'my_custom'
See all available download and upload options
Get integration snippet
To make the CLI configuration easier, you can get the integration snippet for importing or exporting translations in the 'Data' tab.
Authorization
Most of the CLI command needs to be authorized with --apiKey
.
The API Key can be found in the 'Settings > Credentials > API Key'.