«

»

May 22

SDLXLIF in memoQ, or There and Back Again

Trados Studio as an internal format uses it’s own flavor of XLIFF, namely SDLXLIFF. Since these files generally adhere to quite loosely defined XLIFF standard, it is easy to open them in other tools supporting XLIFF (particularly in memoQ), translate them and insert translated file back into Studio project. Unfortunately all data on matching and segment statuses are coded in Trados-specific way, so we’ll lose this information when switching tools. Fortunately, there’s a way to keep at least segment states, because both programs “play nice” with standard XLIFF elements.

WARNING: the procedure below is obsolete. Currently memoQ supports Studio files out of the box, including import of Studio packages and export of return packages. I’m keeping the post online, but you don’t need it anymore, unless you are running memoQ from 2012.

 

In the procedure below I’m assuming at least basic knowledge of Trados Studio project folder structure. If you need to extract file(s) to translate from Studio package file, read Kevin Lossner blog post.

Tools needed:

  1. Notepad++ (or any regexp-capable tool)
  2. memoQ
  3. Trados Studio(?)

To set 100% Studio matches (Approved) to “Confirmed” status in memoQ:

  1. Make a backup copy of .sdlxliff file(s) you want to process in memoQ.
  2. Open .sdlxliff file in Notepad++.
  3. Select Search > Replace (Ctrl-H).
  4. Select Regular expressions option.
  5. In the Search field enter: <target>(.*)(?="Translated")
  6. In the Replace field enter: <target state="translated">$1
  7. Click “Replace all”.
  8. Save the file.

You can now open the file in memoQ using Add document and all 100% Studio matches will have green “Confirmed” status.

It is possible to set “Pre-translated” status for all fuzzy matches from Studio.

  1. Conduct steps 1-4 of the procedure above (if necessary).
  2. In the Search field enter: <target>(.*)(?="Draft")
  3. In the Replace field enter: <target state="needs-adaptation">$1
  4. Click Replace all.
  5. Save the file.
  6. Start memoQ, open your project.
  7. Select Add document as…
  8. In the States tab use the drop-down list to set status “Pre-translated” for “needs-adaptation” state.
  9. Optionally you can select Map memoQ states to XLIFF states at export field.
  10. Click OK.

You can use the same procedure to map other Studio segment states – I don’t have many Studio files, so I don’t know other states than the two described above.

Unfortunately I haven’t found (yet) any way to carry over match percentage info, since it seems that at the moment memoQ does not support XLIFF <alt-trans> element with “match-quality” attribute. I think it would be possible to devise some round trip using comments, but this would be rather complicated.

OK, how about setting “Approved” status for finished Studio file? Once again, you can employ simple search&replace operation.

Setting Studio states in translated file

  1. Make a backup copy of translated .sdlxliff file.
  2. Open .sdlxliff file in Notepad++.
  3. Select Search > Replace (Ctrl-H).
  4. Select Regular expressions option.
  5. In the Search field enter: (<sdl:seg id="\d*" )/>(?!<sdl:seg id="\d*" conf)
  6. Replace with: $1conf="Translated" origin="tm" origin-system="Your_TM_name" percent="100"></sdl:seg>
    OR
    Replace with: $1conf="Translated" origin="interactive"></sdl:seg>
  7. Click Replace all.
  8. Save the file.

Take care to replace “Your_TM_name” with the name of TM used during translation, since this value will be visible in Studio.

Please note, that all segments altered this way will have a TM match value set to 100% – this can be explained by pre-translation of  the finished file. The alternative version will mark all segments as translated from scratch, no TM match.

If you checked option  (point 9 of procedure 2), you can use <target state=”xxx”> attributes to set different states for Studio, depending on the memoQ states – writing appropriate regexes shouldn’t be difficult.

If you know other Studio .sdlxliff states or if you’d like to add something, please write a reply.

Edit:

I’ve entered a correction for search regexp used during back conversion to Studio. Now it’s more robust.

And regex examples for setting Studio states based on memoQ exported states:

Search: (<target state="translated">.*<sdl:seg id="\d*" )/>(?!<sdl:seg id="\d*" conf)

Replace:  $1conf="Translated" origin="interactive"></sdl:seg>

 

Search: (<target state="needs-translation">.*<sdl:seg id="\d*" )/>(?!<sdl:seg id="\d*" conf)

Replace:  $1conf="Draft" origin="interactive"></sdl:seg>

Edit 2:

Added alternative “Replace with” for back conversion to Studio.

Also, it is possible to mark Studio context matches as proofreaded in memoQ – write a comment, if you are interested in regexp.

8 comments

Skip to comment form

  1. Kevin Lossner

    Sounds like these transformations might be good candidates for a drag & drop Windows Scripting Host tool.

  2. Wasaty

    Probably – unfortunately I don’t know such tools and I don’t have time right now to learn, but feel free to implement the modifications. It would be great to have some simple tool for this.

  3. Wojciech Froelich

    Please define requirements and I will see what I can do 🙂

  4. Wasaty

    I’ll try to define them tomorrow.

  5. T. van Nellen

    Thank you for this great workaround! I noticed that compared to http://tech.groups.yahoo.com/group/memoQ/message/25602 you added
    (?!<sdl:seg id="\d*" conf)
    Is this the correction to make it more robust that you mention?

  6. Wasaty

    Yes. It came out to be necessary in some cases – I missed them during initial testing.

  7. T. van Nellen

    I wrote a script to set the Studio states in translated sdlxliff files. You can download it from http://vannellen.site11.com/scripts/scripts.html

  8. Alex

    @T. van Nellen

    Dear Mr. van Nellen,

    Where is possible to find your script for batch change status of translated segments?

    Best regards,
    Alex

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>