You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Matthias Keller <ma...@ergon.ch> on 2012/07/18 14:04:21 UTC

Wicket 1.5 vs 1.4: StringResourcesModel with properties in the key

Hi

I'm currently migrating a project from 1.4 and am encountering a Problem 
with StringResourcesModel:

I've got one defined as:
new StringResourceModel("details.disabled.${disabled}", this.model)

isDisabled returns a boolean naturally.
In 1.4 this worked as expected and the resource keys 
details.disabled.true or details.disabled.false were taken.

Unfortunately, there's a default IConverter in place for boolean values 
since those usually needs to be displayed as "yes" and "no" (or alike in 
the other languages).
In Wicket 1.5, the StringResourceModel now does some heavier processing 
on the key, thus the boolean value is converted first using the 
registered converter and then inserted into the resource key; resulting 
in keys like "details.disabled.yes" or "details.disabled.ja" etc which 
are even language dependent!

Is there a possibility to revert to the previous behaviour except for 
overriding the StringResourceModel (and a lot of other classes) and 
except for removing the global boolean converter? The latter isn't 
doable as it would be nearly impossible to find out where those booleans 
are used throughout the pretty huge application....

Thanks

Matt


Re: Wicket 1.5 vs 1.4: StringResourcesModel with properties in the key

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

WICKET-3753 has changed PropertyVariableInterpolator to use the 
application's converters for property values:

     Application.get().getConverterLocator().getConverter(type);

I think this is a regression: resolving properties in message keys is 
broken.

I'll reopen the ticket and look for a solution.

Thanks
Sven

On 07/18/2012 02:04 PM, Matthias Keller wrote:
> Hi
>
> I'm currently migrating a project from 1.4 and am encountering a 
> Problem with StringResourcesModel:
>
> I've got one defined as:
> new StringResourceModel("details.disabled.${disabled}", this.model)
>
> isDisabled returns a boolean naturally.
> In 1.4 this worked as expected and the resource keys 
> details.disabled.true or details.disabled.false were taken.
>
> Unfortunately, there's a default IConverter in place for boolean 
> values since those usually needs to be displayed as "yes" and "no" (or 
> alike in the other languages).
> In Wicket 1.5, the StringResourceModel now does some heavier 
> processing on the key, thus the boolean value is converted first using 
> the registered converter and then inserted into the resource key; 
> resulting in keys like "details.disabled.yes" or "details.disabled.ja" 
> etc which are even language dependent!
>
> Is there a possibility to revert to the previous behaviour except for 
> overriding the StringResourceModel (and a lot of other classes) and 
> except for removing the global boolean converter? The latter isn't 
> doable as it would be nearly impossible to find out where those 
> booleans are used throughout the pretty huge application....
>
> Thanks
>
> Matt
>



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