convert bad formatted number string with currency name to correct number format with translated currency name and propagate correctly

Hi,

I just had a job with a ton of lines with badly formatted numbers with currency name that needed to be translated while using correct formatting and according translation of currency. Is it possible to do this automated and have it propagated correctly?

EN > DE

2999 to 4000 dollar > 2.999 to 4.000 Dollar

8999 to 10000 leu > 8.999 to 10.000 Leu

So under TM settings you can set currencies and units and tell Studio how to handle them but Studio will then simply replace the same "symbol" in target but here we would need a translation as it's not a symbol per se but the currency.

The issue is that the numbers have a bad formatting so Studio does not recognise them as numbers to format to a currency format but simply propagates to numbers without correct formatting so I had to translate this line by line. :( With a few thousand lines with the same issue this was not very funny.

Br,

Pascal

emoji
Parents Reply
  • Because regex has limited flexibility for replacement, it may be necessary to write multiple regexes to handle various number "sizes".

    To avoid programming multiple regexes to handle the various formats, it may be better to program a more general regex with optional fields, and then “clean up” the results, as shown below.

    General regex: \b(\d{1,3})(,(\d{3}))?(,(\d{3}))?(\.(\d+))?\b
    Replace string: $1.$3.$5,$7
    Test string: 1,234,567.89 12,345.6 12
    Result string: 1.234.567,89  12.345.,6  12..,

     Whereby, the erroneous separators “.,” and “..,” can be cleaned up with the following Find regex:

    (?<ho>(\d*\.\d+)*)(\.+(?<lo>,\d+)|\.+,(?<lo>))
    and Replace string:
    ${ho}${lo}

    Test string: 1.234.567,89  12.345.,6  12..,
    Result string: 1.234.567,89  12.345,6  12

    The “General regex” can be extended using the same scheme to handle additional leading “thousand blocks”.

    emoji
Children
No Data