You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Salamon Zsolt <sa...@gmail.com> on 2007/12/10 19:17:59 UTC
using properties file from java source in tapestry 5
Hello!
I have a component class, and a properties file with it.
We call now ExamComponent.java and ExamComponent.properties.
And I have an ExamPage.java.
Now I use the ExamComponent.properties file this way in ExamPage.java:
@Component
private ExamComponent examComponent;
ResourceBundle rbLocale = java.util.ResourceBundle.getBundle
(examComponent.getClass().getName());
String neededPropertyValue = rbLocale.getString("property-name")
I got an idea, which says I can use the ExamComponent.properties file
if I inject a Messages object. It will be the message catalog for the
component.
I don't use any Messages object before.
Anyone give me an example for this?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: using properties file from java source in tapestry 5
Posted by Salamon Zsolt <sa...@gmail.com>.
Thank you!
I search in google very different keywords, that's why I not found this.
On Dec 10, 2007, at 19:38, Chris Lewis wrote:
> Hi Salamon,
>
> If you havent already, read this:
>
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/
> localization.html
>
> I'm assuming you're trying to localize your app, so this is all
> you'll need.
>
> chris
>
> Salamon Zsolt wrote:
>> Hello!
>>
>> I have a component class, and a properties file with it.
>> We call now ExamComponent.java and ExamComponent.properties.
>>
>> And I have an ExamPage.java.
>>
>> Now I use the ExamComponent.properties file this way in
>> ExamPage.java:
>>
>>
>>
>> @Component
>> private ExamComponent examComponent;
>>
>> ResourceBundle rbLocale = java.util.ResourceBundle.getBundle
>> (examComponent.getClass().getName());
>>
>> String neededPropertyValue = rbLocale.getString("property-name")
>>
>>
>>
>> I got an idea, which says I can use the ExamComponent.properties
>> file if I inject a Messages object. It will be the message catalog
>> for the component.
>> I don't use any Messages object before.
>> Anyone give me an example for this?
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: using properties file from java source in tapestry 5
Posted by Chris Lewis <ch...@bellsouth.net>.
Hi Salamon,
If you havent already, read this:
http://tapestry.apache.org/tapestry5/tapestry-core/guide/localization.html
I'm assuming you're trying to localize your app, so this is all you'll need.
chris
Salamon Zsolt wrote:
> Hello!
>
> I have a component class, and a properties file with it.
> We call now ExamComponent.java and ExamComponent.properties.
>
> And I have an ExamPage.java.
>
> Now I use the ExamComponent.properties file this way in ExamPage.java:
>
>
>
> @Component
> private ExamComponent examComponent;
>
> ResourceBundle rbLocale =
> java.util.ResourceBundle.getBundle(examComponent.getClass().getName());
>
> String neededPropertyValue = rbLocale.getString("property-name")
>
>
>
> I got an idea, which says I can use the ExamComponent.properties file
> if I inject a Messages object. It will be the message catalog for the
> component.
> I don't use any Messages object before.
> Anyone give me an example for this?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org