aspose file tools*
The moose likes Servlets and the fly likes get locale Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "get locale" Watch "get locale" New topic
Author

get locale

Anthony Karta
Ranch Hand

Joined: Aug 09, 2004
Posts: 342
is it possible to get locale setting from user computer or HTTP header?

what we want to do is format the date and currency based on locale setting in user computer? is it easier we implement in Servlet or JSP?

and next thing is, we would like to display HTML text based on user language, say if someone in Japan browse our website, we show it in Japanese. what we should do to implement this?

many Thanks in advance
Tony


SCJP 5
Susanta Chatterjee
Ranch Hand

Joined: Aug 12, 2002
Posts: 102
First, please read this.

I did a google search with the words "servlet jsp internationalization" and came up with quite a few good pages. Click here
Hussam Bamatraf
Greenhorn

Joined: Aug 25, 2003
Posts: 14
You can get the the language preferred by an HTTP client by parsing the Accept-Language header of HTTP protocol. Example of this header:
Accept-Language: en-US; q=1.0, en;q=0.5
This header indicates that the user prefers American English (quality 1.0) but will take any form of English as an alternative (qualiity 0.5).
You can write a servlet to do internatinalization and direct user to a page according to their langauge preference.


SCJP 90%<br />FileNet Certified Professional: Content Management Developer 92%<br />FileNet Certified Professional: Business Process Management Developer 92%
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: get locale
 
Similar Threads
How to get user locale
Does someone has the same problem like me ?
displaytag - i18n
locale setting through code
WEbSphere Portal Server 6.0 - Locale Problem.