ok risolto quel problema.
i file di properties vanno tra i Source Packages (parlando come netbeans).
quindi: com.mio.package.languange.messages ad esempio.
ho però un altro problema.
questo il managedbean:
codice:
@ManagedBean(name = "language", eager = true)
@SessionScoped
public class LanguageBean implements Serializable {
private static final long serialVersionUID = 1L;
private String locale;
private static Map<String, Object> countries;
static {
countries = new LinkedHashMap<String, Object>();
countries.put("Italiano", Locale.ITALIAN);
countries.put("English", Locale.ENGLISH);
}
public Map<String, Object> getCountries() {
return countries;
}
public String getLocale() {
return locale;
}
public void setLocale(String locale) {
this.locale = locale;
}
public void localeChanged(ValueChangeEvent e) {
String newLocaleValue = e.getNewValue().toString();
for (Map.Entry<String, Object> entry : countries.entrySet()) {
if (entry.getValue().toString().equals(newLocaleValue)) {
FacesContext.getCurrentInstance().getViewRoot().setLocale((Locale) entry.getValue());
}
}
}
}
sulla pagina poi:
codice:
<h:selectOneMenu value="#{language.locale}" onchange="submit()" valueChangeListener="#{userData.localeChanged}">
<f:selectItem value="#{language.countries}"/>
</h:selectOneMenu>
ma ottengo questo errore:
codice:
java.util.LinkedHashMap cannot be cast to javax.faces.model.SelectItem