Learn how to generate multi-language images in seconds with Bannerly!See Bannerly.io

CLI: Upload translations

Last modified: January 05, 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.

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.

Upload translations from multiple paths

simplelocalize upload \
 --apiKey PROJECT_API_KEY \
 --uploadPath ./my-project-directory \
 --uploadFormat multi-language-json \
 --uploadOptions MULTI_FILE

In this case SimpleLocalize CLI will discover all files which will match to ./my-project-directory/**/*.json and upload them as multi-language-json to the SimpleLocalize editor. It's useful when you use separate file with translation for every page or component. Use ignorePaths field in configuration file in order to ignore unwanted files from being imported. Visit More options to learn more about configuration options.

📦 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
csv-translations CSV file with all translations
yaml yaml file format
android-xml 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.