• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

multilingual in struts

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am working on multilingual web application in struts. normally struts takes browser's language to display messages from properties file.

I need to provide a list box which will have German and English options. If user select German from list, application should use German language properties file (application should not take language code from browser). If user select English, application should use English language properties file.

How will i make sure struts use user's selected language in list instead of browser language code. currently in my application it is using browser's language code.

Thank you for your help and time
Ajay
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The HttpResponse object has a method, 'setLocale(java.util.Locale loc)'.
If you pass the language selected in the HttpRequest, then call this method in the code that handles the request. Struts code should then use this Locale and the appropriate properties file to render the HTML code using the selected language.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The org.apache.struts.action.Action class (your action's superclass) has a setLocale method. Use it to set the locale according to the parameter passed in from the JSP.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic