• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Changing the language permanently for a user

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:


 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic