I suggest you take a look at the list archives for "Maintain locale
across views".
I had a similar issue and it seems the locale is not maintained
across views when a <redirect/> is used.
In the end I set <f:view locale="#{visit.locale}">, where visit is a
session scoped bean.
Gianni
Sorry for asking so much questions but I'll have to present my
webapp very soon and I need the multi-language to works fine.
Has anybody any idea ? Why the locale is reset to the default
one ? Could it comes from a <redirect/> instruction in my faces-
config.xml ?
Ty for your help :D
Clément
-----Message d'origine-----
*De :* Clément Maignien
*Envoyé :* lundi 22 août 2005 18:18
*À :* MyFaces Discussion
*Objet :* 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.
- Re: TR : Dynamic Locale change giannidoe
-