You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Muralidhar Y." <TC...@emirates.com> on 2005/09/28 12:29:37 UTC

RE: How to get the localization for the PropertySelection(not con vinced)

Hi anjali I am not convinced with your explanation. I don't know why eclipse
is showing as deprecated method and how you are using it . Even on tapestry
4 website  they recommend to use the getMessage() method. Have a look at the
following link.
http://jakarta.apache.org/tapestry/UsersGuide/localization.html

Pls don't say eclipse is showing so it is deprecated if you have any docs
saying that it is deprecated pls send them to me too.




Muralidhar Y
Software Engineer,
Adastrum technologies-Nikai groups,
EmiratesGroup-I.T Division,
Dubai, UAE.
Mobile : 00971-50-2256149.
http://www.adastrumtech.com
http://www.mercator.aero  
(Keep Smiling. Be happy All The Time.)

-----Original Message-----
From: Muralidhar Y. [mailto:TC02347@emirates.com] 
Sent: 28 September 2005 14:05
To: 'Tapestry users'
Subject: RE: How to get the localization for the PropertySelection

Ok thank you. We are having our own solutions for problems of tapestry3.0.3
so I don't work much with tapestry 4 and annotations. Ok what you said might
be true. 




Muralidhar Y
Software Engineer,
Adastrum technologies-Nikai groups,
EmiratesGroup-I.T Division,
Dubai, UAE.
Mobile : 00971-50-2256149.
http://www.adastrumtech.com
http://www.mercator.aero
(Keep Smiling. Be happy All The Time.)

-----Original Message-----
From: Anjali Abraham [mailto:anjalia@aztec.soft.net]
Sent: 28 September 2005 14:01
To: Tapestry users
Subject: RE: How to get the localization for the PropertySelection

Thanks Muralidhar for all the replies with which I could finish my
localization work. Thanks once again.
Well let me try to explain:
There is a method called getMessage(key), but that need to be used along
with getMessages.getMessage(Key). And getMessages returns ComponentMessage
object.
So like in tapestry3, in java if we use simply getMessage(key), eclipse
shows that it is deprecated. So we need to use in tapestry4 like this only,
getMessages.getMessage(Key).
And also in tapestry4, we can get the message in my .java file in this way,
like:

@Message
public abstract getName();

where in my .properties file I need to have:
name=Testing Name

Regards,
Anjali

-----Original Message-----
From: Muralidhar Y. [mailto:TC02347@emirates.com]
Sent: Wednesday, September 28, 2005 3:03 PM
To: 'Tapestry users'
Subject: RE: How to get the localization for the PropertySelection

Hello anjali,
               we are in development and suddenly we felt that we may use
depricated method as you said in tapestry 4 the getMessage() is being
depricated. But I don't think your statement is true. I had checked the
tapestry 4 docs and the following is from tapestry 4 doc. 
_____________________tapestry 4 doc_________________ Messages may contain
arguments, strings of the form {0} (or some other number). The argument are
handled exactly the same as with Java's MessageFormat class (in fact, under
the covers, MessageFormat does the work). 

Components include a messages property for accessing localized messages.
This property is of type Messages, and includes two methods: 

getMessage() takes a string parameter and returns a localized message
format() takes a string parameter (the key) and then takes a number of
additional parameters as arguments. The arguments are just objects. If you
have more than three arguments, then specify them as an object array. 
It is common to format messages using OGNL expessions, i.e.: 

<span jwcid="@Insert" value="ognl:messages.format('billing 

__________________________________     I hope you problem is solved and
happy.


Muralidhar Y
Software Engineer,
Adastrum technologies-Nikai groups,
EmiratesGroup-I.T Division,
Dubai, UAE.
Mobile : 00971-50-2256149.
http://www.adastrumtech.com
http://www.mercator.aero
(Keep Smiling. Be happy All The Time.)

-----Original Message-----
From: Anjali Abraham [mailto:anjalia@aztec.soft.net]
Sent: 28 September 2005 10:25
To: Tapestry users
Subject: RE: How to get the localization for the PropertySelection

Hi Muralidhar,
	Well I have understood your explanation. Thanks for explanating so
well.
	As I am using Tapestry4.0beta4.0 version, and in that
getMessage("Key") is being deprecated.... and also I am extending my java
class from BasePage.
So how do I go about it....????
Please respond with solution,
Thanks in advance,
	

Regards,
Anjali

-----Original Message-----
From: Muralidhar Y. [mailto:TC02347@emirates.com]
Sent: Wednesday, September 28, 2005 9:07 AM
To: 'Tapestry users'
Subject: RE: How to get the localization for the PropertySelection

 hi anjali ,            

 coming to you problem: 
                  first in your .page file you had  a "model" parameter
associated with "timeZones" and in your java code it returns
"StringPropertySelectionModel" which implements "IPropertySelectionModel" .
But the thing you want to do is instead of returning hardcoded strings you
want to use .properties file.  
         Here is the way :- 

We assume the following keys are in the .properties file
    key1=Pacific Standard Time
    key2=Central Standard Time

Do this in your java code:-
 
public IPropertySelectionModel getTimeZones() {
      String a=getMessage(key1) ;
      String b=getMessage(key2) ;
   return new StringPropertySelectionModel(new String[] { a, b});          
}

I hope it is clear now.....


Muralidhar Y
Software Engineer,
Adastrum technologies-Nikai groups,
EmiratesGroup-I.T Division,
Dubai, UAE.
Mobile : 00971-50-2256149.
http://www.adastrumtech.com
http://www.mercator.aero
(Keep Smiling. Be happy All The Time.)

-----Original Message-----
From: Anjali Abraham [mailto:anjalia@aztec.soft.net]
Sent: 27 September 2005 18:11
To: tapestry-user@jakarta.apache.org
Subject: How to get the localization for the PropertySelection

Hi,
            Another question on localization.....
Well, I have in my html wherein I have a drop down, and that is being
implemented using PropertySelection.
 
How do I get the data's in my drop down in a localization using
Tapestry4???????
 
My html content is:
<tr>
   <th class="text"><span jwcid="@FieldLabel"
field="ognl:components.timeZone" displayName="message:timeZone"/></th>
      <td><select jwcid="timeZone"> </select></td> </tr>
 
My .page content:
<component id="timeZone" type="PropertySelection"> <binding name="model"
value="timeZones"/> <binding name="value" value="timeZone"/>
            <binding name="displayName" value="message:timeZone"/>
</component>
 
My .Java code for the same is:
public IPropertySelectionModel getTimeZones() { return new
StringPropertySelectionModel(new String[] { "Pacific Standard Time",
"Mountain Standard Time", "Central Standard Time", "Eastern Standard
Time","Greenwich Mean Time"});  }
 
I know that I need to specify these values mentioned in  this
StringPropertySelectionModel method need to be moved to my .properties
files... but how do I need to access these from my .properties file and
display that in my .html files.
 
Please respnd with solutions,
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

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