[ic] Re: 4.9.4: [calc] and [currency] hosed - locale problem? [SOLVED]

Toni Mueller interchange-users@icdevgroup.org
Thu Jan 23 10:52:00 2003


Hi,


we had severe problems displaying the VAT correctly on our flypage,
the result being ALWAYS wrong.

Background information: With the constant changes in the legal
settings here in Germany, there appear to be requirements to
at least be able (afaik: MUST) show an item price net, the
vat amount, and both added together (don't ask me why 8-( ).
The legal rules on which to display, when, and what not to
display seem to change on an almost weekly basis, but in order
to avoid legal hassle, one has do adjust (or take the shop down).

Anyway, we originally wanted to show "nicely" formatted prices
in Euro according to our local tastes:

Locale          de_DE@euro
Locale          de_DE mon_decimal_point   ,
Locale          de_DE mon_thousands_sep   .
Locale          de_DE p_cs_precedes       0
Locale          de_DE currency_symbol     " €"

Unfortunately, this badly breaks [calc] and [currency] which are
somehow evaluating their expressions as _strings_ in Perl, much
like eval "stuff_inside_cal" (I didn't make too large inrods into
Vend/Interpolate.pm to be 100% sure, though).

With the settings above, you can say:

[calc][item-price noformat][/calc] and get the part of the price
that's _after_ the decimal point (really a comma), apparently
since this is the last part of a Perl expression:
[perl] 2, 3 [/perl] yields 3.

The workaround was to forcefully reset all locale settings to C,
but unfortunately the catalog required forcing decimal points
and such, too, before it would obey:

Locale           C
Locale           C currency_symbol     " €"
Locale           C mon_decimal_point   .
Locale           C frac_digits	       2

which makes for a less-localized experience, but at least solved
the numerical problems :-|

It would be nice if someone in the know could take a look at this
and suggest a solution, or a good place to start hacking. Thank
you!

This test was conducted with 4.9.6-something.


Side question: Is it sensible to run 4.9.7 in production already?


Best,
--Toni++