For Programmers: Free Programming Magazines  


Home > Archive > Smalltalk > November 2006 > MMT--> VW7.4.1 strange Locale currency bahaviour









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author MMT--> VW7.4.1 strange Locale currency bahaviour
maarten

2006-11-03, 4:01 am

Hi,

IN VW7.4.1 I noticed the following behaviour on the Locales currency
print policies:

If I do:

Locale set:#'pt_BR.CP1252'

Locale current printAsCurrency: 1234567.89.
This will result in: Text for '1.234.567,90528 '
Which is the wrong answer !!"


Now try the same thing but this time using FixedPoint:

Locale current printAsCurrency: 1234567.89s.
We now get: " Text for '1.234.567,89000 '
This is better but still the wrong answer for a formatstring defined as:
'#.##0,00;(#.##0,00)'


Now try the dutch one:

Locale set:#'nl_D.CP1252'
Locale current printAsCurrency: 1234567.89. Text for '1.234.567,92€'
This is wrong twice as the format string defines:
'#,###.00€;[RED]-#,###.00€;0.00€'.

Now we set back the locale to the default one:

Locale setDefault "which for me is the eqivalent of:" Locale
set:#'fr_FR.CP1252'

Locale current printAsCurrency: 1234567.89s Text for '1.234.567,89€'

This time the answer is correct ???


Also notice that the correct territory identifier for the netherlands
(#'nl_D.CP1252') is NL. the D stands for Germany.
In Holland or the Netherlands we speak Dutch in German or Deutchland
they speak German both are different or at least if you are into soccer.
But then the lator is minor.

@+Maarten,
Thomas Brodt

2006-11-03, 4:01 am

Aside the formatting problem, the locale should be nl_nl.CP1252 for you.
the ISO 639-1 for two character codes states that the territory for
netherlands is nl and the language code nl stands for dutch. (a three
character identifier would be nld, but they are not used)

Country code for Germany is de (not D), language german is de, so
Germany is de_de, Switzerland's german would be de_ch or austrian de_at.

Thomas


maarten schrieb:
> Hi,
>
> IN VW7.4.1 I noticed the following behaviour on the Locales currency
> print policies:
>
> If I do:
>
> Locale set:#'pt_BR.CP1252'
>
> Locale current printAsCurrency: 1234567.89.
> This will result in: Text for '1.234.567,90528 '
> Which is the wrong answer !!"
>
>
> Now try the same thing but this time using FixedPoint:
>
> Locale current printAsCurrency: 1234567.89s.
> We now get: " Text for '1.234.567,89000 '
> This is better but still the wrong answer for a formatstring defined as:
> '#.##0,00;(#.##0,00)'
>
>
> Now try the dutch one:
>
> Locale set:#'nl_D.CP1252'
> Locale current printAsCurrency: 1234567.89. Text for '1.234.567,92€'
> This is wrong twice as the format string defines:
> '#,###.00€;[RED]-#,###.00€;0.00€'.
>
> Now we set back the locale to the default one:
>
> Locale setDefault "which for me is the eqivalent of:" Locale
> set:#'fr_FR.CP1252'
>
> Locale current printAsCurrency: 1234567.89s Text for '1.234.567,89€'
>
> This time the answer is correct ???
>
>
> Also notice that the correct territory identifier for the netherlands
> (#'nl_D.CP1252') is NL. the D stands for Germany.
> In Holland or the Netherlands we speak Dutch in German or Deutchland
> they speak German both are different or at least if you are into soccer.
> But then the lator is minor.
>
> @+Maarten,

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com