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
you can however safely construct a ResourceModel
(but not call getObject on it).
So, doing ResourceModel(key).getObject().getString() is really kind of
silly and defeats the whole purpose of the ResourceModel?
LBB
--
View this message in context:
http://www.nabble.com/ResourceModel-vs
On Tue, 19 Aug 2008, Erik van Oosten wrote:
There is a big difference, the model variant will evaluate during the
render phase. You can not use localization in the constructor of your
Well, this
new ResourceModel(my.resource.key).getObject().toString();
will of course evaluate right away
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...
Thanks for any input.
LBB
--
View this message in context:
http://www.nabble.com/ResourceModel-vs.-getLocalizer-tp19040992p19040992.html
Sent
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