There is a big difference, the model variant will evaluate during the
render phase. You can not use localization in the constructor of your
component, you can however safely construct a ResourceModel (but not
call getObject on it).

In general, I would use localizer when you need direct access to a
message from code. This should be rare though, most message can be
placed with the <wicket:message> element.

Regards,
    Erik.


Timo Rantalaiho wrote:
> On Mon, 18 Aug 2008, lesterburlap wrote:
>   
>> new ResourceModel("my.resource.key").getObject().toString();
>> or
>> getLocalizer().getString("my.resource.key", MyComponent.this);
>>     
>
> Isn't the latter same as 
>
>   Component.getString("my.resource.key");
>
> ?
>
> And ResourceModel can typically be used directly as the 
> model of the Label displaying the String
>
>   add(new Label("foo", new ResourceModel("my.resource.key")));
>
>   
>> I've been using getLocalizer almost everywhere, and only using ResourceModel
>> when I'm trying to get a property string during Component construction (to
>> avoid those getLocalizer warnings).  But I'm not really sure if my reasoning
>> is good...
>>     
>
> I wouldn't think that there is any difference. If you are 
> worried about performance, try profiling the application.
>
> Best wishes,
> Timo
>   

--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to