XPath in JSON file

Hi Community,

We have received a sample JSON file to test if Trados Studio can handle it well.

I tried adding it to Studio and customise the parser settings, but actually with a first look in the file I'm not sure if it's not missing something, but I'm not too experienced in it, so I would like if you could confirm it, if the file in itself is complete.

Here is the file:

https://gist.github.com/litzinger/44cecca3406ef4669d0dc5e2ef9c3fe5 

It starts like this, does not seem to have a clear root element:

{
  "send_approval": "n",
  "publisher_save_status": "open",
  "publisher_view_status": "open",
  "site_language": "1",
  "submit": "save_and_close",
  "title": "Jamf Pro",
  "field_id_630": {
    "blocks_block_id_459538": {
      "draft": "0",
      "id": "459538",
      "blockDefinitionId": "10",
      "order": "1",
      "deleted": "false",
      "values": {
        "col_id_64": "comet",
        "col_id_70": [
          "8681",

}, "blocks_block_id_459546": { "draft": "0", "id": "459546", "blockDefinitionId": "7", "order": "9", "deleted": "false", "values": { "col_id_20": "Our Apple EMM makes sure everyone gets more out of their Apple devices with you to thank.", "col_id_121": "", "col_id_122": "center", "col_id_155": "center"


Under "values" they have "col_id_XX" elements which have the translatable content, but not always.

The instructions we received say that

Generally if the value is all lower cased and 1 word, or lower case and multiple words separated by an _ or - then it’s a variable, and not actual content. Thats probably a safer bet to do a regular expression match. This would match any value in a json object that starts with a lowercase letter, contain numbers, dashes, or underscores making it 1 word, or the words Yes and No (we use those values for true/false). ^([a-z0-9\-_|Yes|No])+$ (edited) 

If key matches (_\d+|title|text|content)$ AND value does _not_ match ^([a-z0-9\-_|Yes|No])+$  then it’s probably a safe bet that it is translatable text.

The "tree_order" parameter should always be excluded for translation.

Non translatable content also appears between curly brackets in some cases : exclude this as well

The only dates that should be translated are anything in the other fields you noted with underscores.



So this is one thing, but I'm not really sure where to start the parsing. Also if the file is complete because it seems to be lacking a root element, it looks like an excerpt but the customer says it should work.


What do you think?

Thank you!
Greta

Parents Reply Children
No Data