You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Howard Lewis Ship <hl...@gmail.com> on 2005/09/29 00:46:55 UTC

Re: How to use Localization through java in tapestry4

Nifty thing about annotations is that when you have just a single
attribute named "value", you can omit the "value=" part, thus:

@Message("key")
public abstract String messageForKey();

Note that it is @Message not @InjectMessage

Also note that @Message tries to be smart about mapping the method
name to a key, so all the following will return the same string:

@Message("message-for-key")
public abstract String messageForKey();

@Message
public abstract String messageForKey();

@Message
public abstract String getMessageForKey();



On 9/28/05, Adam Greene <ag...@iq-2000.com> wrote:
> @InjectMessage(value="key")
> public abstract String getKeyValue();
>
> if you do this:
>
> @InjectMessage(value="key")
> public abstract String getKeyValue(String param1, int param2);
>
> it will use MessageFormat and the params as the replacement values.
>
> ----- Original Message -----
> From: "Anjali Abraham" <an...@aztec.soft.net>
> To: <ta...@jakarta.apache.org>
> Sent: Wednesday, September 28, 2005 3:55 AM
> Subject: How to use Localization through java in tapestry4
>
>
> > Hi All,
> >            I need help on how access my Message key values from my
> > .properties file in my java file and display those values in my drop down
> > box which is being implemented using PropertySelection.
> > I use Tapestry4beta4 version.
> > I think I Tapestry3, we have something like getMessage(Key) method, but
> > that
> > is being deprecated in Tapestry4 and something like @Message annotation
> > need
> > to be used.
> > So please someone can explain me what codes need to be added in my java
> > file
> > as well as in my .page file.
> >
> > Please respond with solution,
> > Thanks in advance,
> >
> > Regards,
> > Anjali
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: How to use Localization through java in tapestry4

Posted by Adam Greene <ag...@iq-2000.com>.
Thanks Howard.  After sending it I wondered if I had got the name right...

----- Original Message ----- 
From: "Howard Lewis Ship" <hl...@gmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, September 28, 2005 7:46 PM
Subject: Re: How to use Localization through java in tapestry4


Nifty thing about annotations is that when you have just a single
attribute named "value", you can omit the "value=" part, thus:

@Message("key")
public abstract String messageForKey();

Note that it is @Message not @InjectMessage

Also note that @Message tries to be smart about mapping the method
name to a key, so all the following will return the same string:

@Message("message-for-key")
public abstract String messageForKey();

@Message
public abstract String messageForKey();

@Message
public abstract String getMessageForKey();



On 9/28/05, Adam Greene <ag...@iq-2000.com> wrote:
> @InjectMessage(value="key")
> public abstract String getKeyValue();
>
> if you do this:
>
> @InjectMessage(value="key")
> public abstract String getKeyValue(String param1, int param2);
>
> it will use MessageFormat and the params as the replacement values.
>
> ----- Original Message -----
> From: "Anjali Abraham" <an...@aztec.soft.net>
> To: <ta...@jakarta.apache.org>
> Sent: Wednesday, September 28, 2005 3:55 AM
> Subject: How to use Localization through java in tapestry4
>
>
> > Hi All,
> >            I need help on how access my Message key values from my
> > .properties file in my java file and display those values in my drop 
> > down
> > box which is being implemented using PropertySelection.
> > I use Tapestry4beta4 version.
> > I think I Tapestry3, we have something like getMessage(Key) method, but
> > that
> > is being deprecated in Tapestry4 and something like @Message annotation
> > need
> > to be used.
> > So please someone can explain me what codes need to be added in my java
> > file
> > as well as in my .page file.
> >
> > Please respond with solution,
> > Thanks in advance,
> >
> > Regards,
> > Anjali
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org