You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by heikki <tr...@gmail.com> on 2011/08/06 02:47:50 UTC

i18n for more than attribute

Hello,

I'm trying to make my site available in several languages, and mostly things
work fine. But I'm wondering how to apply translations to more than one
attribute in an element.

For example:

<input wicket:id="some-id"
     type="image"
     src="images/my-image.png"
     name="image"
     alt="the alt text to be translated"
     title="the title text to be translated"
     wicket:message="title:translationkey"/>

this works fine to have the 'title' attribute properly translated. But I
want the 'alt' attribute also properly translated; I can't put in a second
'wicket:message' attribute for that, because it causes a runtime exception
complaining that the same attribute appears twice.

How can I have i18n translations for more than one attribute in the same
element?

thanks in advance for your help,
kind regards
Heikki Doeleman

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/i18n-for-more-than-attribute-tp3722544p3722544.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: i18n for more than attribute

Posted by Dan Retzlaff <dr...@gmail.com>.
>
> As for your suggestion to attach the sources, well, often I use quite many
> libraries (Lucene, Hibernate..) and it would generally speaking get rather
> impractical to attach the sources of all of them. Also kind of defies the
> idea of a /library/..
>

I don't know what your development environment is, but I'll mention that
Eclipse's Maven integration automatically downloads artifacts' source and
javadocs (including Wicket, Hibernate, and Lucene). But to each his own, of
course. :)

Dan

Re: i18n for more than attribute

Posted by Martin Grigorov <mg...@apache.org>.
No offense taken.
Just was curious what radical has changed and it is not described in
the migration page and the table at the bottom of this page.

But you didn't say anything specific...

Btw the migration page is editable by everyone who have an account in
WIKI. Please don't hesitate to improve it with your findings.

On Sun, Aug 7, 2011 at 2:03 AM, heikki <tr...@gmail.com> wrote:
> What I meant with 'radical' changes is that there are many classes that for
> example have disappeared from the API, or have become abstract where before
> they were not, things like that.. in some cases these classes were not
> marked 'deprecated' in 1.4 and yet they're gone in 1.5.
>
> As a result, many of the example code that is around on the web, doesn't
> just work if you're using 1.5.
>
> I did not mean to offend by using that word -- if I did, my apologies. I'm
> still quite new to Wicket and I find it an excellent framework and also a
> very responsive mailing list.
>
> kind regards
> Heikki Doeleman
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/i18n-for-more-than-attribute-tp3722544p3724205.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: i18n for more than attribute

Posted by heikki <tr...@gmail.com>.
What I meant with 'radical' changes is that there are many classes that for
example have disappeared from the API, or have become abstract where before
they were not, things like that.. in some cases these classes were not
marked 'deprecated' in 1.4 and yet they're gone in 1.5.

As a result, many of the example code that is around on the web, doesn't
just work if you're using 1.5.

I did not mean to offend by using that word -- if I did, my apologies. I'm
still quite new to Wicket and I find it an excellent framework and also a
very responsive mailing list.

kind regards
Heikki Doeleman

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/i18n-for-more-than-attribute-tp3722544p3724205.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: i18n for more than attribute

Posted by Martin Grigorov <mg...@apache.org>.
On Sun, Aug 7, 2011 at 1:38 AM, heikki <tr...@gmail.com> wrote:
> Yes, from looking at the code it certainly seems as if it should work..
>
> As for your suggestion to attach the sources, well, often I use quite many
> libraries (Lucene, Hibernate..) and it would generally speaking get rather
> impractical to attach the sources of all of them. Also kind of defies the
> idea of a /library/..
>
> but maybe for Wicket it makes sense indeed, as it is the core framework to
> run my application -- and also because it seems the changes in the API
> between 1.4 and 1.5 are often quite radical.
What do you mean? What is radical?
>
> Although for this particular problem the changes do not seem too great. For
> the moment I'll live with translated 'title' attributes and non-translated
> 'alt' attributes, due to time constraints -- but I do intend to find out
> what's happening exactly and when I do, I'll post my results here.
Just file a ticket with quickstart
>
> Thank you for your replies,
> kind regards
> Heikki Doeleman
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/i18n-for-more-than-attribute-tp3722544p3724170.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: i18n for more than attribute

Posted by heikki <tr...@gmail.com>.
Yes, from looking at the code it certainly seems as if it should work..

As for your suggestion to attach the sources, well, often I use quite many
libraries (Lucene, Hibernate..) and it would generally speaking get rather
impractical to attach the sources of all of them. Also kind of defies the
idea of a /library/..

but maybe for Wicket it makes sense indeed, as it is the core framework to
run my application -- and also because it seems the changes in the API
between 1.4 and 1.5 are often quite radical.

Although for this particular problem the changes do not seem too great. For
the moment I'll live with translated 'title' attributes and non-translated
'alt' attributes, due to time constraints -- but I do intend to find out
what's happening exactly and when I do, I'll post my results here.

