JSON - Multi Language

Last modified: May 11, 2021Author: Jakub Pomykała

One of the most common JSON format for apps and software localization is JSON file with all translations as shown below. It's easy to use because you can fetch only one file and use all translations.

File format example

{
  "de": {
    "SALE": "Verkauf",
    "ADDRESS": "Adresse"
  },
  "fr": {
    "SALE": "soldes",
    "ADDRESS": "adresse"
  }
}

You can also use single-language-json format to download only needed translation messages for requested language key.

SimpleLocalize also recognizes nested JSON keys like shown below.

{
  "de": {
    "SALE": {
      "NESTED": "Verkauf"
    }
  }
}

Above JSON will result with SALE.NESTED translation key.

Upload with CLI

simplelocalize upload --apiKey <PROJECT_KEY> \
  --uploadFormat multi-language-json \
  --uploadPath ./translations.json

Learn more about SimpleLocalize CLI and translations upload feature.

Download with CLI

simplelocalize download --apiKey <PROJECT_KEY> \
  --downloadFormat multi-language-json \
  --downloadPath ./translations.json

Learn more about SimpleLocalize CLI and translations download feature.

Import with API

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

Learn more about importing translations with API

Export with API

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

Learn more about exporting translations with API