thanks, Igor. your advice is exactly what I was looking for. I tested all is working with correct locale. hopefully when I start using ajax stuff this will still be true (believe it will).
igor.vaynberg wrote: > > subclass webrequestcycle and add this code into onbeginrequest() > > Locale locale = getRequest().getLocale(); > locale = doSomething( locale ); // e.g. substituting non-supported > locale > getSession().setLocale( locale ); > > see webapplication.newrequestcycle() > > -igor > > > > On Feb 1, 2008 9:21 AM, iwanj <[EMAIL PROTECTED]> wrote: >> >> the post I read was about setting locale upon new session. just for >> background, the scenario >> is displaying certain information/paragraph on different languages. I >> could >> set up the locale >> button however myh preference is not to have too long a list of supported >> locale, certain users >> might only use 2-3 locales, but overal could be many. also, my >> preference >> is not to maintain >> too many different sets of html pages (locale-wise, so same reason with >> button). on the project >> I had set up my own string resource loader, so that I only have one >> properties file per locale, instead >> of for every page/class. with my not-too-appealing method described in >> original post, a user could >> simply switch the browser locale and hit refresh button (or other buttons >> on >> the page, example: page >> is in english, user enter 優しい時間 in japanese, switch browser language to >> japanese, and hit "Find" button) and the page will be >> displayed/redisplayed >> using the new locale, what I'm looking is for way to avoid putting the >> same >> code on various component's event handler codes. thanks for the >> suggestion, >> though. >> >> >> >> Nino.Martinez wrote: >> > >> > Hmm, I though this was done already... Or might only be upon initiation >> > of session? >> > >> > What would be the motivation for the user changing locale mid session? >> > Otherwise i'd suggest having a button changing sessions locale.. This >> > has worked for me in the past... Although you might want to use >> > stringressource models.. I remember some issue but that was in beta4... >> > >> > iwanj wrote: >> >> this is my second day using wicket from struts/springmvc and I need >> >> wicket to >> >> set up so that every request (maybe this is an old thinking?) must >> follow >> >> the browser's locale. for pages, I could easily enough to have a base >> >> page >> >> and in its contructor do the following: >> >> >> >> Locale locale = getRequest().getLocale(); >> >> locale = doSomething( locale ); // e.g. substituting >> non-supported >> >> locale >> >> getSession().setLocale( locale ); >> >> >> >> and this works fine. however, for button's onSubmit() wicket uses the >> >> existing page instead of creating a new one and so my code in the base >> >> page >> >> constructor's is not run. copying my code into every handler is one >> >> option. >> >> subclassing all such components is another. neither seems >> particularly >> >> appealing for me. >> >> >> >> I've looked at replacing standard classes (session, etc.) or >> overriding >> >> some >> >> WebApplication methods, even subsclassing the WicketFilter itself, but >> I >> >> still couldn't find a place where I have both the session & request >> >> objects >> >> to do the locale setting. being newbie, I probably missed reading >> some >> >> docs >> >> somewhere or some posts in this forum (searched "locale", "request", >> >> etc.) >> >> >> >> thanks for any help enlightening me on this hurdle. >> >> >> >> iwanj >> >> >> > >> > -- >> > Nino Martinez Wael >> > Java Specialist @ Jayway DK >> > http://www.jayway.dk >> > +45 2936 7684 >> > >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/setting-session-locale-to-browser-locale-on-onSubmit%28%29-tp15229868p15231373.html >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/setting-session-locale-to-browser-locale-on-onSubmit%28%29-tp15229868p15231837.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
