JSON Import / Export for Web
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 website translations in various file formats.
You can also import/export Glossary terms.
Importing / Exporting
To see a general explanation of how importing and exporting works in Localize, click here. Be sure to adhere to the file requirements below so that Localize will be able to successfully read your files.
File Requirements
UTF-8 Character Encoding
Be sure that you are using the UTF-8 character encoding when working with the external files you are creating for importing purposes, so that special characters like accents are encoded properly.
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 required for each phrase:
translation
(string) - the source phrase
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 sitevalue
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"
],
"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 will see a message on screen after the failure occurs. Or you can view the error here under Import History.
Updated 7 months ago