Thank you for your replies,
kind regards
Heikki Doeleman

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/i18n-for-more-than-attribute-tp3722544p3724170.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: i18n for more than attribute

Posted by Dan Retzlaff <dr...@gmail.com>.
I tested in 1.4 and it worked. There's more error checking in 1.5, but it
essentially looks the same.
http://svn.apache.org/repos/asf/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/WicketMessageTagHandler.java

I recommend spending the time to attach the Wicket source in your IDE. I
can't imagine developing against a black-box API... You learn so much by
looking under the hood! Plus it'll help you get to the bottom of this
particular issue. :)

On Sat, Aug 6, 2011 at 9:47 AM, heikki <tr...@gmail.com> wrote:

> Hmm I don't have Wicket source at hand, just using the compiled libraries.
>
> Could it be that it works differently in the Wicket version I'm using (1.5
> M3) ?
>
>
> I tested this:
>
>                            <input wicket:id="french"
>                                   type="image"
>                                   src="images/flags/france_small.png"
>                                   name="image"
>                                   alt="français"
>                                   title="français"
>                                   wicket:message="title:french, alt:french"
>                                   style="border-style: none;"/>
>
> and this (reversed order in comma-separated list):
>
>                            <input wicket:id="french"
>                                   type="image"
>                                   src="images/flags/france_small.png"
>                                   name="image"
>                                   alt="français"
>                                   title="français"
>                                   wicket:message="alt:french, title:french"
>                                   style="border-style: none;"/>
>
> and the result is really as I described, only the first of the
> comma-separated attributes gets translated.
>
> thanks
> kind regards
> Heikki Doeleman
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/i18n-for-more-than-attribute-tp3722544p3723591.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: i18n for more than attribute

Posted by heikki <tr...@gmail.com>.
Hmm I don't have Wicket source at hand, just using the compiled libraries.

Could it be that it works differently in the Wicket version I'm using (1.5
M3) ?


I tested this:

                            <input wicket:id="french"
                                   type="image"
                                   src="images/flags/france_small.png"
                                   name="image"
                                   alt="français"
                                   title="français"
                                   wicket:message="title:french, alt:french"
                                   style="border-style: none;"/>

and this (reversed order in comma-separated list):

                            <input wicket:id="french"
                                   type="image"
                                   src="images/flags/france_small.png"
                                   name="image"
                                   alt="français"
                                   title="français"
                                   wicket:message="alt:french, title:french"
                                   style="border-style: none;"/>

and the result is really as I described, only the first of the
comma-separated attributes gets translated.

thanks
kind regards
Heikki Doeleman

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/i18n-for-more-than-attribute-tp3722544p3723591.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: i18n for more than attribute

Posted by Dan Retzlaff <dr...@gmail.com>.
I'm pretty sure it's supposed to work as Martin described. Why don't you
breakpoint WicketMessageTagHandler.AttributeLocalizer.onComponentTag() and
see what's going on. It looks straight forward, expr.split(",") and all.

On Sat, Aug 6, 2011 at 9:05 AM, heikki <tr...@gmail.com> wrote:

> hi,
>
> thanks, but that doesn't work; only the first in the comma-separated list
> gets translated.
>
> Anyone have an idea how to do this ?
>
>
> thanks
> kind regards
> Heikki Doeleman
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/i18n-for-more-than-attribute-tp3722544p3723525.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: i18n for more than attribute

Posted by heikki <tr...@gmail.com>.
hi,

thanks, but that doesn't work; only the first in the comma-separated list
gets translated.

Anyone have an idea how to do this ?


thanks
kind regards
Heikki Doeleman

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/i18n-for-more-than-attribute-tp3722544p3723525.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: i18n for more than attribute

Posted by Martin Grigorov <mg...@apache.org>.
it is something like:
wicket:message="title:translationkey,alt:altTranslationKey"

On Sat, Aug 6, 2011 at 3:47 AM, heikki <tr...@gmail.com> wrote:
> Hello,
>
> I'm trying to make my site available in several languages, and mostly things
> work fine. But I'm wondering how to apply translations to more than one
> attribute in an element.
>
> For example:
>
> <input wicket:id="some-id"
>     type="image"
>     src="images/my-image.png"
>     name="image"
>     alt="the alt text to be translated"
>     title="the title text to be translated"
>     wicket:message="title:translationkey"/>
>
> this works fine to have the 'title' attribute properly translated. But I
> want the 'alt' attribute also properly translated; I can't put in a second
> 'wicket:message' attribute for that, because it causes a runtime exception
> complaining that the same attribute appears twice.
>
> How can I have i18n translations for more than one attribute in the same
> element?
>
> thanks in advance for your help,
> kind regards
> Heikki Doeleman
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/i18n-for-more-than-attribute-tp3722544p3722544.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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