CLI: Upload translations

Last modified: May 18, 2021Author: 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.

upload translations

💿 Installation

Install SimpleLocalize CLI

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

Problems with CLI? See troubleshooting section.

👨‍💻 Usage

Upload all language translations from one file

simplelocalize upload \
 --apiKey PROJECT_API_KEY \
 --uploadPath ./all-translations.json \
 --uploadFormat multi-language-json

Learn more about multi-language-json.

Upload one language translations from one file

simplelocalize upload \
 --apiKey PROJECT_API_KEY \
 --uploadPath ./english-translations.json \
 --uploadFormat single-language-json \
 --languageKey en

Learn more about single-language-json.

Upload all language translations from multiple files

simplelocalize upload \
 --apiKey PROJECT_API_KEY \
 --uploadPath ./my-{lang}-translations.json \
 --uploadFormat single-language-json

In this case SimpleLocalize CLI will discover all files which will match to my-???-translations.json in directory and use ??? as a language key. It's useful when you have many files with translations. Thanks to that, you can upload all file at once.

📦 Available --uploadFormat values

uploadFormat Description
multi-language-json JSON file with all translations
single-language-json JSON file with one language (use languageKey param to specify language)
simplelocalize-json JSON format prepared for integration purposes
excel Microsoft Excel spreadsheet in *.xlsx format
csv , or ; separated translation keys
yaml yaml file format
android XML Resource Strings file
localizable-strings Localizable.strings file format
java-properties Java properties file
po-pot PO/POT files
php-array PHP Array file
module-exports module.exports file

Example

CLI upload

SimpleLocalize CLI can also upload JSON generated by FormatJS CLI. Learn more about FormatJS CLI + SimpleLocalize CLI integration

🗂 Translations are in multiple files

If your project structure uses one translation file per language translations then you can use special syntax in uploadPath option. Use {lang} variable to load all translations from JSON files.

Example

Let's assume you have project structure like below project structure

In that case uploadPath param should look like following messages_{lang}.properties. CLI will automatically extract language key from file name and upload it accordingly.

Example command usage

simplelocalize upload \
 --apiKey PROJECT_API_KEY \ 
 --uploadPath ./messages_{lang}.properties \ 
 --uploadFormat java-properties

Learn how to download translations. Optionally, you can also check how to export translations using API.