CLI: Upload translations

Last modified: October 17, 2022Author: 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.

Usage

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

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

Upload translations with CLI

Example: Upload translations from one file

.
└── locales
    └── all-translations.json
simplelocalize upload \
 --apiKey PROJECT_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 PROJECT_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 PROJECT_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 PROJECT_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 PROJECT_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 PROJECT_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.