Coming from a multilingual country, I had to do the same thing often. It's
completely ok, I think. Only, I slightly prefer having a method in my page
class over ognl like this:
public String getPageTitle() {
return getPage().getTitle( getLocale() );
}
But your ognl seems ok to me, Do you have any problems with it?
> -----Original Message-----
> From: Greg Cormier [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 02, 2006 5:09 PM
> To: Tapestry users
> Subject: RE: Setting an OGNL variable
>
>
> Right, but *only* if I knew the value of the title in
> advance, and put it in my properties file at build time.
>
> -----Original Message-----
> From: James Carman [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 02, 2006 11:04 AM
> To: 'Tapestry users'
> Subject: RE: Setting an OGNL variable
>
>
> It's *currently* unable, but just as you're setting the "englishTitle"
> property, you could set its titleKey property, no?
>
> -----Original Message-----
> From: Greg Cormier [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 02, 2006 11:01 AM
> To: Tapestry users
> Subject: RE: Setting an OGNL variable
>
> I'd like to, but I still fail to see how that is possible.
>
> {
> PageObject aPage = new PageObject();
> aPage.setEnglishTitle("Some weird title that's not in a
> properties file");
> }
>
> aPage is unable to return any key that would contain that string in a
> resource bundle.
>
>
> Greg
>
>
> -----Original Message-----
> From: James Carman [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 02, 2006 10:58 AM
> To: 'Tapestry users'
> Subject: RE: Setting an OGNL variable
>
>
> You could do that, but I would recommend using Tapestry's
> i18n support.
>
> -----Original Message-----
> From: Greg Cormier [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 02, 2006 10:54 AM
> To: Tapestry users
> Subject: RE: Setting an OGNL variable
>
> Because PageObject definately has an englishName and frenchName.
>
> So I can always call getEnglishName() and getFrenchName().
>
> The value of those is a String, but the actual value is unknown.
>
> Right now, I'll use an If statement. So If the locale is
> English, I'll do 3
> more if statements and use @Insert's with
> "ognl:aPage.englishName". Then the
> next If, I'll check if the locale is French, and then have
> the 3 more if
> statements using inserts with "ognl:aPage.frenchName".
>
> Hmm, would it be possible to pass the locale in that ognl expression?
> Something like
>
> <span jwcid="@Insert" value="ognl:aPage.title(getLocale())" />
>
>
> Greg
>
>
> -----Original Message-----
> From: James Carman [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 02, 2006 10:08 AM
> To: 'Tapestry users'
> Subject: RE: Setting an OGNL variable
>
>
> Greg,
>
> How are you going to "localize" them, then? What are you
> going to use to
> look up their names based on the Locale?
>
> James
>
> -----Original Message-----
> From: Greg Cormier [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 02, 2006 10:03 AM
> To: Tapestry users
> Subject: RE: Setting an OGNL variable
>
> The names are dynamic at runtime, so they might not have
> message keys. :(
>
> Greg
>
> -----Original Message-----
> From: James Carman [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 02, 2006 9:27 AM
> To: 'Tapestry users'
> Subject: RE: Setting an OGNL variable
>
>
> Instead of having the PageObject return you its name, why not
> have it return
> you it's message key, so you can look up its name?
>
> -----Original Message-----
> From: Greg Cormier [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 02, 2006 9:25 AM
> To: Tapestry users
> Subject: RE: Setting an OGNL variable
>
> I would but I don't see how.
>
> aPage is a POJO (a class PageObject)
>
> Ideally, PageObject would have
>
> String getName()
> {
> if (getLocale() == ...)
> return getNameA();
> else if (...)
> return getNameB();
> }
>
>
> However, it has no access to the engine or pages locale.
>
> I'm open to suggestions. I thought of putting a constructor
> in PageObject to
> pass in the locale, but the thing is, it's created once,
> regardless of the
> language. Having it created for each language would be useless.
>
> So, I need a way to get this POJO to be able to access the
> engine's locale
> somehow, or, I need to work around it myself.
>
>
> Greg
>
> -----Original Message-----
> From: James Carman [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 02, 2006 9:19 AM
> To: 'Tapestry users'
> Subject: RE: Setting an OGNL variable
>
>
> Sounds a bit convoluted to me. Why can't you use Tapestry's
> i18n support?
>
> -----Original Message-----
> From: Greg Cormier [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 02, 2006 9:14 AM
> To: Tapestry users
> Subject: Setting an OGNL variable
>
> Is there a way to set a variable using OGNL? Here's my situation. I'm
> looping over a collection, and I use a property a lot.
> Depending on certain
> conditions I output it in different ways. This is a block of
> code from my
> header HTML file :
>
> <span jwcid="@If" condition="ognl:normalItem">
> <li><a jwcid="@PageLink" page="ognl:aPage.title"><span
> jwcid="@Insert"
> value="ognl:aPage.englishName" /></a>
> </span>
>
> <span jwcid="@If" condition="ognl:selectedItem">
> <li class="clsItemSelected"><span jwcid="@Insert"
> value="ognl:aPage.englishName" />
> </span>
>
> <span jwcid="@If" condition="ognl:aPage.noLink">
> <li class="normal"><span jwcid="@Insert"
> value="ognl:aPage.englishName" />
> </span>
>
>
>
> Now I want to add some i18n to this. So instead of using
> englishName, I
> might use frenchName. This aPage is a POJO, so I can't just
> call a getName()
> and have it call getLocale() or anything. So, what I want to
> do, in Pseudo
> code :
>
> ---
> if (languageA)
> pageName = aPage.languageA;
> if (languageB)
> pageName = aPage.languageB;
> if (languageC)
> pageName = aPage.languageC;
>
> <insert 3 spans from above, using value="ognl:pageName">
> ---
>
>
>
> This might be a little confusing but hopefully someone is
> able to follow
> this :)
>
> Thanks,
> Greg
>
> ---------------------------------------------------------------------
> 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]
>
> ---------------------------------------------------------------------
> 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]
>
> ---------------------------------------------------------------------
> 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]
>
> ---------------------------------------------------------------------
> 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]
>
> ---------------------------------------------------------------------
> 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]
>
> ---------------------------------------------------------------------
> 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]