International Translation Day 2017

Join ProZ.com/TV for a FREE event on September 26-27th celebrating International Translation Day! 50+ hours of content, Chat, Live Q&A & more. Join 1,000's of linguists from around the globe as ProZ.com/TV celebrates International Translation Day.

Click for Full Participation

Validating expressions as Do Not Translate
Thread poster: Omer Shani
Omer Shani
Israel
Local time: 17:02
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


Direct link Reply with quote
 
Stanislav Okhvat
Local time: 17:02
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


Direct link Reply with quote
 

Anthony Green  Identity Verified
Italy
Local time: 16:02
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?

Direct link Reply with quote
 
Omer Shani
Israel
Local time: 17:02
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


Direct link Reply with quote
 

Mirko Mainardi  Identity Verified
Italy
Local time: 16:02
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").


Direct link Reply with quote
 

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

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


Direct link Reply with quote
 
Stanislav Okhvat
Local time: 17:02
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


Direct link Reply with quote
 
Rafa Gómez  Identity Verified
Spain
Local time: 16:02
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).

regex-tagger


Direct link Reply with quote
 
Omer Shani
Israel
Local time: 17:02
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).

regex-tagger


Direct link Reply with quote
 
Rafa Gómez  Identity Verified
Spain
Local time: 16:02
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).


auto-translation-rules


Direct link Reply with quote
 
Omer Shani
Israel
Local time: 17:02
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).


auto-translation-rules


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 »

Validating expressions as Do Not Translate

Advanced search






TM-Town
Manage your TMs and Terms ... and boost your translation business

Are you ready for something fresh in the industry? TM-Town is a unique new site for you -- the freelance translator -- to store, manage and share translation memories (TMs) and glossaries...and potentially meet new clients on the basis of your prior work.

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