On Fri, 13 Apr 2001, Daniel Toms wrote:

> thanks.  I'm trying to figure out how to setup correctly for
> localizition, especially where you have cases like
> 
> Product Name
> 
> versus (excuse my spanish)
> 
> Nombre de Producto
> 
> thanks again,
> 
> dan
> 

You will want to check out the Javadocs for the java.text.MessageFormat
class for all the tricks you can play with parametric replacements.

Just as one simple example, assume you have a "user" bean in your session
that has a getFirstName() method.  You could say:

        <jsp:useBean id="user" scope="session"
         type="com.mycompany.MyUserBean"/>
        <bean:write key="hello.message"
         arg0="<%= user.getFirstName() %>"/>

In English, I might define the message in my properties file as:

        hello.message=Hello {0}!

but in French, it would be:

        hello.message=Bonjour {0}!

and I would get "Hello Craig!" or "Bonjour Craig!" depending on which
language I was using.

Craig McClanahan

Reply via email to