simplelocalize-cli icon indicating copy to clipboard operation
simplelocalize-cli copied to clipboard

SimpleLocalize CLI is a developer-friendly command-line tool for uploading and downloading translation files

Tests Maintainability codecov

What it does?

SimpleLocalize CLI to simplifies the process of translation in web apps, mobile apps, and games. It can:

  • find translation keys in your local files
  • upload existing translation files or translation keys
  • download translation file in ready to use format for already used i18n library like: i18next, Android, iOS, and many others

Installation

Version 2.0.X (recommended)

curl -s https://get.simplelocalize.io/2.0/install | bash

Version 1.1.2

curl -s https://get.simplelocalize.io/install | bash

Usage

simplelocalize -c config.yml [COMMAND] --apiKey <PROJECT_API_KEY> ...

Configuration file

Use configuration file in order to simplify your bash command. Arguments used in command always overrides properties set in configuration file.

Filename: simplelocalize.yml

# Project API Key
apiKey: API_KEY

# Properties used by 'upload' command
uploadPath: ./src/{lang}/{ns}.json
uploadFormat: single-language-json
uploadOptions:
  - UNESCAPE_NEW_LINES

# Properties used by 'download' command
downloadPath: ./src/{ns}/messages_{lang}.json
downloadFormat: single-language-json
downloadOptions:
  - WRITE_NESTED

# Properties used by 'extract' command
searchDir: ./src
projectType: yahoo/react-intl
ignoreKeys:
  - 'WELCOME'
  - 'ABOUT-US'

Example: One file with translations

.
└── locales
    └── messages.json

CLI command:

simplelocalize upload 
  --apiKey <PROJECT_API_KEY>
  --uploadPath /locales/messages.json
  --uploadFormat multi-language-json

Example: Single file with multiple language directories

.
├── ca
│   └── index.json
├── en
│   └── index.json
└── es
    └── index.json

CLI command:

simplelocalize upload 
  --apiKey <PROJECT_API_KEY>
  --uploadPath /{lang}/index.json
  --uploadFormat single-language-json

Example: Multiple files with multiple language directories

.
├── ca
│   ├── common.json
│   └── home.json
├── en
│   ├── common.json
│   └── home.json
└── es
    ├── common.json
    └── home.json

CLI command:

simplelocalize upload 
  --apiKey <PROJECT_API_KEY>
  --uploadPath /{lang}/{ns}.json
  --uploadFormat single-language-json

Upload translations

simplelocalize upload 
  --apiKey <PROJECT_API_KEY>
  --uploadPath <UPLOAD_PATH>
  --uploadFormat <UPLOAD_FORMAT>
  --uploadOptions <UPLOAD_OPTIONS>

--uploadOptions parameter is optional.

Learn more about upload translations command.

Download translations

simplelocalize download 
  --apiKey <PROJECT_API_KEY>
  --downloadPath <DOWNLOAD_PATH>
  --downloadFormat <DOWNLOAD_FORMAT>
  --downloadOptions <DOWNLOAD_OPTIONS>

--downloadOptions parameter is optional.

Learn more about download translations command.

Sync translations

Sync command combines upload and download commend execution.

simplelocalize sync 
  --apiKey <PROJECT_API_KEY>
  --downloadPath <DOWNLOAD_PATH>
  --downloadFormat <DOWNLOAD_FORMAT>
  --downloadOptions <DOWNLOAD_OPTIONS>
  --uploadPath <UPLOAD_PATH>
  --uploadFormat <UPLOAD_FORMAT>
  --uploadOptions <UPLOAD_OPTIONS>

--downloadOptions and --uploadOptions parameters are optional.

Extract translation keys

simplelocalize extract 
  --apiKey <PROJECT_API_KEY>
  --searchDir <SEARCH_DIRECTOR>
  --projectType <PROJECT_TYPE> 

See available project types.

Custom configuration file

By default, SimpleLocalize will load configuration from file named simplelocalize.yml. You can load configuration from different location using -c parameters.

simplelocalize -c my-configuration.yml upload

Commands documentation

Please remember to get API Key for your SimpleLocalize project before your start.

Integrations

Documentation

Head to docs.simplelocalize.io to learn the SimpleLocalize basics

How to build project, contribute or add features?

Please see CONTRIBUTING.md file

License

Check LICENSE.md file