You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by smallufo <sm...@gmail.com> on 2010/10/27 17:19:50 UTC

Easier i18n title attribute ?

Now , when I want to add a i18n "title" attribute to a tag (<img> or <a> ) ,
I have to do the following :

Image icon = new Image("icon" , new ResourceReference(xxx.class ,
"../icons/icon.png"));
icon.add(new SimpleAttributeModifier("title" , ResourceModel("key..."));

I feel it is cumbersome , because it need to add extra two lines in code and
one wicket:id in html , and take care of the hierarchy.
Is there any way to ease of this path ?

Is it possible to combine <wicket:message key="xxx"> to <img> or <a> tag ?
Such as

<wicket:link><img src="../icons/icon.png" border="0" title= <wicket:message
key="xxx"/>   /></wicket:link>

I know it looks ugly , but I hope wicket team can find a better / easier
approach.

Re: Easier i18n title attribute ?

Posted by James Carman <ja...@carmanconsulting.com>.
Take a look at how the wicket:message tag works here:

https://cwiki.apache.org/WICKET/wickets-xhtml-tags.html

They've got an example where you can use it to provide attribute
values.  That's what you want.

On Wed, Oct 27, 2010 at 11:19 AM, smallufo <sm...@gmail.com> wrote:
> Now , when I want to add a i18n "title" attribute to a tag (<img> or <a> ) ,
> I have to do the following :
>
> Image icon = new Image("icon" , new ResourceReference(xxx.class ,
> "../icons/icon.png"));
> icon.add(new SimpleAttributeModifier("title" , ResourceModel("key..."));
>
> I feel it is cumbersome , because it need to add extra two lines in code and
> one wicket:id in html , and take care of the hierarchy.
> Is there any way to ease of this path ?
>
> Is it possible to combine <wicket:message key="xxx"> to <img> or <a> tag ?
> Such as
>
> <wicket:link><img src="../icons/icon.png" border="0" title= <wicket:message
> key="xxx"/>   /></wicket:link>
>
> I know it looks ugly , but I hope wicket team can find a better / easier
> approach.
>

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


Re: Easier i18n title attribute ?

Posted by Bas Gooren <ba...@iswd.nl>.
See 
https://cwiki.apache.org/WICKET/wickets-xhtml-tags.html#Wicket%2527sXHTMLtags-WicketAttributes

What you want is possible with Wicket, out-of-the-box.

Bas

----- Original Message ----- 
From: "smallufo" <sm...@gmail.com>
To: <us...@wicket.apache.org>
Sent: Wednesday, October 27, 2010 5:19 PM
Subject: Easier i18n title attribute ?


> Now , when I want to add a i18n "title" attribute to a tag (<img> or <a> ) 
> ,
> I have to do the following :
>
> Image icon = new Image("icon" , new ResourceReference(xxx.class ,
> "../icons/icon.png"));
> icon.add(new SimpleAttributeModifier("title" , ResourceModel("key..."));
>
> I feel it is cumbersome , because it need to add extra two lines in code 
> and
> one wicket:id in html , and take care of the hierarchy.
> Is there any way to ease of this path ?
>
> Is it possible to combine <wicket:message key="xxx"> to <img> or <a> tag ?
> Such as
>
> <wicket:link><img src="../icons/icon.png" border="0" title= 
> <wicket:message
> key="xxx"/>   /></wicket:link>
>
> I know it looks ugly , but I hope wicket team can find a better / easier
> approach.
> 


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