JSON stands for Java Script Object Notation. It's a text-based open standard and also a data-interchange format. JSON is easy to read and write for machines. It's based on a subset of the Java Script Programming Language.
JSON is a text format that is completely language-independent. It uses the syntax of the C-family programming languages such as C, C++ or C#.
To learn more about JSON: Click here (the link is available at the time of writing).
There are two types of JSON files. It's either a collection of name-value pairs of objects, or an ordered list of values.
How to get here
- Start importing a JSON document.
- In the Document import options window, select the JSON documents, and click Change filter and configuration.
- The Document import settings window appears. From the Filter drop-down list, choose JSON filter.
What can you do?
Normally, memoQ detects the input encoding automatically.
If this doesn't work, clear the Automatically detect input encoding if possible check box. From the Select input encoding list, choose an encoding.
Normally, memoQ exports the translation in the same encoding as in the input file.
If the input file isn't Unicode (e.g. UTF-8), and the target language has a different script, this isn't possible. When this happens, clear the Same as input check box. From the Select output encoding drop-down box, choose an encoding.
Don't clear the Write BOM to Unicode-encoded files on export check box. The system that uses the translation might need this to recognize the correct encoding.
Many JSON files have multiple nested blocks that look like this:
Normally, memoQ imports the name of the entry (the first part before the colon) as the context of the segment. But if the entry is part of a larger block (or several nested larger blocks), this context will not be unique. In this case, you can't efficiently use the name of the entry as the context. You need the entire 'path' of the entry, such as "Common"."metricCharacters".
To set this up, use the radio buttons on the Context tab:
- To get all the context information there is: Choose the Use keys as well and the only the translatable value's own key radio buttons.
- To add an even larger context, like a project or a document: Choose the Use keys as well and the all the keys up to the root, concatenated with radio buttons, and type the context label in the text box below it. You can invent this freely: the point is to make the context identifiers as unique as possible, so that you don't get false context matches from translation memories.
JSON files are used to describe data in general, similarly to XML files. Most of the time, a key - an item or an entry or a structure - in a JSON file is not text. It can be a number, a date, another data type, or a complex structure of further data.
If you need to translate text in a complex JSON file, you need to be able to extract translatable text.
To do this, use the Key options tab:
By default, the Translatability setting is set to translatable for all keys.
Whether a value is translatable or not is decided by the "sum" of the translatability of all its parents
How to sum two values
- 'weak translatable' is overruled by either 'strong translatable' or 'not translatable'
- when 'strong translatable' and 'not translatable' meet, the child wins
|Child is...||strongly translatable||translatable||not translatable|
|strongly translatable||strongly translatable||strongly translatable||strongly translatable|
|translatable||strongly translatable||translatable||not translatable|
|not translatable||not translatable||not translatable||not translatable|
Based on children's values
For now, we only allow for one of these conditions for a key.
If the condition is false, the translatability of the key is negated: 'translatable' turns into "not translatable, 'not translatable' turns into 'translatable'.
When you finish
To confirm the settings, and return to the Document import options window: Click OK.
To return the Document import options window, and not change the filter settings: Click Cancel.
If this is a cascading filter, you can change the settings of another filter in the chain: Click the name of the filter at the top of the window.
In the Document import options window: Click OK again to start importing the documents.