JSON Import / Export
Using the JSON file format to import/export content
Within the Localize dashboard we provide you with an ability to import and export phrases and translations in various file formats.
You can also import/export Glossary terms.
To see a general explanation of how importing and exporting works in Localize, click here.
UTF-8 File Format
Be sure that you are using the UTF-8 file format when working with the external files you are creating for importing purposes.
Importing Phrases or Glossary Terms
Before importing, make sure your file adheres to the file requirements below.
Navigate to the File Import / Export: Import tab in your dashboard.
- Drag-and-drop a file to import into the box, or select a file to import.
- Select JSON under File Format.
- Select the language you are importing.
- Specify the import type: Phrases or Glossary terms
- Click the Submit button.
- Wait for the file to be uploaded.
- Success! View the file details to see how many phrases were created, updated, etc.
Exporting Phrases or Glossary Terms
Navigate to the File Import / Export: Export tab in your dashboard.
- Select JSON under File Format.
- Select a filter which will determine which phrases get exported:
a. Published translations
b. Machine translations
c. Human translations
d. No translations
e. Needs human translations - Select the language you are exporting.
- Specify the export type: Phrases or Glossary terms
- Click the Export button.
- Wait for your download to complete, then close the popup dialog.
Exporting Selected Phrases
Alternatively, you can filter exactly which phrases that you want to export on the Phrases page. Find out how...
File Requirements
The formatting in the JSON file is very specific. Use the following sample for guidance.
The JSON parser expects an array of Objects in the dictionary
object.
This file format does not support key:value
pairs for source:target language
content. Instead, you supply the source language phrase in the translation
object followed by its translation in the value
object.
The following data is optional for each phrase:
id
this internal ID will be seen in any files exported from Localizecontext
a string which provides context for your translatorslabels
An array of strings which are labels to apply to the phrase- Note that any pre-existing labels on the phrase will be replaced by the ones in the import file.
- Any labels added to the phrase in the file being imported will be added to the Localize dashboard.
url
an array of URL(s) where that phrase was found in your sitephraseKey
a string containing the key part of akey: value
pairvalue
key and its actual value- If present, this is the translation of the source text
- If no translation is available, use empty {}
{
"sourceLanguage": "en",
"targetLanguage": "es",
"dictionary": [
{
"id": "5e5c35e2a97f3f0e92f311f9",
"context": "this is context one",
"labels": [
"label1", "label2"
],
"url": [
"example.com/projects"
],
"phraseKey": "chose-localize",
"translation": {
"We’re happy that we chose Localize for our localization efforts!": {
"value": "¡Estamos contentos de haber elegido Localizar para nuestros esfuerzos de localización!"
}
}
},
{
"id": "5e20b74d73d6dc0e833f066a",
"context": "this is context two",
"labels": [
"label3"
],
"url": [
"example.com/what-we-do",
"example.com/about"
],
"translation": {
"We’ve been able to add new phrases and have them translated.": {
"value": ""
}
}
},
{
"id": "5e05ff60b5f2a4f81803b695",
"translation": {
"Many people like to drive through the canyons to view the natural beauty of the space.": {
"value": "A mucha gente le gusta conducir por los cañones para ver la belleza natural del espacio."
}
}
}
]
}
Troubleshooting
If your import fails you can view the error here under Import History.
Updated over 3 years ago