JSON - SimpleLocalize

Last modified: July 24, 2021Author: Jakub Pomykała

The custom build JSON format for different purposes. In most cases you would like to use it to import translation keys and localized messages from different localization programs. SimpleLocalize will discover automatically what kind of JSON library you use.

File format example

{
  "translation_key": {
    "message": "my localized message"
  },
  "second_translation_key": {
    "defaultMessage": "my localized message from FormatJS CLI output",
    "description": "Your message to translators. It will also show up in the translation editor"
  }
}

You can use simplelocalize-json format with FormatJS CLI. Check FormatJS CLI integration guide.

Upload with CLI

simplelocalize upload --apiKey <PROJECT_KEY> \
  --uploadFormat simplelocalize-json \
  --uploadPath ./translations_{lang}.json \
  --languageKey en

Learn more about SimpleLocalize CLI and translations upload feature.

Download with CLI

All translations at once

simplelocalize download --apiKey <PROJECT_KEY> \
  --downloadFormat simplelocalize-json \
  --downloadPath ./translations_{lang}.json

One file with one language

simplelocalize download --apiKey <PROJECT_KEY> \
  --downloadFormat simplelocalize-json \
  --downloadPath ./translations_{lang}.json \
  --languageKey en

Learn more about SimpleLocalize CLI and translations download feature.

Import with API

curl
    --request POST \
    --url 'https://api.simplelocalize.io/api/v2/import?uploadFormat=simplelocalize-json&languageKey=en' \
    --header 'x-simplelocalize-token: <API_KEY>' \
    --form file=@/path/to/your/file.json

Learn more about importing translations with API

Export with API

All translations in one file

curl
    --request GET \
    --url https://api.simplelocalize.io/api/v3/export?downloadFormat=simplelocalize-json \
    --header 'x-simplelocalize-token: <API_KEY>'

One file with one language

curl
    --request GET \
    --url https://api.simplelocalize.io/api/v3/export?downloadFormat=simplelocalize-json&languageKey=en \
    --header 'x-simplelocalize-token: <API_KEY>'

Learn more about exporting translations with API