Problems analyzing JSON files in Trados Studio 2010
Thread poster: Carey77
Carey77
Ireland
Local time: 12:36
Mar 16, 2015

Hello,

I've recently received a new project from an eLearning client.

Source files are JSON. Content has been written directly into the JSON files.
I need a work around for outputting the translatable javascript text into XML and then re-integrating when the translation phase is completed?

Does anyone have experience analysing these file types within SDL Studio 2010?

All feedback is greatly welcome.

Many thanks
Rosaleen


Direct link Reply with quote
 
Joakim Braun  Identity Verified
Sweden
Local time: 13:36
German to Swedish
+ ...
Hm Mar 17, 2015

JSON can contain any Javascript variable and any other form of (arbitrarily encoded) binary data in any order. The contents, structure and types of data of a JSON string are entirely unpredictable and must be replicated exactly in the output. Not very CAT-friendly!

There are lots of piecemeal solution for converting JSON to XML, though (look at Stackoverflow.com).


Direct link Reply with quote
 

SDL Community  Identity Verified
United Kingdom
Local time: 13:36
English
Generally... Mar 17, 2015

... my experience of seeing JSON files from users looking to handle them is that they can be easily managed with a regex filetype.

In this example, as Rosaleen emailed me as well, the JSON file seems to contain translatable text between a set of standard quotation marks, but preceded by an identifier. Not all of the identifiers are for translation (I think). So the solution was to create a rule where you can either add a list of the identifiers you want to be extracted, or list the ones you don't want to be extracted. Both are reasonably straightforward but the latter has the advantage of probably being a smaller list and catering for any translatable identifiers you don't know yet, and the former has the advantage of ensuring you only ever extract exactly what you asked for.

For your information the rules were these (regex filetype, structure rules):

Former

Opening
"(id3|id4|id6|id7|id8|id9|id10|id11|id12)".*?"

Closing
".*$

Latter

Opening
"(?!id1|id2|id5)\w+".*?"

Closing
".*$

The structure of the JSON file itself, which is important as Joakim noted was this:

"id3": "translatable text in here",

So, not all JSON files are alike but the principle is probably very similar and hopefully this will help someone else.

Regards

Paul
SDL Community Support

[Edited at 2015-03-17 08:30 GMT]


Direct link Reply with quote
 

SDL Community  Identity Verified
United Kingdom
Local time: 13:36
English
There have been a few discussions... Mar 18, 2015

... around this filetype recently so I'm sharing an article here that might be heplful in the future.

Regards

Paul
SDL Community Support


Direct link Reply with quote
 
Carey77
Ireland
Local time: 12:36
TOPIC STARTER
Audio text in JS files Mar 19, 2015

Than you very much Joakim and Paul for your support on this issue.

We've managed to convert the files to XML and generate word counts for quoting purposes.

Next challenge is understanding....

1. How to convert XML back to functioning JSON files
2. Identifying audio text within JS files.

Any feedback would be greatly welcome.

Thanks
Rosaleen


Direct link Reply with quote
 

SDL Community  Identity Verified
United Kingdom
Local time: 13:36
English
Not sure why... Mar 19, 2015

... you converted them to XML files Rosaleen? The process is this:

  1. Create your JSON filetype
  2. Create your project and add all your files/folders
  3. Translate
  4. Generate the target files

Thank's it. When you generate the target files they will be translated JSON files. Why did you convert them to XML at all? Or are you calling the SDLXLIFF files XML? If so just follow the process above.

Regards

Paul
SDL Community Support


Direct link Reply with quote
 

SDL Community  Identity Verified
United Kingdom
Local time: 13:36
English
Best if we see a sample... Mar 19, 2015

Carey77 wrote:

2. Identifying audio text within JS files.



... this is surely just another field?

Regards

Paul
SDL Community Support


Direct link Reply with quote
 

Matthijs Frankena  Identity Verified
Netherlands
Local time: 13:36
Member (2008)
English to Dutch
+ ...
Help needed with Paul's procedure Mar 31, 2015

I read Paul's explanation in the linked article, and tried to copy the steps. I can reproduce most of it - up until the point where the text I don't want to see in the Editor needs to be filtered out. For the life of me, I can't come up with a regex that does the trick.

My json file contains lines like these:

"chute.enabled.off": "Off",
"chute.enabled.on": "On",

When I enter this Opening pattern: ".*": "
and this closing pattern: ",$
(as described in the article), I end up with a file that displays in the Editor as follows:

"chute.enabled.off":
"Off
"chute.enabled.on":
"On

As you can see, the first, untranslatable part of the line (the bit before the : " part) is still visible, and the part I want to translate still has the opening quote. I tried to fiddle with the regex, but I am no boffin at that, so to no avail. At the moment I am getting a bit desperate.

Is any help possible? I work with Studio 2014, if that makes any difference.


Direct link Reply with quote
 

SDL Community  Identity Verified
United Kingdom
Local time: 13:36
English
If you follow the instructions exactly... Mar 31, 2015

... and copy paste the expressions from the article then it works fine with your file. I just tested with your text.

Perhaps you can export your settings file and email it to me?

Regards

Paul
SDL Community Support
pfilkin@sdl.com


Direct link Reply with quote
 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

Problems analyzing JSON files in Trados Studio 2010

Advanced search







Anycount & Translation Office 3000
Translation Office 3000

Translation Office 3000 is an advanced accounting tool for freelance translators and small agencies. TO3000 easily and seamlessly integrates with the business life of professional freelance translators.

More info »
TM-Town
Manage your TMs and Terms ... and boost your translation business

Are you ready for something fresh in the industry? TM-Town is a unique new site for you -- the freelance translator -- to store, manage and share translation memories (TMs) and glossaries...and potentially meet new clients on the basis of your prior work.

More info »



Forums
  • All of ProZ.com
  • Term search
  • Jobs
  • Forums
  • Multiple search