• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Localization Help! (was Localizer Default vs. Browser)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Localization Help! (was Localizer Default vs. Browser)


  • Subject: Re: Localization Help! (was Localizer Default vs. Browser)
  • From: "Yung-Luen Lan" <email@hidden>
  • Date: Sun, 20 Jul 2008 11:16:27 +0800

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@hidden> 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      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Localization Help! (was Localizer Default vs. Browser)
      • From: Rams <email@hidden>
  • Prev by Date: Re: application does not start after migration to eclipse
  • Next by Date: Re: Any thoughts on this deployment error?
  • Previous by thread: Re: Any thoughts on this deployment error?
  • Next by thread: Re: Localization Help! (was Localizer Default vs. Browser)
  • Index(es):
    • Date
    • Thread