MemoQ 2014 R2 auto-translation rules
Thread poster: Châu Nguyễn

Châu Nguyễn  Identity Verified
Vietnam
Local time: 11:43
English to Vietnamese
+ ...
Aug 3, 2015

Hi, i'm kinda new to MemoQ auto-translation rules.

Could any one help me to write an expression to convert a date string from format 'dd/mm/yyyy' to 'mmmm dd, yyyy'? e.g: 01/01/2014 => January 01, 2014.

I tried the following:
- Since the month would be a number, I created a translation pairs custom list #month# with source is number from 01-12 and target is January-December.

- In the Auto-translation rules I created the following auto-translation rules: '(\d)/(#month#)/(\d)' and Replace order rules: '$2 $1, $3'.

- The result: 01/01/2014 => 01nuary 01, 2014 | 01/02/2014 => 02bruary 01, 2014.

I wonder why is there always two digit that replace the first 2 characters of the $2. If I put extra spaces in front it would show 01 January 01, 2014 | 02 February 01, 2014.

I appreciate all your help.
Thanks.


Direct link Reply with quote
 
Manuel Arcedillo
Spain
Local time: 05:43
English to Spanish
RegEx needs fixing Aug 3, 2015

Hi,

Try \d+ instead of \d in both instances.

Edit: I now see that these rules behave one way in the preview and another way in the editor. Where are you experiencing this?

[Edited at 2015-08-03 14:58 GMT]


Direct link Reply with quote
 

Châu Nguyễn  Identity Verified
Vietnam
Local time: 11:43
English to Vietnamese
+ ...
TOPIC STARTER
I did not check in the editor Aug 4, 2015

I only preview my regex. Since it did not turn out as I expected, I did not use it in editor mode. Now that you mentioned it, I will try and see what happened.

I found the solution
To convert from dd/mm/yyyy to mmm dd, yyyy the auto-translation rule should be (\d\d)/(#month#)/(\d\d\d\d) and the replace order rule should be $2 $1, $3.

[Edited at 2015-08-04 02:54 GMT]

More notes:
- There is a different between 1 and 01. So in the above example if you want to translate 1 or 01 into January, You have to create 2 different list items in the Translation pairs. i.e. 1 - January and 01 - January. The same for other months.

- Different translation rules must be set to cover all possible of the date and time format as in my above example.
+ 05/01/1989 : (\d\d)/(#month#)/(\d\d\d\d)
+ 5/1/1989: (\d)/(#month#)/(\d\d\d\d)
+ 5/1/89: (\d)/(#month#)/(\d\d)

[Edited at 2015-08-04 03:29 GMT]


Direct link Reply with quote
 
Manuel Arcedillo
Spain
Local time: 05:43
English to Spanish
If you need something simpler Aug 4, 2015

I'm glad you found a solution. If you want to use just one rule for all cases you mention and similar ones, this should work: (\d+)/(#month#)/(\d+)

Direct link Reply with quote
 

Châu Nguyễn  Identity Verified
Vietnam
Local time: 11:43
English to Vietnamese
+ ...
TOPIC STARTER
Thank you Aug 4, 2015

Manuel Arcedillo wrote:

I'm glad you found a solution. If you want to use just one rule for all cases you mention and similar ones, this should work: (\d+)/(#month#)/(\d+)


Thank you,

I didn't understand your suggestion at first. I've just read through the documentation and kinda understand it now.


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 »

MemoQ 2014 R2 auto-translation rules

Advanced search






SDL MultiTerm 2017
Guarantee a unified, consistent and high-quality translation with terminology software by the industry leaders.

SDL MultiTerm 2017 allows translators to create one central location to store and manage multilingual terminology, and with SDL MultiTerm Extract 2017 you can automatically create term lists from your existing documentation to save time.

More info »
Déjà Vu X3
Try it, Love it

Find out why Déjà Vu is today the most flexible, customizable and user-friendly tool on the market. See the brand new features in action: *Completely redesigned user interface *Live Preview *Inline spell checking *Inline

More info »



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