File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Changing the language permanently for a user Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Changing the language permanently for a user" Watch "Changing the language permanently for a user" New topic
Author

Changing the language permanently for a user

Stefan Berger
Greenhorn

Joined: Sep 13, 2011
Posts: 4
Hello,

I have a problem changing the language in a JSF 2 application. I use the code below to the change the language of the current page (e.g. from English to German) which works fine, but as soon as I navigate to another page, the original language (in my example English) is used again. How can I change the language permanently for a user?

My current code:


roby george
Ranch Hand

Joined: Sep 08, 2010
Posts: 31
i think you have to write this code in every page.
Stefan Berger
Greenhorn

Joined: Sep 13, 2011
Posts: 4
Hello,

thank you for your answer. The code I showed is inside the event handler of a button. So when the user presses the "German" button on the page, this code is executed. I do not want the user to press this button again on every page that he navigates to I think what happens is that as soon as the user navigates to another page, the browser local from the request is used again, but I did not find a way to set this locale.

Is there really no way to set the locale permanently for a user session?

Another question: Is it possible to get an event as soon as a page is displayed, then I could of course this code from this event handler, although I still think it would be nicer to set the locale permanently for a session.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Changing the language permanently for a user
 
Similar Threads
Dual language website with data from db
I18n problems with JSF
Struts + I18N
Locale Switching in Struts2
Bilingual display question