You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Michael Sparer <mi...@gmx.at> on 2010/08/23 12:16:04 UTC

Shortening a wicket:message

  Hey,

I have a component that constructs a wicket:message just like Erik does 
in his blog post 
(http://day-to-day-stuff.blogspot.com/2008/05/wicket-internationalization.html)

the .html is as follows:

<wicket:message key="sentence">
<wicket:container wicket:id="userComponent"></wicket:container>
<wicket:container wicket:id="actionComponent"></wicket:container>
<wicket:container wicket:id="targetComponent"></wicket:container>
<wicket:container wicket:id="donationTarget"></wicket:container>
</wicket:message>

the .properties file is the following:

sentence=${userComponent}: I'll ${actionComponent} if ${targetComponent} 
${donationTarget}.
# replaces ${userComponent} in 'sentence'
userComponentText=${user.firstname} ${user.lastname}
# replaces ${actionComponent} in 'sentence'
actionComponentText.action=${sentenceActionText}
# replaces ${targetComponent} in 'sentence'
targetComponentText=${targetGroup} pay ${sum} Euros to ${target}

this results in nice sentences based on various cases handled in the 
java file - an example output might be:
"John Jones: I'll climb on the highest mountain if my friends pay 100 
Euros to my Auntie"


My problem now is, that on some pages the output should be shortened, so 
the above sentence should be something like:
"John Jones: I'll climb on the highest mountain if my friends ..." or
"John Jones: I'll climb on the highest mountain if my friends pay 100 
Euros to"

Anyone got an idea?

cheers,

Michael

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


Re: Shortening a wicket:message

Posted by Igor Vaynberg <ig...@gmail.com>.
you can copy wicket:message releated functionality into a new tag that
takes an extra maxlen attribute, or you can create a patch for the
core.

-igor

On Mon, Aug 23, 2010 at 3:16 AM, Michael Sparer <mi...@gmx.at> wrote:
>  Hey,
>
> I have a component that constructs a wicket:message just like Erik does in
> his blog post
> (http://day-to-day-stuff.blogspot.com/2008/05/wicket-internationalization.html)
>
> the .html is as follows:
>
> <wicket:message key="sentence">
> <wicket:container wicket:id="userComponent"></wicket:container>
> <wicket:container wicket:id="actionComponent"></wicket:container>
> <wicket:container wicket:id="targetComponent"></wicket:container>
> <wicket:container wicket:id="donationTarget"></wicket:container>
> </wicket:message>
>
> the .properties file is the following:
>
> sentence=${userComponent}: I'll ${actionComponent} if ${targetComponent}
> ${donationTarget}.
> # replaces ${userComponent} in 'sentence'
> userComponentText=${user.firstname} ${user.lastname}
> # replaces ${actionComponent} in 'sentence'
> actionComponentText.action=${sentenceActionText}
> # replaces ${targetComponent} in 'sentence'
> targetComponentText=${targetGroup} pay ${sum} Euros to ${target}
>
> this results in nice sentences based on various cases handled in the java
> file - an example output might be:
> "John Jones: I'll climb on the highest mountain if my friends pay 100 Euros
> to my Auntie"
>
>
> My problem now is, that on some pages the output should be shortened, so the
> above sentence should be something like:
> "John Jones: I'll climb on the highest mountain if my friends ..." or
> "John Jones: I'll climb on the highest mountain if my friends pay 100 Euros
> to"
>
> Anyone got an idea?
>
> cheers,
>
> Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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