You can extend the class DefaultLocalePicker and add your implementation in
the stripes configuration.
Example :
public class MyLocalePicker *extends DefaultLocalePicker* {
* @Override*
public Locale pickLocale(HttpServletRequest request) {
String value = request.getParameter("XXX");
// do something with your parameter value
// build a Locale
Locale locale = ...;
return locale;
}
}
<filter>
<display-name>Stripes Filter</display-name>
<filter-name>StripesFilter</filter-name>
<filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
* <init-param>
<param-name>LocalePicker.Class</param-name>
<param-value>org.truc.muche.MyLocalePicker</param-value>
</init-param>
*
</filter>
Hope this help !
Cheers,
Simon
2009/9/1 Gerald Fiesser <[email protected]>
> Stripes is very intelligent setting the locale based on information in the
> request or the local configuration.
> I need to do something different. My app gets the locale as a parameter, so
> I need to be able to switch between languages programmatically.
>
> So far, the only way I see this can be done in Stripes is overriding
> StripesFilter and providing my own doFilter() method to set my own locale.
>
> Are there better ways to do this? I'm using 1.5.1.
>
> - Gerald
>
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users