Hi,

put the localized values into the choices:

selectionDescription.add(getString("forms.cf37.question8.oneTime"));

Even better, put the above inside a ReadOnlyModel's getObject().

Have fun
Sven


⁣Gesendet mit Blue ​

Am 25. Jan. 2018, 07:50, um 07:50, extraquoo <extraq...@gmail.com> schrieb:
>Hi
>I am adding a FormComponent DropDownChoice to display a dropdown list
>on
>the page like below
><http://apache-wicket.1842946.n4.nabble.com/file/t375760/dropdown_list.png>
>
>
>To support the i18n, I  add the key to a list of choices and override
>the
>localizeDisplayValues, the code is below
>
>private FormComponent<?> getQuestion8Select(String fieldName,
>                       IModel<?> parent) {
>
>               List<String> selectionDescription = new ArrayList<String>();
>               selectionDescription.add("forms.cf37.question8.oneTime");
>               
> selectionDescription.add("forms.cf37.question8.otherSourcemonthly");
>                       DropDownChoice<String> selector = new
>DropDownChoice<String>(fieldName,
>selectionDescription){
>                               private static final long serialVersionUID = 1L;
>                                       @Override
>                                       protected boolean 
> localizeDisplayValues() {
>                                       return true;
>                                         }
>                                       };
>
>                                return selector;
>                               }
>
>the key forms.cf37.question8.oneTime and
>forms.cf37.question8.otherSourcemonthly has different values in
>corresponding XML files.
>  xxxx.xml
><entry key="forms.cf37.question8.oneTimeOrMonthly">One time or ongoing
>payment:</entry>
><entry key="forms.cf37.question8.oneTime">One time payment</entry>
>xxxx_es.xml
><entry key="forms.cf37.question8.oneTimeOrMonthly">Pago de solo una vez
>o
>pago mensual:</entry>
><entry key="forms.cf37.question8.oneTime">Pago de solo una vez</entry>
>
>When I switch the locale to Spanish, the verbiage changes well on the
>HTML.
><http://apache-wicket.1842946.n4.nabble.com/file/t375760/dropdown_list_es.png>
>
>
>However, the choices object carries the key instead of the value in the
>backend.
>
>Is there anything I miss to code for the DropDownChoice?  The choices
>need
>to carry the exact values.
>
>
>
>--
>Sent from:
>http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to