You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Daniel Lipofsky <da...@bricsnet.com> on 2005/04/19 22:47:01 UTC

i18n best practices

I am wondering about best practices in struts for
internationalization of dates and numbers.  Formatting
is not too hard, but parsing and validation is trickier.
We must simultaneously handle different formats for
different users, so any validation or parsing has to
take into account the user's locale.

Date formats include mm/dd/yyyy and dd/mm/yyyy.
Number formats include 12,345.6 and 12.345,6
(these are US and German respectively).

Also, for some things, like money, we want to enforce
a fixed number of decimal places while other numbers
should display however many decimal places they have.
Some numbers are internal-use integers (always hidden)
that should not be formatted.

Examples or tutorials would be very appreciated.

Thanks,
Dan


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


Re: i18n best practices

Posted by Hubert Rabago <hr...@gmail.com>.
I haven't tried it yet, but Validator has support for
internationalization.  Also, you can take a look at the i18n support
in FormDef, which can help you in both formatting and parsing.  One of
the sample apps demonstrate this by allowing EN, DE, and IT formats in
its form (which has both dates and numbers).

Doing a google search on "struts i18n" showed me a couple of tutorials
on Struts i18n.  If you find a resource that you find helpful, do
share with the list, or better yet, mention it in the wiki
(http://wiki.apache.org/struts/).

Hubert

On 4/19/05, Daniel Lipofsky <da...@bricsnet.com> wrote:
> I am wondering about best practices in struts for
> internationalization of dates and numbers.  Formatting
> is not too hard, but parsing and validation is trickier.
> We must simultaneously handle different formats for
> different users, so any validation or parsing has to
> take into account the user's locale.
> 
> Date formats include mm/dd/yyyy and dd/mm/yyyy.
> Number formats include 12,345.6 and 12.345,6
> (these are US and German respectively).
> 
> Also, for some things, like money, we want to enforce
> a fixed number of decimal places while other numbers
> should display however many decimal places they have.
> Some numbers are internal-use integers (always hidden)
> that should not be formatted.
> 
> Examples or tutorials would be very appreciated.
> 
> Thanks,
> Dan
>

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