Parsing JSON to see specific Key & Value

Hi,

I am setting up a project with JSON files to be translated.

I am trying to parse it to enhance workflow.
The structure of the JSON files are as follows:

Screenshot of JSON file in Trados Studio with text highlighted in green indicating translatable content and orange highlighting for 'slug' field.

With "$..content.*" I get everything that is highlighted in green (which is what needs to be translated). The file looks like this in Trados:

Trados Studio interface showing a list of strings with checkboxes, and a question mark indicating confusion about which string is the 'slug'.

I have been asked to translate the values of "name", "seotitle", "seodescription" and "content". The "slug" (highlighted in orange) is only to be translated if there is a color in it. For example, "thisisastring" should be left as is, but if it is "thisisastring-black", "black" should be translated.

The problem is, often name, seotitle, seodescription and slug are exactly identical. This means that it will be very easy to translate the value of "slug" by mistake, thinking it's one of the value of one of the other keys. The files are also different. Some files don't have slugs, some don't have seo descriptions. So I can't predict that it's always the fourth segment or something similar.

Is there a way for me to use both "$..content.*" and another expression to show me when the segment is actually a "slug"? Optimally the slug segment would say "slug": "thisisastring" (or something similar) so I always know which ones they are.


Thank you kindly for helping!
Have a nice day.



Generated Image Alt-Text
[edited by: Trados AI at 1:58 AM (GMT 0) on 29 Feb 2024]
emoji
Parents
  • Hi 

    Actually, you can achieve this starting with Studio 2021 SR1 CU3. So be sure you are upgraded at least to CU3.

     As a new feature of CU3, Translatable checkbox was added in the Add JSON Path dialog.

    Trados Studio Add JSON Path dialog with fields for JSON Path, Document Structure Information set to Paragraph, Name of sibling defining SID, and a checked Translatable checkbox.

    Below, you can see each JSONPath with Translatable attribute set, and it works.

    Trados Studio Specified JSON paths for extracting table showing paths for slug and url with Document Structure Information set to Paragraph, SID Sibling blank, and Translatable set to False, and a path with a wildcard with Translatable set to True.

    Adding to my original post here, also you can make sure DSI is set something specific to slug so that you can filter for slug entries in Editor or add color to DSI column so it's easily recognizable without filtering. DSI viewer from AppStore is also great.

    I hope this helps.

    Thanks,

    Naoko

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 1:59 AM (GMT 0) on 29 Feb 2024]
Reply
  • Hi 

    Actually, you can achieve this starting with Studio 2021 SR1 CU3. So be sure you are upgraded at least to CU3.

     As a new feature of CU3, Translatable checkbox was added in the Add JSON Path dialog.

    Trados Studio Add JSON Path dialog with fields for JSON Path, Document Structure Information set to Paragraph, Name of sibling defining SID, and a checked Translatable checkbox.

    Below, you can see each JSONPath with Translatable attribute set, and it works.

    Trados Studio Specified JSON paths for extracting table showing paths for slug and url with Document Structure Information set to Paragraph, SID Sibling blank, and Translatable set to False, and a path with a wildcard with Translatable set to True.

    Adding to my original post here, also you can make sure DSI is set something specific to slug so that you can filter for slug entries in Editor or add color to DSI column so it's easily recognizable without filtering. DSI viewer from AppStore is also great.

    I hope this helps.

    Thanks,

    Naoko

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 1:59 AM (GMT 0) on 29 Feb 2024]
Children