Commenting on JSON files in Passolo

If you are localizing JSON files using Passolo 2016, they’ve added a feature that you may be unaware of. With this new functionality, JSON parser in Passolo can now automatically recognize and handle RESJSON-style comments.

If you’re in the localization industry, I don’t have to explain the importance of having as many resources and as much context as possible when translating various kinds of texts, particularly when localizing software strings. At this very moment, I imagine that there are translators around the world all asking the same questions, a hundred times a day: “is ‘EDIT’ a verb or a noun here?” or “will this ‘ON’ be placed before a date or is it an alternative to ‘OFF’?”

If appropriate comments are visible right next to the string waiting to be translated, a great deal of time can be saved on guessing, writing and answering queries.

Why be so enthusiastic about the RESJSON format?

In previous versions, the JSON parser available in Passolo could recognize and handle C-style comments, but, unfortunately, those comments caused the JSON files to be invalid. My team faced this dilemma when managing software localization projects at Pitney Bowes. The SDL community experts initially suggested that we try maintaining two separate versions of each JSON file — one valid and one commented — but this would present a huge burden. Imagine handling almost a hundred JSON files along with thousands of files in another format. The suggestion was not viable, to be honest.

At this point, I wanted to add comments in the RESJSON format, knowing that this wouldn’t break the JSON file. It would remain fully usable. Unfortunately, this wasn’t supported by Passolo. So, we came up with a workaround: creating a substitute Text Parser. This did the trick, but still wasn’t ideal because it didn’t support the hierarchical structure of JSON format. We were able to include the nested parts of the content, but we missed the beautiful tree structure in the left-hand panel.

I continued reaching out to the SDL community for a better solution, and they initiated an enhancement request. They then added this new functionality to Passolo in the 2016 release. This update is mentioned in the release notes, but I haven’t seen it advertised anywhere.

This feature isn’t active by default

You need to know that this comment functionality is not activated by default. To get it to work, you need to check the right box. To get there, open the JSON parser settings window (select your source JSON string list in Passolo then go to > String list settings > Options. Choose “Add-in JSON Parser” and hit “Setup.”

JSON files in Passolo
JSON files in Passolo

At that point, you’ll see the JSON Parser Settings window where you can check the “Import RESJSON-style comments from JSON files” option. And that’s when the comments will be properly recognized and handled.

(Word to the wise: try not to have multiple projects opened when you do this, because due to how the settings window is designed, you may inadvertently change the settings in another project).

What do the RESJSON-style comments look like? As an example, let’s look at the following string:

“EditKPITooltip”: “Edit selected KPI”

If you want to add a comment after this string to indicate that KPI stands for key performance indicator, you would create a new string that repeats the original string ID, adding an underscore at the beginning. Then, you repeat the string ID and continue with a dot and the word “comment.” Don’t forget the double quotes:

“_EditKPITooltip.comment”: “KPI stands for key performance indicator”

Ok, now you’ve got it. I hope you’ll find this feature as useful as we have.

Piotr Dąbrowski
Piotr Dąbrowski is a globalization program manager at Pitney Bowes. He began his career as an in-house translator and proofreader. Now, he oversees the process of internationalizing, localizing software and translating documentation for certain Pitney Bowes products.


Weekly Digest

Subscribe to stay updated

MultiLingual Media LLC