I would like to provide a h:selectOneMenu in many languages. In fact just the first element of the box has to be in many languages. This element label is "no choice". The rest of the element are dynamically retrieved from a data base and can be anything. So they don't have to be translated. I have set the resource key in the model that builds the list items and that key just gets displayed as it is.
public List<SelectItem> getItems() {
List<SelectItem> items = new ArrayList<SelectItem>();
// add other items to the list
// code has been removed
items.add(0, new SelectItem("null", "#{messages.no_choice}"));
return items;
}
I have read other which suggest to do as follows:
<h:selectOneMenu value="#{bean.orderStatus}">
<f:selectItems value="#{bean.orderStatuses}" var="orderStatus"
itemValue="#{orderStatus}" itemLabel="#{msg[orderStatus.name]}" />
but this can't work for as only one element in my list is meant to be translatable.
Thanks