You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Marieke Vandamme <ma...@tvh.com> on 2016/05/19 08:24:28 UTC

StringResourceModel - setParameters - ConverterLocator

​Dear,

I use the new method within Wicket 7 (​currently using 7.3.0) :
new StringResourceModel("MYLABEL").setParameters(new double(1.2)).
Also in my application I have a ConverterLocator defined, which converts
doubles.
But I don't think this conversion is used within my StringResourceModel.
Is that possible? Or am I doing something wrong?
Thanks for any help ! Kind regards, Marieke

-- 


**** DISCLAIMER ****

http://www.tvh.com/glob/en/email-disclaimer

"This message is delivered to all addressees subject to the conditions
set forth in the attached disclaimer, which is an integral part of this
message."

Re: StringResourceModel - setParameters - ConverterLocator

Posted by Sven Meier <sv...@meiers.net>.
Hi,

for parameters StringResourceModel uses Java's MessageFormat (which does 
its own conversion).
All properties interpolated from an optional nested model are properly 
converted by Wicket:

     new StringResourceModel("foo.bar", nestedModel);

Have fun
Sven



On 19.05.2016 10:45, Marieke Vandamme wrote:
> Hi,
>
> Really? Isn't that something that should be managed by wicket? I thought
> this was going to be default behavior, so maybe other people will also
> think that..
> Should I create a jira change request for this?
>
>
> 2016-05-19 10:41 GMT+02:00 Martin Grigorov <mg...@apache.org>:
>
>> Hi,
>>
>> You will have to do it yourself. The converters are used only by the
>> components.
>> In your case I guess you'll have to do something like:
>> String converted = converterLocator.get(Double.class).convert(1.2d)
>> new StringResourceModel("MYLABEL").setParameters(converted).
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Thu, May 19, 2016 at 10:24 AM, Marieke Vandamme <
>> marieke.vandamme@tvh.com
>>> wrote:
>>> \u200bDear,
>>>
>>> I use the new method within Wicket 7 (\u200bcurrently using 7.3.0) :
>>> new StringResourceModel("MYLABEL").setParameters(new double(1.2)).
>>> Also in my application I have a ConverterLocator defined, which converts
>>> doubles.
>>> But I don't think this conversion is used within my StringResourceModel.
>>> Is that possible? Or am I doing something wrong?
>>> Thanks for any help ! Kind regards, Marieke
>>>
>>> --
>>>
>>>
>>> **** DISCLAIMER ****
>>>
>>> http://www.tvh.com/glob/en/email-disclaimer
>>>
>>> "This message is delivered to all addressees subject to the conditions
>>> set forth in the attached disclaimer, which is an integral part of this
>>> message."
>>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: StringResourceModel - setParameters - ConverterLocator

Posted by Marieke Vandamme <ma...@tvh.com>.
Hi,

Really? Isn't that something that should be managed by wicket? I thought
this was going to be default behavior, so maybe other people will also
think that..
Should I create a jira change request for this?


2016-05-19 10:41 GMT+02:00 Martin Grigorov <mg...@apache.org>:

> Hi,
>
> You will have to do it yourself. The converters are used only by the
> components.
> In your case I guess you'll have to do something like:
> String converted = converterLocator.get(Double.class).convert(1.2d)
> new StringResourceModel("MYLABEL").setParameters(converted).
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Thu, May 19, 2016 at 10:24 AM, Marieke Vandamme <
> marieke.vandamme@tvh.com
> > wrote:
>
> > ​Dear,
> >
> > I use the new method within Wicket 7 (​currently using 7.3.0) :
> > new StringResourceModel("MYLABEL").setParameters(new double(1.2)).
> > Also in my application I have a ConverterLocator defined, which converts
> > doubles.
> > But I don't think this conversion is used within my StringResourceModel.
> > Is that possible? Or am I doing something wrong?
> > Thanks for any help ! Kind regards, Marieke
> >
> > --
> >
> >
> > **** DISCLAIMER ****
> >
> > http://www.tvh.com/glob/en/email-disclaimer
> >
> > "This message is delivered to all addressees subject to the conditions
> > set forth in the attached disclaimer, which is an integral part of this
> > message."
> >
>

-- 


**** DISCLAIMER ****

http://www.tvh.com/glob/en/email-disclaimer

"This message is delivered to all addressees subject to the conditions
set forth in the attached disclaimer, which is an integral part of this
message."

Re: StringResourceModel - setParameters - ConverterLocator

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You will have to do it yourself. The converters are used only by the
components.
In your case I guess you'll have to do something like:
String converted = converterLocator.get(Double.class).convert(1.2d)
new StringResourceModel("MYLABEL").setParameters(converted).

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, May 19, 2016 at 10:24 AM, Marieke Vandamme <marieke.vandamme@tvh.com
> wrote:

> ​Dear,
>
> I use the new method within Wicket 7 (​currently using 7.3.0) :
> new StringResourceModel("MYLABEL").setParameters(new double(1.2)).
> Also in my application I have a ConverterLocator defined, which converts
> doubles.
> But I don't think this conversion is used within my StringResourceModel.
> Is that possible? Or am I doing something wrong?
> Thanks for any help ! Kind regards, Marieke
>
> --
>
>
> **** DISCLAIMER ****
>
> http://www.tvh.com/glob/en/email-disclaimer
>
> "This message is delivered to all addressees subject to the conditions
> set forth in the attached disclaimer, which is an integral part of this
> message."
>