Using Regular Expression Delimited Text Filter in SDL Trados Studio

SDL Trados provides users various powerful filters. On this page, I want to discuss how to use a regular expression delimited text filter in SDL Trados Studio 2011/2014. I chose the following .po file as a sample to translate using Trados. Of course, there is a predefined filter for translating .po files. Here, I just want to show how SDL Trados filter actually helps you translate complex text-based files by translating a simple .po file.

A sample .po file
A sample .po file

First, create a custom Delimited Text Document Filter by clicking "New..." in the "Filter Types" screen as shown in the following figure.

Create a new Regular Expression Delimited Text Filter
Create a new Regular Expression Delimited Text Filter in SDL Trados Studio 2011/2014

In the newly created Regular Expression Delimited Text filter, specify the name of the filter and add file extension *.po to "File dialog wildcard expression:." List items should be separated with a semicolon.

File dialog wildcard expression
File dialog wildcard expression

In the sample .po file, the strings which need to be translated are placed between [msgstr "] and ["] as follows:

msgstr "Monthly Archives: %s"

In the "Document structure" section under the filter, add the following patterns:

Opening pattern: msgstr "

Closing pattern: "\s*$

Document structure
Document structure

Now, we are ready to load .po file into SDL Trados.

Please click "Open Document..." and select the file to be translated. In the "Open Document" dialog, please select the custom filter defined above as "File Type:"

PO file in SDL Trados Studio

The sample po file is now loaded into SDL Trados Studio for translation. But you will notice there is a html tag in the strings above. We need to specify some settings in the custom regular expression delimited text filter. In the "Inline tags" section under the relevant filter, we can add inline tags.

Add inline tags
Add inline tags

In the sample .po file, one tag <span> is used. It can be added as shown above.

The following figure shows the .po file re-loaded with a modified filter in SDL Trados Studio. Now, it's easier to translate.

Po file in SDL Trados Studio 2011 2014

It's easy to process complicated text based files using a custom regular expression delimited text filter provided by SDL Trados Studio.

In addition, some knowledge in regular expressions will help you process various file formats using a custom filter. RegexBuddy is a useful tool which enables you to create regular expressions with ease.

 

 More efficient patterns for inline tags

In the above sample, there are some strings which do not need to be translated. It's more efficient to process them as inline tags in Trados. Then, how can I convert "&rarr;", "&rdquo;", "&ldquo;"... to inline tags? In the "Inline tags" section, add the following pattern in "Opening pattern":

&[^;].*?;

For such tags as <b>, <br />, <span class="top-nav">, you can use the following pattern:

<[^>].*?>

If this rule processes unexpected results, you might be able to add them one by one.

Inline tags


5 개 댓글

  1. Hi, Peter.
    I want to translate the .po file of my WordPress Theme "Catch Box" from English to Chinese. I can deal with the .po file easily with the software POEDIT. I also want to have a try, to edit the .po file in SDL Trados Studio. Your post here helps me a lot.
    After the .po filetype is defined, I can open the file in Trados Studio, but I got always problem, the .po file cannot be well filtered in source text. Almost all elements in the .po file are showed in the source text.
    The .po file is created from the original .pot file by myself. I'm not sure, is the .po file not right, or I have done something wrong in Trados Studio. (I also have tried, the “Document structure” to be filtered as msgid, it didn't work.)
    I'm happy to hear your suggestion.
    With regards, Mewmew

    • Hello Mewmew
      In Trados Studio 2011, I imported the strings from .po file using the above method.
      If it's not successful, there are also other methods to translate po file.
      One of them is using tw4winPrepareRC.Main macro in MS Word. However, this method will be valid for Trados 2007.

      Or, if the strings which need to be translated contain no line break, you also might be able to import the strings in the Excel file using Regular Expressions.

      If you want, you can send me a sample po file for me to test from http://koreantranslator.cafe24.com/contact/ (I just added a field to upload files. If you fail to upload files, please let me know.)

Leave a Comment

3s