tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nimish <nimis...@yahoo.com>
Subject Re: Internationalization Help
Date Thu, 26 Feb 2004 17:28:14 GMT
> All,
> 
> I am sure Tomcat can be internationalized to accept
> internationalized
> character encoding, but the trouble is I do not know
> HOW?
> 
> Could someone point me to a quick HOW-TO guide?
> 
> BTW I am planning to use 4.1.30 (or later version)
> for this purpose. 
> 
> Any help very much appreciated.
> 
> Regards,
> 
> Santosh
> 

You need to use ResourceBundle with properties files
that are specific to various locales. Keep your
default locale strings in a file named something like
<app_name>.properties in the WEB-INF/classes directory
of your application in Tomcat's webapps. You can also
keep other locale files in
<app_name>_<locale>.properties. [For example,
<app_name>_de.properties for German strings,
<app_name>_fr.properties for French strings, etc.] 

Then you can load the strings using 

ResourceBundle rb =
ResourceBundle.getBundle("<app-name>",
request.getLocale());

That will pick the correct properties file depending
on your browser locale. (This can be changed by
changing the Language preferences in Browser, for
testing.)

The required string can be retrived in a JSP or
Servlet using rb.getString("<property_name>");

- Nimish


__________________________________
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools

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


Mime
View raw message