internationaling: changing locale from the header
Hello all, happy new year!
I am facing this problem: I have a page fragment with italiano/english links to switch betweeen it_IT and en_Us locales, using
public String italianoHyperlink_action(){
Locale locale =new Locale("it","IT");
FacesContext.getCurrentInstance().getViewRoot().setLocale(locale);
returnnull;
}
The issue is: how can I set up a dropdown list with string in the correct language? If I do this in the code adding the proper options to the list with something like
Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
ResourceBundle bundle = ResourceBundle.getBundle("mypackage/Bundle", locale);
myMenu.add(new Option(bundle.getString(key), value))
I have to refresh the page after clicking on the header links, because the page fragment code is executedafter the rest of the code and the locale is switchedafter the dropdown list is rendered.
Do you see any workaround for this?
thanks in advance
Mauro

