[ic] locale: decimals truncated - a workaround for something very similar.

John Matecsa interchange-users@icdevgroup.org
Sun Apr 13 23:02:01 2003


Regarding Andrei & Alessandro's  discussion, which is included at the
bottom of this message for reference.

=============

I'm coping with a very similar decimal truncation problem.

After applying changes in the back-end, all prices are rounded down to
the nearest dollar.

Restarting Interchange brings the pennies back.

I've been using this work-a-round since deploying dual language in
January.

==============

Here are the (hopefully!) relevant details about my system.

Interchange version      4.8.6
Perl 5.6.1
Redhat 7.0 with all the latest patches.

In catalog.cfg

# Last locale specified is the default.
Locale          en_US LC_CTYPE C
LocaleDatabase  locale

Locale fr_FR DescriptionField    description_fr
Locale en_US DescriptionField    description

Locale fr_FR CategoryField    category_fr
Locale en_US CategoryField    category

Locale fr_FR ImageDir __IMAGE_DIR__/foundation_fr/
Locale en_US ImageDir __IMAGE_DIR__/foundation/

The locale specific currency formating is as it was when makecat was use
to build it . Probably IC 4.6.


The user can change languages using the following togglelanguage.html

[comment]
ui_template: yes
ui_template_name: leftonly
[/comment]

[tmp page_title][LC]Toggle between English and French[fr_FR]Basculez
entre anglais-français[/fr_FR][/LC][/tmp]

[LC]
[setlocale locale=en_US currency=en_US persist=1] 
[fr_FR]
  [if session logged_in][query st=db sql="UPDATE userdb SET
default_locale = 'en_US' WHERE username = '[data base=session
field=username filter=sql]'"][/query][/if]
  [setlocale locale=en_US currency=en_US persist=1]
[/fr_FR]
[en_US]
  [if session logged_in][query st=db sql="UPDATE userdb SET
default_locale = 'fr_FR' WHERE username = '[data base=session
field=username filter=sql]'"][/query][/if]
  [setlocale locale=fr_FR currency=en_US persist=1]
[/en_US]
[/LC]

[control reset=1]

  [control-set]
    [component]search_box_small[/component]
[matches]10[/matches]
  [/control-set]


  [control-set]
    [component]category_vertical[/component]
[timed]0[/timed]
[set_selector]left[/set_selector]
[page_class]all[/page_class]
  [/control-set]


  [control-set]
    [component]none[/component]
  [/control-set]


  [control-set]
    [component]none[/component]
  [/control-set]


  [control-set]
    [component]none[/component]
  [/control-set]

[control reset=1]

@_LEFTONLY_TOP_@

<!-- BEGIN CONTENT -->
<br>
<br>
[comment]Locale was [scratch mv_locale]<br/>[/comment]

[LC]
           The language was just defaulted to English.<br><br>
           Press <a href="[area togglelanguage]"><b> here</b></a> to
change it to French

[fr_FR]
	   La langue vient de changer du français à l'anglais.<br><br>
           Appuyez <a href="[area togglelanguage]"><b> ici</b></a> pour
retransférer au français

[/fr_FR]

[en_US]
           The language was just changed from English to French.<br><br>
           Press <a href="[area togglelanguage]"><b>here</b></a> to
change it back to English

[/en_US]
[/LC]

<br>
<br>
<br>
<!-- END CONTENT -->

@_LEFTONLY_BOTTOM_@




John.

On Fri, 2003-04-11 at 09:44, Andrei Gologan wrote:
> 
> > Quoting Alessandro Scudieri (Scudieri@openinformatica.it):
> > > >
> > > > Then put the price data back to N.NN and try these as your last lines:
> > > >
> > > > Locale          it_IT
> > > > Locale          en_US
> > > > Locale          it_IT default 1
> > > Ok, with this, and "." in decimals, all currency values are displayed
> > > properly and the default locale is italian. But... why ic doesn't read
> the
> > > "default" row in locale.txt ?
> >
> > It does, but you did this *last*. The problem is that the special:
> >
> >     Locale  it_IT
> >
> > sets the actual *system* locale. That changes Perl's settings, and
> > Interchange can't do a darned thing about it without really doing
> > risky things in the way of number formats.
> >
> 
> Hallo
> 
> I have the same problem occuring after moving form IC 4.8.3 to IC 4.8.7 ,
> when I put:
> 
> Locale de_DE
> 
> it shows the price as NN.00 no decimal values at all. whatever decimal is
> there it gets converted to ,00
> Price picture like this N,NN in the mysql table turn the price into 80.00 .
> I have all prices as N.NN . with Locale en_US it shows me prices like NN.NN
> but this is not the european format.
> 
> I have:
> 
> code    en_US   de_DE   fr_FR
> frac_digits     2       2       2
> currency_symbol EUR     EUR     EUR
> decimal_point   ,       ,       ,
> p_cs_precedes
> mon_thousands_sep       .       .       .
> mon_decimal_point       ,       ,       ,
> mon_thousand_sep
> p_sep_by_space          2       2
> default 0       1       0
> price_picture
> 
> How can I switch to the de_DE Locale again ?
>  I tried anything on the mailing list but it does not work.
> 
> Thank you for your help.
> Andrei
> 
> 
> 
> 
> 
> _______________________________________________
> interchange-users mailing list
> interchange-users@icdevgroup.org
> http://www.icdevgroup.org/mailman/listinfo/interchange-users
-- 
John Matecsa <matecsaj@picassofish.com>
Picasso Fish Corporation