Thx Udo but look at the NB of my first message ---> NB : I'm trying not to use 
the locale parameter of the f:view tag
This solution works (I've tried it) but not so clean in my opinion.

The use of 
FacesContext.getCurrentInstance().getFacesContext().getViewRoot().setLocale(l) 
should work as it work in the myfaces1.0.9 examples.

Anybody ? Other ideas ?

Thx again Udo
Regards, Clément


-----Message d'origine-----
De : Udo Schnurpfeil [mailto:[EMAIL PROTECTED] 
Envoyé : vendredi 26 août 2005 15:20
À : MyFaces Discussion
Objet : Re: TR : Dynamic Locale change


If you set the locale in the UIViewRoot manually, I don't know if it 
will be passed on to the next UIViewRoot.

One solution for you might be putting the users locale in the session 
(e.g. the key "locale" or "user.locale" if your have a user object) and 
use the locale attribute <f:view locale="#{locale}"> or <f:view 
locale="#{user.locale}"> on all of your JSF pages.

regards,

Udo

Clément Maignien wrote:

> 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.

Reply via email to