This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Struts and the fly likes multilingual in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "multilingual in struts" Watch "multilingual in struts" New topic
Author

multilingual in struts

Ajay Tickle
Greenhorn

Joined: Mar 16, 2008
Posts: 17
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
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
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.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: multilingual in struts