On Sunday 01 February 2009 11:11:33 Ignacio de Córdoba wrote: > Hi there, > I've been searching through struts2 docs and old threads here but I've > found no way of changing current locale from inside an action. I know I can > pass a parameter in the request, and maybe other ways to change it... but I > am looking for a method that allows me to change current locale from inside > the action. > I used to do setLocale(...) but that method doesn't seem to be implemented > in ActionSupport. >
Locale manipulation is done in the I18nInterceptor. It does two things, watches for the request_locale parameter, and sets the locale on the action and in the session if it has changed. To change it from within the action, you would change it on the ActionContext... However, that will only change it for the duration of the current request. To change it for future requests, you have to change the locale object on the session as well. Take a look at the docs here - http://struts.apache.org/2.x/docs/i18n-interceptor.html As well as the source here - http://svn.opensymphony.com/fisheye/browse/xwork/trunk/src/java/com/opensymphony/xwork2/interceptor/I18nInterceptor.java?r=1833 -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org