Hi everybody, I have a problem with cookie stored locales, switched by the user with T5.3.6. The code snippets are below, commented.
Tapestry loads the LocaleRequestFilter and invokes the service method on each request. I get the correct language value out of the cookie. The problem is, that this value isn't stored correctly (as I assume). The line is "localizationSetter.setLocaleFromLocaleName(preferredLanguage.toString());". During the page and component rendering, Tapestry uses always the English l10n. The default is German (TestComponent.properties => de, TestComponent_en.properties => en). Does anyone know where the problem could be? Any help is appreciated :-) René I've tried the following: AppModule.java: public static void contributeApplicationDefaults(MappedConfiguration<String, Object> configuration) { configuration.add(SymbolConstants.ENCODE_LOCALE_INTO_PATH, false);[...] // I don't want the language code in the address => to cookie configuration.add(SymbolConstants.SUPPORTED_LOCALES, "de,en"); } public static void bind(ServiceBinder binder) { binder.bind(TimingFilter.class).withId("TimingFilter"); binder.bind(LocaleRequestFilter.class).withId("LocaleRequestFilter");[...] } public void contributeRequestHandler( OrderedConfiguration<RequestFilter> configuration, final Logger logger, final RequestGlobals requestGlobals, final Cookies cookies, final LocalizationSetter localizationSetter, @InjectService("TimingFilter") RequestFilter timingFilter, @InjectService("LocaleRequestFilter") RequestFilter localeRequestFilter) { configuration.add("TimingFilter", new TimingFilter(logger)); configuration.add("LocaleRequestFilter", new LocaleRequestFilter(requestGlobals, cookies, localizationSetter), "after:*"); // This is the RequestFilter for the locales. } In the ...webapp.services.LocaleRequestFilter.java: public class LocaleRequestFilter implements RequestFilter { private RequestGlobals requestGlobals; private Cookies cookies; private LocalizationSetter localizationSetter; public LocaleRequestFilter(RequestGlobals requestGlobals, Cookies cookies, LocalizationSetter localizationSetter) { this.requestGlobals = requestGlobals; this.cookies = cookies; this.localizationSetter = localizationSetter; } @Override public boolean service(Request request, Response response, RequestHandler handler) throws IOException { TranslatedLanguage preferredLanguage = null; // is an enum // Here comes some code to read the HTTP header and the cookie to decide, what to do. // This method is invoked and reads _the_correct_ cookie value. System.out.println("set language : " + preferredLanguage.toString()); localizationSetter.setLocaleFromLocaleName(preferredLanguage.toString()); // Here could be the problem, because the preferred value isn't stored. return handler.service(request, response); } } In the component, where I change the cookie value: private void onActionFromLanguageMenu() { cookies.writeCookieValue(PlainTraySetting.COOKIE_LANGUAGE_VALUE_NAME, selectedLanguage.toString()); // I just write the selected language to the cookie. That works perfectly. } --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org