Re: Internationalizing a DDC

2010-07-07 Thread always_rick

very cool, but the options' values are force to 0, 1, 2, 3, 4 ...

option value=0Day/option
option value=1Week /option
option value=2Fortnight/option
option value=3Month/option
option value=4Year/option

I've tried the whole night, any help is appreciated. 
 


Sven Meier wrote:
 
 You can do without the ChoiceRenderer if you put your terms in a 
 property file next to your panel/page:
 
 A.java
 new DropDownChoice(period, ...) {
 protected boolean localizeDisplayValues() {
 return true;
 }
 }
 
 A.html
select wicket:id=period/
 
 A.properties
period.1 = Day
period.7 = Week
period.14 = Fortnight
period.30 = Month
period.365 = Year
 
 Sven
 
 

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Internationalizing-a-DDC-tp1869877p2281661.html
Sent from the Wicket - User mailing list archive at Nabble.com.

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



Re: Internationalizing a DDC

2008-08-02 Thread Uwe Schäfer

insom wrote:


new DropDownChoice(period,
  new PropertyModel(myObject, period),
  periods,
  new ChoiceRenderer() {
public String getDisplayValue(Object object) {
  int period = ((Integer) object).intValue();
  switch (period) {
case 1: return Day;

...

default: throw new RuntimeException();
  }
}
  }
); 


My question is, how can I take advantage of Wicket's internationalization
capabilities to replace the return values with the proper values for the
locale?


you could just use getString:

...
case 1: return DropDownChoice.this.getString(Day);
...

--

THOMAS DAILY GmbH
Adlerstraße 19
79098 Freiburg
Deutschland
T  + 49 761 3 85 59 0
F  + 49 761 3 85 59 550
E  [EMAIL PROTECTED]
www.thomas-daily.de

Geschäftsführer/Managing Directors:
Wendy Thomas, Susanne Larbig
Handelsregister Freiburg i.Br., HRB 3947

Registrieren Sie sich unter http://morningnews.thomas-daily.de für die 
kostenfreien TD Morning News, eine Auswahl aktueller Themen des Tages 
morgens um 9:00 in Ihrer Mailbox.


Hinweis: Der Redaktionsschluss für unsere TD Morning News ist täglich um 
8:30 Uhr. Es werden vorrangig Informationen berücksichtigt, die nach 
16:00 Uhr des Vortages eingegangen sind. Die Email-Adresse unserer 
Redaktion lautet [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Internationalizing a DDC

2008-08-02 Thread Sven Meier
You can do without the ChoiceRenderer if you put your terms in a 
property file next to your panel/page:


   A.java
   new DropDownChoice(period, ...) {
   protected boolean localizeDisplayValues() {
   return true;
   }
   }

   A.html
  select wicket:id=period/

   A.properties
  period.1 = Day
  period.7 = Week
  period.14 = Fortnight
  period.30 = Month
  period.365 = Year

Sven

insom schrieb:

I'm using John Krasnay's approach to defining display values for a
DropDownChoice, like so:

new DropDownChoice(period,
  new PropertyModel(myObject, period),
  periods,
  new ChoiceRenderer() {
public String getDisplayValue(Object object) {
  int period = ((Integer) object).intValue();
  switch (period) {
case 1: return Day;
case 7: return Week;
case 14: return Fortnight;
case 30: return Month;
case 365: return Year;
default: throw new RuntimeException();
  }
}
  }
); 


My question is, how can I take advantage of Wicket's internationalization
capabilities to replace the return values with the proper values for the
locale?

  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]