• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

get locale

 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic