A super easy way of processing JSON in Trados Studio

Supertext has developed a JSON file type plugin for Trados Studio 2015 – 2017 with support for bilingual files!

What can you do with it?

  • Translate JSON files (*.json) directly in Trados Studio
  • Translate all texts
  • Use a path filter to:
    • Translate only specific texts
    • Translate bilingual JSON files
  • Process embedded content such as HTML tags

Download and installation

Download the plugin here and double click on the .sdlplugin file to start the plugin installer.

JSON format

JSON stands for JavaScript Object Notation and is a data-interchange format for storing and exchanging data. It has an easy-to-read syntax and may contain text which needs to be translated.

There is already a lot of information about the JSON format out there, so we won’t go into any specific details here.

JSON path

A JSON document can be represented as a tree.  The example above:

A path describes how to get to a node of the tree. We are only interested in paths that lead to properties with a string as value (represented as leaves in the tree above).

Example path that leads to the property with the value “The JSON example”: header.title

Example path that leads to the property with the value “First element additional text”: content.elements[0].additionalText

Translate all JSON file texts

By default, the parser will extract all texts and no setting changes are required.

Use a path filter

The path filter setting can be found in the project settings under File Types -> JSON file -> Parsing settings. The filter rules are defined using regular expression. Each rule defines two expressions.

The source path expression is used to describe the pattern a path must match to be used as source, and therefore the property’s value as source text. If a path does not match any source path expressions, it is ignored. This way you can control what is used as translatable text.

The target path expression is used to describe the pattern of the path that should be used as target, and therefore the property’s content as target text. This expression needs to be the same as the source expression if the source text is to be replaced with the target text. However, if the JSON document is bilingual and therefore contains source as well as target text, it will be different from the source expression.

Translate only specific texts

You can either add filter rules yourself or extract all existing rules from a JSON file and then remove the rules matching the unwanted texts.

Example settings to get the header title and all “additionalText” properties of the above JSON document:

You could use “content\.elements\[0\]\.additionalText” instead of “content\.elements\[\d+\]\.additionalText” as the path expression to get only the first “additionalText”.

It is possible to use only “title” instead of “header\.title” and “content\.title” if both title properties should be translated, since the parser checks if the path contains the described pattern.

Translate bilingual JSON files

It is possible to specify a target path expression if the JSON document to translate is bilingual.

In this case you need to mark the rule as bilingual and define the target path expression.

Select “Apply target text from JSON file” to extract any existing target text from the JSON file.

The extraction feature does not recognize source and target. The path expressions for source and target will be defined in separate rules; however, it is possible to join the rules:

  1. Hold down the Ctrl key on your keyboard
  2. Click on the first rule to select it
  3. Click on the second rule to select it
  4. Release the Ctrl key and click on the Join button

Process embedded content like HTML tags

The plugin supports embedded content replacement with tags. The default settings already contain common placeholders and tag pairs for HTML. This setting can be found under File Types -> JSON file -> Embedded Content.

Tips & Tricks

You want to catch description, but not descriptionTitle?

Change this:
\[\d+\]\.description
to this:
\[\d+\]\.description\b
The \b kinda signals the end of the word.

Error: The document cannot be processed since it contains unexpected contents.
or
The target text contains more HTML tags than the source text (tags duplication)

Likely the HTML tags in your content are not matched or Trados is just having troubles with them.

  1. Remove all entries in the “Embedded Content” configuration.
  2. Add a placeholder with following “Start Tag”: </?[\p{Ll}\p{Lu}]\w*[^<>]*>

Don’t forget to add your custom placeholders (e.g. {?{\d+}}?).

You need help?

Please write your question in the SDL Forum first:
https://community.sdl.com/developers-more/developers/language-developers/
Drop us a mail too with a link to the post, we don’t always monitor the group: development AT supertext DOT com.
Make sure you include the json and the sdlfiletype settings file.

We are giving this plugin away for free and we will try to help you nevertheless. But we do have other issues to work on sometimes.


Related posts


3 Kommentare zu “A super easy way of processing JSON in Trados Studio”



  • Evzen am 29. November 2016 20:54 Uhr

    Hi, I’m having problem with the plugin – it keeps throwing error when trying to generate target file:
    Unable to cast object of type ‘Newtonsoft.Json.Linq.JArray’ to type ‘Newtonsoft.Json.Linq.JProperty’.

    Here is the complete Trados Studio error XML: http://pastebin.com/0sStkASV
    And here is the test JSON file: http://pastebin.com/Ebshhtsx
    This is the simple filter rule used: \.textMessages\[\d+\]


  • Rémy Blättler am 5. December 2016 16:48 Uhr

    Hey Evzen
    We can reproduce your issue. We will have a look at this as soon as possible, but since we are providing this Plugin for free, it’s not a top priority.


  • Lierni Otamendi am 23. February 2018 19:42 Uhr

    We had tried the new plug-in after having reported some issues with a couple of json files we had to translate, and the result has been phantastic. Great product and service! Thank you all.


Leave a Reply

Your email address will not be published. Required fields are marked *