Hello, I'm trying to internationalize with labels coming from an enum:
public enum WeekDay {
MONDAY("msg.week_monday", "mon"),
TUESDAY("msg.week_tuesday", "tue"),
WEDNESDAY("msg.week_wednesday", "wed"),
THURSDAY("msg.week_thursday", "thu"),
FRIDAY("msg.week_friday", "fri"),
SATURDAY("msg.week_saturday", "sat"),
SUNDAY("msg.week_sunday", "sun");
private String label;
private String value;
private WeekDay(String label, String value) {
this.label = label;
this.value = value;
}
public String getLabel() {
return label;
}
public String getValue() {
return this.value;
}
}
And I call the page like this:
<f:selectItems value="#{myMB.weekDays}"
var="dayWeek" itemValue="#{dayWeek}"
itemLabel="#{dayWeek.label}" />
But the result is the labels literals and not their corresponding in my msg.properties file:
week_monday=Segunda-feira
week_tuesday=Ter\u00E7a-feira
week_wednesday=Quarta-feira
week_thursday=Quinta-feira
week_friday=Sexta-feira
week_saturday=S\u00E1bado
week_sunday=Domingo
When I call this way itemLabel="#{msg.week_monday}"
works, does anyone know how to do it? I'm trying the same problem trying to translate fields from the bank.