Hi, I don't think createing a ResourceModel instance makes sense, because all ResourceModel does is using the localizer...
Regarding the original question, if I remember correctly the warning message only shows up in development mode to give you a heads up that resource lookup will not work as expected if the component is not yet added to a page. See: <http://day-to-day-stuff.blogspot.com/2008/05/wicket-internationalization.html> section 'Finding the message' If the resource string isn't located in the page's resource file, it's probably safe to ignore the warning. Besides, if you're in a Component, you can use Component#getString as shortcut (instead of Application.get().getResourceSettings().getLocalizer().getString(...)) cheers, Jonas 2009/4/14 Witold Czaplewski <witold-mail...@cts-media.eu>: > Hi Michał, > > if you need the string of a ResourceModel you may want to call: new > ResourceModel("key").getObject().toString(). > > cheers, > Witold > > Am Tue, 14 Apr 2009 11:07:05 +0200 > schrieb Michał Letyński <mletyn...@consol.pl>: > >> Hi. >> When im getting localized string in constructor via getString method the >> warning message is dispalyed: "Tried to retrieve a localized string for >> a component that has not yet been added to the page. " >> >> I know that one possible way to "fix" this is to use >> ResourceModel("key'). But what if i cant use ResourceModel ? for e.g >> some component want String directly. Is there a better solution then >> using: >> "Application.get().getResourceSettings().getLocalizer().getString(resourceKey, >> (Component)null, defaultValue); >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org