• 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

Urgent: How to set fixed locale for all user's request?

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi every body,
How can we set a fixed locale for the whole struts application so that Struts does not determine user's locale from the request?. My application does not serve users from multiple countries at once but I need a portable application that can be easily re-deployed to serve users from another country by just configuring the locale parameter in the properties file.
Many thanks
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why don't you just deliver the default property file ? then all users get the same language shown. If you want to provide more languages then add new localized property files.
Why do you want to set the locale in a property file ? Just offer a default language and nothing else.
 
giang nguyen
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Oliver Refle:
Why don't you just deliver the default property file ? then all users get the same language shown. If you want to provide more languages then add new localized property files.
Why do you want to set the locale in a property file ? Just offer a default language and nothing else.


Thanks Oliver,
But I want to have all application resource files at once and do not have to replace/delete application resource file when the application is re-deployed to serve another country. Specifying which country/language is active is done at deployment time by a single parameter. That's much simpler.
I am thinking of setting all requests's locale to a fixed value at the preProcess method of the ActionServlet.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what you then can do is to set manually the locale setting for struts in the user session, when the session starts. This can be done with the key:
Action.LOCALE_KEY
you maybe can check out http://jakarta.apache.org/struts/api/org/apache/struts/util/package-summary.html#package_description, maybe helps.
Olli
 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
true, you can set it in the session.
But you may want to enforce it each request.
E.g. with overwriting the requestprocessor which is in the struts-config.xml. Create your own and overwrite the method
processPreprocess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
in your own class.
its just another way of doing it
 
reply
    Bookmark Topic Watch Topic
  • New Topic