R: Re [ic] Locale question

Joachim Leidinger interchange-users@lists.akopia.com
Tue Jul 3 16:40:00 2001


Stefano Nota wrote:
> 
> Maybe i express myself bad,
> 
> In a page i should show 2 currency.
> One is euro, always.
> The second one is lire or dollars depending on locale setting.
> 
> When someone enter, he choose the language and i set currency to eur_EUR
> with
> 
>         [page process/locale/en_US/currency/eur_EUR/page/index]or
>         [page process/locale/it_IT/currency/eur_EUR/page/index].
> 
> Euro pricing is shown but  under [item-price], where i've written
> [setlocale it_IT]
>         [currency convert=1][item-field price][/currency]
> [setlocale]
> 
> if language is set to it_IT, price is shown as euro pricing, but it is
> converted correctly.
> Infact i obtain EURO 197.67
>                     EURO 351.124,25 (this should be Lit.351.125)
> 
> So in the page i should test the language to show also lira or dollars.
> Here is what's mean my if construct.
> 
> Now i express myself better?
> 
> Thanks stefano

Well duh! I have

-----------snip locale.txt----------
code	en_US	de_DE	fr_FR	eur_EUR
PriceDivide	2	1	0.1632	0.5623
ProductFiles				
currency_symbol	$	DM	FF	Euro
decimal_point	.	.	.	
default	0	1	0	0
frac_digits	2	2	2	2
mon_decimal_point	.	,	,	,
mon_thousand_sep		. 		
mon_thousands_sep	,	.	.	,
p_cs_precedes	1	0		1
p_sep_by_space		2	1	1
price_picture		###.###.###,## DM		
products
-----------snip locale.txt----------

and

-----snip catalog.cfg----------
Locale          fr_FR LC_CTYPE fr_FR
Locale          eur_EUR LC_CTYPE eur_EUR
Locale          en_US LC_CTYPE C 

Locale de_DE de_DE.ISO_8859-1
Locale de_DE LC_CTYPE de_DE
Locale de_DE LC_TIME de_DE
Locale de_DE LC_COLLATE de_DE
LocaleDatabase  locale
-----snip catalog.cfg----------


and

----------snip locale1.html----------
<HTML><HEAD><TITLE>locale test 1</TITLE></HEAD><BODY>

[seti pricetest]100.00[/seti]
The locale is [scratch mv_locale] and the price is <FONT
COLOR="RED">[currency convert=1][scratch
pricetest][/currency]</FONT>!<BR>
<BR>
[setlocale eur_EUR]
1. [currency convert=1][scratch pricetest][/currency]
<BR>
[setlocale de_DE]
2. [currency convert=1][scratch pricetest][/currency]
<BR>
[setlocale en_US]
3. [currency convert=1][scratch pricetest][/currency]
<BR>
[setlocale fr_FR]
4. [currency convert=1][scratch pricetest][/currency]
<BR><BR>
Switch the language:
<A HREF="[area
href="process/locale/en_US/page/locale1"]">English</A><BR>
<A HREF="[area href="process/locale/de_DE/page/locale1"]">Deutsch</A>

</body> </html>
----------snip locale1.html----------

German is the default language (see default in locale.txt) and I get

---------snip output-----
The locale is de_DE and the price is 100,00 DM!

1. Euro 177,84 
2. 100,00 DM 
3. $50.00 
4. 612,75 FF 

Switch the language:
English
Deutsch 
---------snip output-----

switch to english result

---------snip output----
The locale is en_US and the price is $50.00!

1. Euro 177,84 
2. 100,00 DM 
3. $50.00 
4. 612,75 FF 

Switch the language:
English
Deutsch 
---------snip output-----

See at the both first line in both output.

Did this example helps you?
Don't forget to restart the IC server after any change at the locale.txt
oder catalog.cfg files.

ciao

Joachim

-- 
-------------<BPA FreeBsd>----------------------------------------------
Hans-Joachim Leidinger          black point arts Internet Solutions GmbH
email: jojo@blackpoint.de       FAX  : +49 0209-398265
http://www.bpaserver.net