You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stephan Windmüller <st...@cs.tu-dortmund.de> on 2009/10/20 09:53:43 UTC
Changing a locale during a request
Hello!
Is it possible to change the use locale during the current request? I
tried PersistentLocale, ThreadLocale and LocalizationSetter in a
RequestFilter, but none of them only has an effect on current page. When
the page is loaded and I click on a link, the locale is correctly set.
- Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Changing a locale during a request
Posted by Stephan Windmüller <st...@cs.tu-dortmund.de>.
On Tue, 20. Oct 2009, cordenier christophe wrote:
> I think the locale present in URL is decoded in the Dispatcher (after
> RequestFilter) Try to change the local in a PageRenderRequestFilter.
Thanks for the suggestion, it worked!
Here is my code of AppModule for everyone who wants to know how it
works:
public PageRenderRequestFilter buildLocaleFilter(final RequestGlobals globals, final LocalizationSetter localizationSetter) {
return new PageRenderRequestFilter() {
public void handle(PageRenderRequestParameters parameters,
PageRenderRequestHandler handler) throws IOException {
String preferredLanguage = <your code>;
localizationSetter.setLocaleFromLocaleName(preferredLanguage);
handler.handle(parameters);
}
};
}
public void contributePageRenderRequestHandler(OrderedConfiguration<PageRenderRequestFilter> configuration,
@Local
PageRenderRequestFilter localeFilter) {
configuration.add("localeFilter", localeFilter, "after:*");
}
Thanks again!
Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Changing a locale during a request
Posted by cordenier christophe <ch...@gmail.com>.
Hello
I think the locale present in URL is decoded in the Dispatcher (after
RequestFilter) Try to change the local in a PageRenderRequestFilter.
Regards,
Christophe.
2009/10/20 Stephan Windmüller <st...@cs.tu-dortmund.de>
> Hello!
>
> Is it possible to change the use locale during the current request? I
> tried PersistentLocale, ThreadLocale and LocalizationSetter in a
> RequestFilter, but none of them only has an effect on current page. When
> the page is loaded and I click on a link, the locale is correctly set.
>
> - Stephan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>