Hi!

The code below is not PROD ready yet. The first section is to setup input
fields with label inside them.
Something that our "designers" seems slick!

The state locale is used it to remember the locale when called from a flash
menu
that "discarded" the persistent locale. The flash menu is feeded with
special pages
that resets the persitent locale ... and redirects to the actial page.

Shit this seems messy ...

Thanks for the help anyway!

/Gunnar

  @SetupRender
    void setupComponent()
    {
        if (!userExists) {
            username = messages.get("username");
            password = messages.get("password");
        } else {
            username = user.getUsername();
            password = messages.get("password");
        }

        language = currentLocale.getLanguage();

        log.debug(LOGPRE + "1:
TellLayout.setupComponent(currentLocale.language=" + language + ")");
        if ((null == state.getLocale()) && (language != null)) {
            state.setLocale(new Locale(language));
            log.debug(LOGPRE + "2: TellLayout.setupComponent(state.locale
initiated to " + state.getLocale() + ")");
        }

        if (!persistentLocale.isSet()) {
            persistentLocale.set(state.getLocale());
            log.debug(LOGPRE + "3:
TellLayout.setupComponent(persistentLocale.set(" + persistentLocale.get() +
")");
        } else {
            log.debug(LOGPRE + "4:
TellLayout.setupComponent(persistentLocale=" + persistentLocale.get() +
")");
        }

        // -- Localize account menu texts. --
        createAccountMenu();
    }


2009/10/30 cordenier christophe <christophe.corden...@gmail.com>

> To what corresponds exactly this logs in your rendering scenario ?
>
> [DEBUG] components.TellLayout <<< --- TELLGAMING --- >>>: 1:
> TellLayout.setupComponent(
> currentLocale.language=sv)
> [DEBUG] components.TellLayout <<< --- TELLGAMING --- >>>: 4:
> TellLayout.setupComponent(persistentLocale=en)
>
>
> 2009/10/30 cordenier christophe <christophe.corden...@gmail.com>
>
> > Sorry i have missed
> >
> > [DEBUG] AppModule.
> > ProtectedPageGateKeeper PPGK.path=/en/tellfriends
> >
> >
> > 2009/10/30 Gunnar Eketrapp <gunnar.eketr...@gmail.com>
> >
> >> Hi!
> >>
> >> Well I have read that page over and over ...
> >>
> >> I am calling persistentLocale.set() in the action link connected to my
> >> language selector.
> >>
> >> But for some reasons the persistentLocale is not used when rendering
> ....
> >>
> >> The page below is rendered in swedish even if the persistentLocale is
> >> english.
> >>
> >> [DEBUG] AppModule.ProtectedPageGateKeeper PPGK.path=/en/tellfriends
> >> [DEBUG] components.TellLayout <<< --- TELLGAMING --- >>>: 1:
> >> TellLayout.setupComponent(currentLocale.language=sv)
> >> [DEBUG] components.TellLayout <<< --- TELLGAMING --- >>>: 4:
> >> TellLayout.setupComponent(persistentLocale=en)
> >>
> >>
> >> To this I have ...
> >>
> >> TellFriends_en.properties
> >> TellFriends_sv.properties
> >>
> >> ... and "sv" is the default language.
> >>
> >> /Gunnar
> >>
> >> 2009/10/30 cordenier christophe <christophe.corden...@gmail.com>
> >>
> >> > Hi
> >> >
> >> > Have a look at 'Changing the Locale' here
> >> > http://tapestry.apache.org/tapestry5.1/guide/localization.html
> >> > to check if your are using the good scenario to change locale, since
> >> > Tapestry 5.1 uses URL to store Local and not a cookie (like in 5.0.18)
> >> >
> >> > Christophe.
> >> >
> >> > 2009/10/30 Gunnar Eketrapp <gunnar.eketr...@gmail.com>
> >> >
> >> > > Hi!
> >> > >
> >> > > For some reason my pages are rendered accoring to currentLocale and
> >> not
> >> > > persistentLocale.
> >> > >
> >> > > Is there something I should now?
> >> > >
> >> > > Thanks in advance,
> >> > > Gunnar Eketrapp
> >> > >
> >> >
> >>
> >>
> >>
> >> --
> >> [Hem: 08-715 59 57, Mobil: 0708-52 62 90]
> >> Allévägen 2A, 132 42 Saltsjö-Boo
> >>
> >
> >
>



-- 
[Hem: 08-715 59 57, Mobil: 0708-52 62 90]
Allévägen 2A, 132 42 Saltsjö-Boo

Reply via email to