Even if you are not a part of the translation field, you may need to translate a JSON file.
Let’s break down a task of translation of a JSON file into smaller steps, but first, let’s look at basics.
What is a JSON format?
In short, JSON is a lightweight data-interchange format that is easy for humans to read and write and for machines to parse and generate. JSON files are commonly used to transfer data between systems.
As an example, JSON is a format often used to export data from Content Management Systems (CMS) or to store localization data for apps. So if you are looking into making your content or app multilingual, probably your next big task is to translate a batch of JSON files.
How does a JSON file look like?
A JSON file is a text file with .json extension that contains data in key-value pairs.
The most common format for a key is “key:value”, but other formats are possible, such as “key : value”, “key :” value “,” key:value “, etc.
An example of a simple JSON file looks like this:
{
“language”: “en”,
“messages”: {
“welcome”: “Hi there!”,
“message”: “Thank you for joining. Add a picture to your profile now.”,
“error”: “Operation failed. Please try again later.”
}
}
Translation of a JSON file
When translating a JSON file, all the keys should remain untranslated, while the values need to be translated.
In the example above, the keys (language, welcome, message, error) would stay the same in all language versions.
The values are:
en
Hi there!
Thank you for joining. Add a picture to your profile now.
Operation failed. Please try again later.
and they should be translated.
There are two ways you can apply a translation to a JSON file.
Manual translation
The first one is to do it manually by editing the JSON file. You can use any text editor for this, but a code editor will be more convenient because it will highlight the words that need to be translated.
Another option is to use a translation tool
This approach makes the job easier, because it detects automatically words which need to be translated and also provides a nice translation interface.
In general, a translation tool should be able to import JSON files for translation, pre-translate with an option for translators to correct translations and export the final translated JSON files.
Additional benefit is that you can have all the files in one place for easy management.
JSON free translator
If your files are relatively small (below 50kB each) and you need them translated automatically but in good quality and for free, read no further but head to this service:
Things get a bit more complicated if you have plenty of JSON files and/or machine translation is not good enough. In this case, you want to engage with a Translation Management System like TextUnited (and engage with their translators too).
TextUnited is a tool that helps you manage your multilingual content. You can use it to translate JSON files, as well as other types of files such as PO, XLIFF, Excel, XML, HTML, docx etc. and it supports both manual and automatic translation.
How to translate JSON files with TextUnited?
At TextUnited, there are two approaches to choose from:
- File-based translation project
With the first one, you simply create a new file-based translation project. You may upload one or more JSON files to a project and select as many target languages as you wish. You can choose if you want to create an internal translation project or to outsource translation to TextUnited. After translation, you download translated JSON files.
- Connecting your versioning repository to TextUnited
The second method is to synchronize content with your BitBucket and GitHub repositories. By connecting a repository users will have an option to set up Auto Sync for continuous translation. Once your repository is updated with new files, strings will be automatically transported to TextUnited and become available for translation. Translated content can be synced back to the repositories automatically as well.
Select content for translation in JSON files
Tanks to filter settings you are able to select certain elements (JSON keys) for translation. This proves to be very helpful in case of larger JSON files with lot of different content.
However, the situation can also be reversed. You might have a JSON file with only a few keys that actually need to be translated. In that case, you don’t need to spend hours excluding all the other keys, in order to start localizing your content. You can simply choose which keys you want to include, and continue with your work.
The next great piece of news is that you may create and save as many templates as you want. You can apply them to your files after the project has been created. You do this by opening the project details page and applying a filter template from the list.
From this point, your translation project will not be available for a few moments until the filter is applied to the selected files.
Conclusions
Translate JSON files easily with TextUnited:
- Save time by translating files in bulk
- Use filter settings for fine tuning the selection of content for translaton
- Keep track of who translated what and when
- Reuse translations
- Share translations with other translators
Some more information about translation of JSON files with TextUnited you can find here.
Did you find our hints on translating JSON files helpful? If that’s the case or you have further questions or doubts, don’t hesitate to reach out to us – we will gladly answer any questions you may have.