JSON Files
These pages describe how to translate JSON files. We support both monolingual and multilingual files (JSON contains source texts and translations in one file).
Getting started
Login a manager or administrator and click the Settings top navigation link. Then click JSON files to view all your existing configurations and add new ones.
Each filter configuration tells the system the JSON properties to translate, any texts to entirely exclude from translation (e.g. numbers only), whether content is raw text or HTML formatted, and many other parameters.
Filter version 1 vs 2
You will see a small panel where you can toggle between version 1 of the filter and the much better version 2. Choose the latter whenever you can, it is more capable and simpler to configure. Version 1 is configured using XPATHs and version 2 with the more natural choice of JSON-paths.
Choose monolingual or multilingual
In a monolingual workflow, the JSON contains texts in the source language and the translated JSON will contain all the texts in a given target language. In a multilingual workflow, the translated JSON will contain both the source texts and all the translated texts in one single file.
Specify translatable content with JSON paths
Now it gets interesting 🙂 And this section is what this tutorial really is about. We introduce “JSON path” which is the standard mechanism to select content in JSON files and, in our case, the content we want to translate. Often JSON files contain content to translate and other content that must not be translated. JSON paths will make this choice simple.
Useful links are:
https://support.smartbear.com/alertsite/docs/monitors/api/endpoint/jsonpath.html (An introduction)
https://jsonpath.com/ (A tool to try out JSON paths with your documents)
Translating monolingual JSON files
Learn how to translate all or selected content in a typical JSON file like this one:
{
"module": {
"text": "This is an example",
"title": "A title to translate"
},
"options": [ "Delete element", "Add new element" ],
"welcome": "Welcome to this product"
}
Translating multilingual JSON files
Learn how to translate multilingual JSON content like this one. We want to translate the English content into French, Spanish and Chinese and put all translations back into the file.
Once all the work is done, the file will contain translated “text” and “title” in all the languages. Compare this to monolingual JSON files, where we will create one separate JSON file per target language.
Note that multi-lingual files like the one below may already contain all or some translations. The workflow is to complete the translations or review them.
{
"English": {
"text": "This is an example",
"title": "A title to translate"
},
"French": {
"text": "Ceci est un exemple"
},
"Spanish" {}
}