You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andreas Bulling <sp...@phoenix.hadiko.de> on 2006/05/01 20:19:52 UTC
Localized messages in service
Hi folks,
probably it's a not very difficult question concerning localized
messages in a service but as I have absolutely no idea what I could
have done wrong here I am ;)
That's the way I defined my service in hivemodule.xml:
<service-point id="StatisticService" interface="de.plattform.services.StatisticService">
<invoke-factory model="threaded">
<construct class="de.plattform.services.StatisticServiceImpl"/>
</invoke-factory>
</service-point>
That's my service's constructor:
public StatisticServiceImpl(Operations operations, Messages messages)
{
this._operations = operations;
this._messages = messages;
}
When debugging I can see that _messages isn't null but I'm not
able to get localized messages with for example
String xAxisLabel = _messages.getMessage("month");
What's wrong here?
Thanks in advance!
Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Localized messages in service
Posted by Andreas Bulling <sp...@phoenix.hadiko.de>.
On 01. Mai 2006 - 14:35:21, James Carman wrote:
| There is another option. Since there is a service point implementing
| IRequestCycle, you can inject that instead and do:
|
| requestCycle.getPage().getMessages().getMessage( "message_key" )
|
| That way, you could also override the message for individual pages if you
| wanted.
Thanks a lot - works like a charme ;-)
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: Localized messages in service
Posted by James Carman <ja...@carmanconsulting.com>.
Well, inside the HiveMind registry, HiveMind is injecting your module's
Messages object into your service implementation. So, if you have a
hivemodule.properties file next to your hivemodule.xml file, it will get the
messages from there.
There is another option. Since there is a service point implementing
IRequestCycle, you can inject that instead and do:
requestCycle.getPage().getMessages().getMessage( "message_key" )
That way, you could also override the message for individual pages if you
wanted.
-----Original Message-----
From: Andreas Bulling [mailto:andreas@phoenix.hadiko.de] On Behalf Of
Andreas Bulling
Sent: Monday, May 01, 2006 2:30 PM
To: Tapestry users
Subject: Re: Localized messages in service
On 01. Mai 2006 - 14:26:25, James Carman wrote:
| What file are you expecting it to read those message definitions from?
>>From my_application.properties?
---------------------------------------------------------------------
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
Re: Localized messages in service
Posted by Andreas Bulling <sp...@phoenix.hadiko.de>.
On 01. Mai 2006 - 14:26:25, James Carman wrote:
| What file are you expecting it to read those message definitions from?
>From my_application.properties?
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: Localized messages in service
Posted by James Carman <ja...@carmanconsulting.com>.
What file are you expecting it to read those message definitions from?
-----Original Message-----
From: Andreas Bulling [mailto:andreas@phoenix.hadiko.de] On Behalf Of
Andreas Bulling
Sent: Monday, May 01, 2006 2:20 PM
To: Tapestry users
Subject: Localized messages in service
Hi folks,
probably it's a not very difficult question concerning localized
messages in a service but as I have absolutely no idea what I could
have done wrong here I am ;)
That's the way I defined my service in hivemodule.xml:
<service-point id="StatisticService"
interface="de.plattform.services.StatisticService">
<invoke-factory model="threaded">
<construct
class="de.plattform.services.StatisticServiceImpl"/>
</invoke-factory>
</service-point>
That's my service's constructor:
public StatisticServiceImpl(Operations operations, Messages messages)
{
this._operations = operations;
this._messages = messages;
}
When debugging I can see that _messages isn't null but I'm not
able to get localized messages with for example
String xAxisLabel = _messages.getMessage("month");
What's wrong here?
Thanks in advance!
Andreas
---------------------------------------------------------------------
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