You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by marcus dickerhof <ma...@googlemail.com> on 2007/10/16 13:59:20 UTC

Link embedded in localized Label/Message?

Hi,
is it possible to have a link in a localized label?
I would like to have something like this in my output:


Please click <a href="xyz">here</a>. And then do ....


--> Is there a possiblity to use a StringResourceModel here? Something like
pagexyz.usermessage=Please click {mylink}. And then do...

How would I now add the link to the message?
myLabel.add( new Link(.... does not work...

If this is not possible, how is the standard way of doing such a thing?
Thanks for your help!

Marcus

Re: Link embedded in localized Label/Message?

Posted by marcus dickerhof <ma...@googlemail.com>.
Thanks for all your suggestions. And your very fast help.

I do not need it that often, that's why I will just split up the message
into 3 parts.
But Matthijs suggestion sounds good, when I have to do this more often, I
will try it out.

Greetings from Germany
Marcus



2007/10/16, Matthijs Wensveen <m....@func.nl>:
>
> The problem is that you want the link to appear within the localized
> message, right?
> The easy way is to split the localized message into 3 parts: a localized
> part before the link, a localized link label and a localized part after
> the link. This is a little cumbersome but works without much hassle.
>
> If you need this a lot, you could write a component that parses the
> localized string to generate it's own markup (replace all {myLink} with
> <a wicket:id="myLink">) and then add the link to that component. This is
> not very easy to do but can save time if you need it a lot.
>
> Matthijs.
>
> Thies Edeling wrote:
> > Hi,
> >
> > In your HTML the label is a child of the link so do it the other way
> > around, add the label to the link
> >
> > Link l = new Link..
> > l.add(new Label..
> >
> > with <a wicket:id=".."><span wicket:id=".."></span></a>
> >
> > gr
> > Thies
> >
> >> Hi,
> >> is it possible to have a link in a localized label?
> >> I would like to have something like this in my output:
> >>
> >>
> >> Please click <a href="xyz">here</a>. And then do ....
> >>
> >>
> >> --> Is there a possiblity to use a StringResourceModel here?
> >> Something like
> >> pagexyz.usermessage=Please click {mylink}. And then do...
> >>
> >> How would I now add the link to the message?
> >> myLabel.add( new Link(.... does not work...
> >>
> >> If this is not possible, how is the standard way of doing such a thing?
> >> Thanks for your help!
> >>
> >> Marcus
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Link embedded in localized Label/Message?

Posted by Matthijs Wensveen <m....@func.nl>.
The problem is that you want the link to appear within the localized 
message, right?
The easy way is to split the localized message into 3 parts: a localized 
part before the link, a localized link label and a localized part after 
the link. This is a little cumbersome but works without much hassle.

If you need this a lot, you could write a component that parses the 
localized string to generate it's own markup (replace all {myLink} with 
<a wicket:id="myLink">) and then add the link to that component. This is 
not very easy to do but can save time if you need it a lot.

Matthijs.

Thies Edeling wrote:
> Hi,
>
> In your HTML the label is a child of the link so do it the other way 
> around, add the label to the link
>
> Link l = new Link..
> l.add(new Label..
>
> with <a wicket:id=".."><span wicket:id=".."></span></a>
>
> gr
> Thies
>
>> Hi,
>> is it possible to have a link in a localized label?
>> I would like to have something like this in my output:
>>
>>
>> Please click <a href="xyz">here</a>. And then do ....
>>
>>
>> --> Is there a possiblity to use a StringResourceModel here? 
>> Something like
>> pagexyz.usermessage=Please click {mylink}. And then do...
>>
>> How would I now add the link to the message?
>> myLabel.add( new Link(.... does not work...
>>
>> If this is not possible, how is the standard way of doing such a thing?
>> Thanks for your help!
>>
>> Marcus
>>
>>   
>
>


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


Re: Link embedded in localized Label/Message?

Posted by Thies Edeling <th...@rrm.net>.
Hi,

In your HTML the label is a child of the link so do it the other way 
around, add the label to the link

Link l = new Link..
l.add(new Label..

with <a wicket:id=".."><span wicket:id=".."></span></a>

gr
Thies

> Hi,
> is it possible to have a link in a localized label?
> I would like to have something like this in my output:
>
>
> Please click <a href="xyz">here</a>. And then do ....
>
>
> --> Is there a possiblity to use a StringResourceModel here? Something like
> pagexyz.usermessage=Please click {mylink}. And then do...
>
> How would I now add the link to the message?
> myLabel.add( new Link(.... does not work...
>
> If this is not possible, how is the standard way of doing such a thing?
> Thanks for your help!
>
> Marcus
>
>   


-- 
http://www.ehour.nl/ 
http://blog.ehour.nl/



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


Re: Link embedded in localized Label/Message?

Posted by Martijn Dashorst <ma...@gmail.com>.
It is not possible. A label will remove *all* markup between its tags
and put the contents of the model inside.

In your case I would suggest using <wicket:message> tags instead.

<wicket:message key="beforeHereLink">Please click </wicket:message><a
href="#" wicket:id="hereLink"><wicket:message
key="insideHereLink">here</wicket:message></a><wicket:message
key="afterHereLink">. And then do...</wicket:message>

Martijn

On 10/16/07, marcus dickerhof <ma...@googlemail.com> wrote:
> Hi,
> is it possible to have a link in a localized label?
> I would like to have something like this in my output:
>
>
> Please click <a href="xyz">here</a>. And then do ....
>
>
> --> Is there a possiblity to use a StringResourceModel here? Something like
> pagexyz.usermessage=Please click {mylink}. And then do...
>
> How would I now add the link to the message?
> myLabel.add( new Link(.... does not work...
>
> If this is not possible, how is the standard way of doing such a thing?
> Thanks for your help!
>
> Marcus
>


-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/

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