Validating expressions as Do Not Translate Thread poster: Omer Shani
| Omer Shani Israel Local time: 17:13 Member (2012) English to Hebrew + ...
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 | | | 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 | | | 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: 17:13 Member (2012) English to Hebrew + ... 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 | |
|
|
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: 16:13 Member (2016) English to German | 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 ma... See more 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 ▲ Collapse | | | xxRGProz (X) Spain Local time: 16:13 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):
- 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).
▲ Collapse | |
|
|
Omer Shani Israel Local time: 17:13 Member (2012) English to Hebrew + ... 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). | | | xxRGProz (X) Spain Local time: 16:13 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.
- 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).
▲ Collapse | | | Omer Shani Israel Local time: 17:13 Member (2012) English to Hebrew + ... 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).
| | | 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 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 » |
| Protemos translation business management system | Create your account in minutes, and start working! 3-month trial for agencies, and free for freelancers!
The system lets you keep client/vendor database, with contacts and rates, manage projects and assign jobs to vendors, issue invoices, track payments, store and manage project files, generate business reports on turnover profit per client/manager etc.
More info » |
|
| | | | X Sign in to your ProZ.com account... | | | | | |