It's easier to just call getString("key") instead of using
ResourceModel in this case.
-Matej
On 9/5/07, Johan Compagner <[EMAIL PROTECTED]> wrote:
> String js += "var myMsg = '" + JavascriptUtils.escapeQuotes(new
> ResourceModel("MY_MSG", null) + "") + "';";
>
> that looks a bit wrong, try something like this
>
> String js += "var myMsg = '" + JavascriptUtils.escapeQuotes(new
> ResourceModel("MY_MSG", null).getObject() + "") + "';";
>
> On 9/5/07, Marieke Vandamme <[EMAIL PROTECTED]> wrote:
> >
> >
> > Hello,
> >
> > With new 1.3beta3 release I changed all the entries from
> > StringResourceModel
> > to ResourceModel to avoid the warning 'Tried to retrieve a localized
> > string
> > for a component that has not yet been added to the page.' (I still get
> > this
> > warning when using <wicket:message key=""/> tag.. but I guess that's a
> > bug.)
> >
> > But now my real problem :
> > I'm using the renderHead from IHeaderContributor to print some translated
> > text in javascript.
> >
> > public void renderHead(IHeaderResponse hr) {
> > String js += "var myMsg = '" + JavascriptUtils.escapeQuotes(new
> > ResourceModel("MY_MSG", null) + "") + "';";
> > hr.renderJavascript(js, null);
> > }
> >
> > But now the result on my html-page is :
> >
> > var myMsg = 'Model:classname=[org.apache.wicket.model.ResourceModel]';
> >
> > instead I want my translated "MY_MSG".
> > Thanks for your help !
> > --
> > View this message in context:
> > http://www.nabble.com/write-translated-messages-in-renderhead-tf4383719.html#a12496870
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]