CLI: Upload translations

Last modified: March 17, 2023Author: Jakub Pomykała

Upload existing translations or translation keys from your local project files. The uploaded translations and translations keys you can find in the translation editor.

Table of contents

Usage

Before you start, you need to install the CLI. Follow the CLI installation guide.

simplelocalize -c config.yml upload --apiKey <MY_API_KEY> ...

How to upload translation files with command-line tool

Example: Upload translations from one file

.
└── locales
    └── english-translations.json
simplelocalize upload \
 --apiKey MY_API_KEY \
 --languageKey en \
 --uploadPath ./locales/english-translations.json \
 --uploadFormat single-language-json

Learn more about single-language-json.

Example: Upload translations from one file with all languages

.
└── locales
    └── all-translations.json
simplelocalize upload \
 --apiKey MY_API_KEY \
 --uploadPath ./locales/all-translations.json \
 --uploadFormat multi-language-json

Learn more about multi-language-json.

Example: Upload translations from multiple directories

.
├── ca
│   └── translations.json
├── en
│   └── translations.json
└── es
    └── translations.json
simplelocalize upload \
 --apiKey MY_API_KEY \
 --uploadPath ./{lang}/translations.json \
 --uploadFormat single-language-json

Example: Upload translations from multiple directories and files

.
├── ca
│   ├── common.json
│   └── home.json
├── en
│   ├── common.json
│   └── home.json
└── es
    ├── common.json
    └── home.json
simplelocalize upload \
 --apiKey MY_API_KEY \
 --uploadPath ./{lang}/{ns}.json \
 --uploadFormat single-language-json

See all available upload formats

Example: Upload customer translations

This option is only available with a Business plan.

.
└── locales
    └── ikea-translations.json
simplelocalize upload \
 --apiKey MY_API_KEY \
 --uploadPath ./locales/ikea-translations.json \
 --customerId ikea \
 --uploadFormat multi-language-json

Upload options

Many upload formats offer additional options. You can activate them using --uploadOptions parameter.

simplelocalize upload \
 --apiKey MY_API_KEY \
 --uploadPath ./translations.json \
 --uploadFormat multi-language-json \
 --uploadOptions UNESCAPE_NEW_LINES,PUBLISH_AFTER_IMPORT

See all available upload options

Override translations from file

If you want to override translations existing translations in translation editor you can use REPLACE_TRANSLATION_IF_FOUND option. This option won't clear translations that are not present in the file.

simplelocalize upload \
 --apiKey MY_API_KEY \
 --uploadPath ./translations.json \
 --uploadFormat multi-language-json \
 --uploadOptions REPLACE_TRANSLATION_IF_FOUND

This option is useful when you want to update translations from a file for a given language, instead managing them via the translation editor.