This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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%
 
 
subject: get locale
 
Similar Threads
How to get user locale
WEbSphere Portal Server 6.0 - Locale Problem.
displaytag - i18n
locale setting through code
Does someone has the same problem like me ?