Problems analyzing JSON files in Trados Studio 2010 Thread poster: Carey77
|
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 Rosalee... See more 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 ▲ Collapse | | | Joakim Braun Sweden Local time: 03:21 German to Swedish + ...
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). | | | 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 lis... See more ... 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] ▲ Collapse | | | 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 | |
|
|
Carey77 Ireland Local time: 02:21 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 | | | Not sure why... | Mar 19, 2015 |
... you converted them to XML files Rosaleen? The process is this: - Create your JSON filetype
- Create your project and add all your files/folders
- Translate
- 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 ar... See more ... you converted them to XML files Rosaleen? The process is this: - Create your JSON filetype
- Create your project and add all your files/folders
- Translate
- 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 ▲ Collapse | | | 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 | | | 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: ",$ (... See more 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. ▲ Collapse | |
|
|
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 [email protected] | | | 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 Trados Studio 2022 Freelance | The leading translation software used by over 270,000 translators.
Designed with your feedback in mind, Trados Studio 2022 delivers an unrivalled, powerful desktop
and cloud solution, empowering you to work in the most efficient and cost-effective way.
More info » |
| Trados Business Manager Lite | Create customer quotes and invoices from within Trados Studio
Trados Business Manager Lite helps to simplify and speed up some of the daily tasks, such as invoicing and reporting, associated with running your freelance translation business.
More info » |
|
| | | | X Sign in to your ProZ.com account... | | | | | |