Shortening a wicket:message

2010-08-23 Thread Michael Sparer

 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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Shortening a wicket:message

2010-08-23 Thread Igor Vaynberg
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 michael.spa...@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-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



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