Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Changing the language permanently for a user

 
Stefan Berger
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think you have to write this code in every page.
 
Stefan Berger
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic