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]

Reply via email to