Hi Rams, I'm quite confused about this code. I copied this to my DirectAction class but it didn't work. In my project, I have English.lproj, zh_TW.lproj, zh_CN.lproj. I have my Properies file setup with:
er.extensions.ERXLocalizer.defaultLanguage=English er.extensions.ERXLocalizer.fileNamesToWatch=("Localizable.strings","ValidationTemplate.strings") er.extensions.ERXLocalizer.availableLanguages=(English, zh_TW, zh_CN) er.extensions.ERXLocalizer.frameworkSearchPath=(app,ERDirectToWeb,ERExtensions) My system/browser is English. Default language is English. I print out context().request().browserLanguages(), which is exactly English. But at the top of my action, I print out session().languages() and got zh_TW (Traditional Chinese) localizer. Why the localizer change its language after the performActionNamed() but before myAction actually being called? My guess is, setup the current localizer not necessary change the localizer of sessions. Any idea on how to make the code actually work? Regards, yllan On Fri, Jun 13, 2008 at 7:46 AM, Rams <[EMAIL PROTECTED]> wrote: > --Direct Actions-- > > If you're using direct actions, you can stick this in your direct action > class: > > @Override > public WOActionResults performActionNamed(String actionName) { > if(!context().hasSession()) { > ERXLocalizer localizer = > > ERXLocalizer.localizerForLanguages(context().request().browserLanguages()); > ERXLocalizer.setCurrentLocalizer(localizer); > } > return super.performActionNamed(actionName); > } > > That will give the user their browser's default language instead of your > server's default language if there is no session and their language is > available. If you aren't defaulting to direct actions though, a session is > going to be created, that will happen anyway, and this will be superfluous. > _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]