You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Clément Maignien <c....@edic-syliance.com> on 2005/08/22 18:17:32 UTC

Dynamic Locale change

Hi,
I'm trying to allow the application user to change the language of my web app.
I did it the way it is done in the myFaces 1.0.9 examples : a selectOneMenu with a choice of languages and an action button with that code :
 
OptionBean {
...
public String action {
    ...
    FacesUtil.setLocale(selectedLocale);
    ...
}
...
}
 
FacesUtil {
...
public static void setLocale(Locale l) {
    FacesContext.getCurrentInstance().getFacesContext().getViewRoot().setLocale(l);
}
 
...
}
 
 
It works fine when the action is executed (the language change), but as soon as I navigate to another page of the App, the language is resetted to the default one. Why ?
 
 
NB : I'm trying not to use the locale parameter of the f:view tag ...
 
Thx,
Clément.