Replace "" Quotation Marks in TTX File - Wildcard Expert Needed
Thread poster: Emal Ghamsharick

Emal Ghamsharick  Identity Verified
Germany
Local time: 18:52
English to German
+ ...
Feb 23, 2011

Hello everyone, I know this is an old question, but I haven't been able to find the answer.

I have a very long TTX file for TagEditor.
Now I want to replace the "" quotation marks in the target version with typographical ones (“”).

Find and replace in TagEditor is not an option, the available functions are less than basic and doing it manually would probably take a full day.

When I open it as an XML in Word to do find and replace, there are also "" marks in the tags and source segments, which I can't skip.

[I would have to first hide the tag text and the source text and then find and replace all quotation marks in the target segments. Does anyone know the procedure? Google doesn't.]

My preferred option would be using Trados Studio 2009, which has a more advanced F&R function than TagEditor and also lets me edit the target text only. Still, I don't know the necessary wildcards and I haven't been able to Google them.

To sum it up: Can anyone tell me how to find and replace "" with “” marks in Trados Studio 2009 or MS Word?


Direct link Reply with quote
 

Rossana Triaca  Identity Verified
Uruguay
Local time: 13:52
Member (2002)
English to Spanish
Unfortunately... Feb 24, 2011

As far as I know, SDL Trados does not truly support regular expressions since you can use them in the "find" field but not in the "replace" field (hence making them quite useless).

Regarding Word, I imagine it would be possible to create your own XSL transform to display only the tags you're interested in and then use a wildcard s&r, but it doesn't seem very easy... (or at least that's why people use XML parsers). Otherwise, I don't see how you can avoid searching within the tags, or if you do how to preserve them.

I think the fastest route would be to download a free text editor with regex support (such as Notepad++), rename the .ttx to .txt and try tinkering with regular expressions. I'm far from an expert and barely just dabble in regular expressions, but I just tried this and it worked:

Find: ([^=])\"([A-Za-z0-9])
Replace: \1“\2

This finds a quote that is not preceded by a "=" symbol (hence is not an initial quote within a tag) and that is followed by any alphanumeric character, and then replace whatever it found before the quote with the typographical quote and the character found (this assumes none of the quotes begin with a special char, but that may depend on your language, in Spanish for example I would use ([^=])\"([A-Za-z0-9¡¿]) to cover all cases.

After replacing all the initial quotes, I used:

Find: (“[^"]+)"
Replace: \1”

This finds the initial typhographical quote we just replaced, then at least one of any character except a quote, and then the first instance of a quote. Take into account that after replacing all the instances the search won't work because it'll run over into the tags (but you'll be finished by then).

I'm sure this can be done more elegantly in a single s&r but it certainly escapes my knowledge... plus it's not wholly bad to check again the TUs with the initial quotes that you're closing.

Caveat emptor: The .ttx I tried this on didn't have any strange cases (such as mixing “” and "" in the TUs, or quotes with newlines or paragraphs in the middle, etc.). I would naturally make copies of everything before tinkering with it and after making the replacements I'd use a simple document comparison tool (Winmerge, etc.) to check that the only changes made were in the quotes.

Another pitfall could be encoding; depending on your file quotes in the TUs could be displayed as " (but then again you can modify the regex using that instead of ").

Another route would be to use Okapi or any other third-party tool that lets you extract text from a .TMX into a simple tab delimited file and then make the S&R in Word now that there's no pesky tabs and then reimporting the text to your .TMX. Obviously, for this to be efficient you should be familiar with the tool...

All in all, I think it's really lame that Trados doesn't support regexes... this would be a piece of cake in that case!


Direct link Reply with quote
 

István Hirsch  Identity Verified
Local time: 18:52
English to Hungarian
You can work in Studio Feb 25, 2011

This works correctly (I hope) if the end quotation mark is not preceded and the front quotation mark is not followed by a whitespace. It is not usual to start or end a quotation with a whitespace, but you never know. Check that and correct them manually.

Then press Ctrl + H in Editor View, check „Use” checkbox, select „Regular Expressions” and

Find: *(?<=\S)"* Replace with: *”* (the new end mark) then

Find: *"(?=\S)* Replace with: *„* (the new front mark).

Asterisks are not part of the expressions. I could not produce the same new quotations marks you are going to use.


Direct link Reply with quote
 

Rossana Triaca  Identity Verified
Uruguay
Local time: 13:52
Member (2002)
English to Spanish
The substitution proposed by István... Feb 25, 2011

works great in SDL 2009 (as long as there are no pesky whitespaces that shouldn't be there in the first place).

BTW, you couldn't find the upper left/right quotation marks since they are not defined in ASCII but in Unicode. In fact, SDL will show you ” when you input “ for the second replacement, but as soon as it detects its followed by a character when replacing it will change it to the correct symbol (I honestly thought this encoding sleight-of-hand was beyond Trados and that's why I thought about more complex regexes... I should give credit where credit is due).

For posterity's sake, it's worth noting that this post is immensely useful for Spanish translators that use English quotation marks due to laziness when they should be using the Spanish angular ones («»). Translate as usual, then make the replacements et voila!


Direct link Reply with quote
 

Emal Ghamsharick  Identity Verified
Germany
Local time: 18:52
English to German
+ ...
TOPIC STARTER
Thank you! Feb 25, 2011

Thank you for your great comments. I wouldn't have been able to figure that out on my own, since my F&R skills are pretty rudimentary.
I've had this problem for a long time and I'm really glad there's finally a solution to it!


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 »

Replace "" Quotation Marks in TTX File - Wildcard Expert Needed

Advanced search







LSP.expert
You’re a freelance translator? LSP.expert helps you manage your daily translation jobs. It’s easy, fast and secure.

How about you start tracking translation jobs and sending invoices in minutes? You can also manage your clients and generate reports about your business activities. So you always keep a clear view on your planning, AND you get a free 30 day trial period!

More info »
PDF Translation - the Easy Way
TransPDF converts your PDFs to XLIFF ready for professional translation.

TransPDF converts your PDFs to XLIFF ready for professional translation. It also puts your translations back into the PDF to make new PDFs. Quicker and more accurate than hand-editing PDF. Includes free use of Infix PDF Editor with your translated PDFs.

More info »



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