Validating expressions as Do Not Translate
Thread poster: Omer Shani

Omer Shani
Israel
Local time: 11:24
Member (2012)
Sep 6, 2016

Hello memoQ talents,
We are translating GUI for a client, where in places where we have {First_Name} and alike, it should remain as is, and not be translated.

Is there a way to define that given this expression: curly brackets + a text within, itshould not be translated at all, whether in DoNotTranslate section or elsewhere?

We are using memoQ 2015 Build 157 version.

Thanks,

Omer Shani
BlueLion Language Services


 

Stanislav Okhvat
Local time: 11:24
English to Russian
Use Regex tagger Sep 6, 2016

Hello Omer,

You should use Regex Tagger after you import your document. In the Regex Tagger window, type \{[A-Za-z_.]+\} in the Regular Expression box, select Empty option button below, and then press Add and OK.

Best regards,
Stanislav Okhvat
TransTools – Useful tools for every translator


 

Anthony Green  Identity Verified
Italy
Local time: 10:24
Italian to English
+ ...
Stan's the man Sep 6, 2016

Once Stanislav has spoken, there is usually not much more to say. Did it work?

 

Omer Shani
Israel
Local time: 11:24
Member (2012)
TOPIC STARTER
Almost there... Sep 6, 2016

Thank you Stanislav & Anthony

Well, I implied the expression in the Auto-Translaion corpora, and previewed it, but when testing it on real (after attaching it to the project, of course) I didn't see any suggestion from memoQ about it

Maybe I missed something?

The regex I used is: {{A-Za-z_A-Za-z.+}}

The source segment is {{first_name}}....

Thanks

Omer


 

Mirko Mainardi  Identity Verified
Italy
Local time: 10:24
Member
English to Italian
Did you run regex? Sep 6, 2016

Omer Shani wrote:

Thank you Stanislav & Anthony

Well, I implied the expression in the Auto-Translaion corpora, and previewed it, but when testing it on real (after attaching it to the project, of course) I didn't see any suggestion from memoQ about it

Maybe I missed something?


Usually I apply regex expressions either during import or after, through Preparation > Regex Tagger. This way you can define a new expression/set of expressions and apply it to an already imported document. Just follow Stanislav's instructions to the letter.


The regex I used is: {{A-Za-z_A-Za-z.+}}

The source segment is {{first_name}}....


"{{A-Za-z_A-Za-z.+}}" is not a valid regular expression, AFAIK. Use " \{[A-Za-z_.]+\}", as Stanislav suggested. Personally, I think I'd go with an even simpler \{.+\}, which should catch everything and anything between curly brackets (as you wrote "{First_Name} and alike").


 

Jan Truper
Germany
Local time: 10:24
Member (2016)
English to German
+ ...
Regex checking Sep 6, 2016

You can easily check Regex strings here:
https://regex101.com


 

Stanislav Okhvat
Local time: 11:24
English to Russian
Problem with . Sep 7, 2016

Hello Mirko,

I just wanted to comment on the expression you also suggested, \{.+\}

The problem here is that the dot (.) matches any symbol and + is greedy, so it gobbles up everything until the end of the string and only then starts to backtrack symbol after symbol until } is encountered, when it will stop with success. So if the text contains "Page {pagenum} of {pagecount}", there will be only one match - "{pagenum} of {pagecount}", not two matches.

To make + non-greedy, you can use +? quantifier operator. This operator will gobble up one symbol, and then check whether the next one is }, if not, it will gobble up another one, then check for }, etc.

For CAT tools, it's probably wiser to use non-greedy quantifiers +? or *? always because segments are usually short and the performance will not suffer.

However, I usually use the greedy alternatives when possible, but I always apply the greedy quantifier + to a character class like [xyz] that will never match the character that ends the sequence (which is } in our case). In my expression \{[A-Za-z_.]+\} I added . at the end which is considered a regular dot symbol at the end of the character class. This is needed because . may be part of variable names, like {page.num}.

Greedy vs non-greedy quantifiers are explained here: http://www.regular-expressions.info/repeat.html

Best regards,
Stanislav Okhvat
TransTools – Useful tools for every translator


 

Rafa Gómez  Identity Verified
Spain
Local time: 10:24
Member (2009)
English to Spanish
Please follow these steps Sep 7, 2016


  • Open your file in memoQ and go to Preparation (1) > Regex Tagger (2).
  • On the Tag current document window, enter exactly this in the Regular expression box (3):

    \{\{[^}]+\}\}

  • Select Required (4) and click on Add (5).
  • You should see the tags in red in the results pane. If they seem correct, click OK (6).


If you immediately see that some tags are wrong, just press Ctrl+z (otherwise, you'll have to reimport the document or edit the source text with F2).

u3mx8fy2aiem8bngro17.png


 

Omer Shani
Israel
Local time: 11:24
Member (2012)
TOPIC STARTER
Thank you but... Sep 7, 2016

Thanks a lot for the Regex Tagger idea, it worked beautrfilly, but I want to add this regex as an AutoTranslation rule...

How do I manage it?

Thanks

Omer
Rafa Gómez wrote:


  • Open your file in memoQ and go to Preparation (1) > Regex Tagger (2).
  • On the Tag current document window, enter exactly this in the Regular expression box (3):

    \{\{[^}]+\}\}

  • Select Required (4) and click on Add (5).
  • You should see the tags in red in the results pane. If they seem correct, click OK (6).


If you immediately see that some tags are wrong, just press Ctrl+z (otherwise, you'll have to reimport the document or edit the source text with F2).

u3mx8fy2aiem8bngro17.png


 

Rafa Gómez  Identity Verified
Spain
Local time: 10:24
Member (2009)
English to Spanish
Same regex for auto-translation rules Sep 7, 2016


  • In memoQ, open your project and go to Project home > Settings > Auto-translation rules.
  • Click on Create/use new (you could name it Brace tags, for example), and then click on Edit.
  • On the Edit auto-translation rule set window, type in the same regex in the Auto-translation rules box (1), and then select Add (2):

    \{\{[^}]+\}\}

  • In the Replace order rules (3), enter $0 and then click on Add (4).
  • Finally, just click OK (5).


q8zbriiu2rumn1j3hxfj.png


 

Omer Shani
Israel
Local time: 11:24
Member (2012)
TOPIC STARTER
Awesome!!! works like a charm :) Thank you Rafa! Sep 8, 2016

Rafa Gómez wrote:


  • In memoQ, open your project and go to Project home > Settings > Auto-translation rules.
  • Click on Create/use new (you could name it Brace tags, for example), and then click on Edit.
  • On the Edit auto-translation rule set window, type in the same regex in the Auto-translation rules box (1), and then select Add (2):

    \{\{[^}]+\}\}

  • In the Replace order rules (3), enter $0 and then click on Add (4).
  • Finally, just click OK (5).


q8zbriiu2rumn1j3hxfj.png


 


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


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

Validating expressions as Do Not Translate

Advanced search






PerfectIt consistency checker
Faster Checking, Greater Accuracy

PerfectIt helps deliver error-free documents. It improves consistency, ensures quality and helps to enforce style guides. It’s a powerful tool for pro users, and comes with the assurance of a 30-day money back guarantee.

More info »
Wordfast Pro
Translation Memory Software for Any Platform

Exclusive discount for ProZ.com users! Save over 13% when purchasing Wordfast Pro through ProZ.com. Wordfast is the world's #1 provider of platform-independent Translation Memory software. Consistently ranked the most user-friendly and highest value

More info »



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