You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Thielen <da...@windward.net> on 2003/08/08 16:08:14 UTC

I18N - Currency question

Hi;

I am displaying currency in my website. It is always in U.S. dollars so I am doing:
    NumberFormat.getCurrencyInstance().format( (float) price / 100f );

Two questions:
  1.. I assume I should set the locale for this to en_US since I want to have the dollar sign.
  2.. Should it do the commas and periods to the user's locale - or is everyone used to dollars using the US comma/period setup.
thanks - dave

Re: I18N - Currency question

Posted by David Geary <sa...@earthlink.net>.
On Friday, August 8, 2003, at 08:08 AM, David Thielen wrote:

> Hi;
>
> I am displaying currency in my website. It is always in U.S. dollars 
> so I am doing:
>     NumberFormat.getCurrencyInstance().format( (float) price / 100f );
>
> Two questions:
>   1.. I assume I should set the locale for this to en_US since I want 
> to have the dollar sign.

If your website supports only US English, or if that's the default, 
then sure.

>   2.. Should it do the commas and periods to the user's locale - or is 
> everyone used to dollars using the US comma/period setup.

If you're supporting other locales, I'd format accordingly. If I was 
selling something, I'd be as accommodating as possible. 8-)

If you're using JSP for presentation, I recommend the JSTL i18n and 
formatting tags instead of Java code.


david

> thanks - dave


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org