CLI: Get started

Last updated: February 28, 2024Author: Jakub Pomykała

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.5/install | bash

# Windows (PowerShell)
. { iwr -useb https://get.simplelocalize.io/2.5/install-windows } | iex;

The script above will download the latest version and replace the current version if installed. Troubles with CLI? See troubleshooting section.

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

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.

# Common
apiKey: API_KEY

# Upload command
uploadPath: ./src/translations.json
uploadFormat: multi-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'

# Download command
downloadPath: ./src/translations.json
downloadFormat: multi-language-json
downloadOptions:
  - 'WRITE_NESTED'

# Sync command uses upload and download command options

# Extract command
searchDir: ./src
projectType: yahoo/react-intl
ignoreKeys:
  - 'WELCOME'
  - 'ABOUT-US'

# Business plan options
customerId: ikea

See all available download and upload options

Authorization

Most of the CLI command needs to be authorized with --apiKey. The API Key can be found in the 'Integrations > Project credentials > API Key'.

SimpleLocalize: Project API Key location