MemoQ 2014 R2 auto-translation rules
Thread poster: Châu Nguyễn
Châu Nguyễn
Châu Nguyễn  Identity Verified
Vietnam
Local time: 06:47
Member (2012)
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 rule
... See more
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.
Collapse


 
Manuel Arcedillo
Manuel Arcedillo
Spain
Local time: 01:47
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]


 
Châu Nguyễn
Châu Nguyễn  Identity Verified
Vietnam
Local time: 06:47
Member (2012)
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.
... See more
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]
Collapse


 
Manuel Arcedillo
Manuel Arcedillo
Spain
Local time: 01:47
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+)

 
Châu Nguyễn
Châu Nguyễn  Identity Verified
Vietnam
Local time: 06:47
Member (2012)
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.


 


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






Trados Business Manager Lite
Create customer quotes and invoices from within Trados Studio

Trados Business Manager Lite helps to simplify and speed up some of the daily tasks, such as invoicing and reporting, associated with running your freelance translation business.

More info »
CafeTran Espresso
You've never met a CAT tool this clever!

Translate faster & easier, using a sophisticated CAT tool built by a translator / developer. Accept jobs from clients who use Trados, MemoQ, Wordfast & major CAT tools. Download and start using CafeTran Espresso -- for free

Buy now! »