This content has been marked as final. Show 2 replies
Usually, when you go to a page that requires authentication, you get your login page. On successful authentication, you are then redirected to your original request. If this fits your usecase, then the control will be re-rendered automatically. Depending on how the locales are done, the supporting data controls or bean may need to be refreshed. You may need to just set the current local like you have done. The only thing I can think of is that you are getting a new instance of the locale manager for some reason? You might be able to debug it to find out. You just need to add the source to your project and away you go.
Interested to hear how you make out.
I believe the problem is because in the JHeadstart LocaleManager.changeLocale method that is called from the valueChangeEvent, the list of support locales is being cleared - this ensures that on redirection that the current list is repopulated, and this time with the correct language applied to the locale names.
When I am changing the locale from my createUserContext method I can't call the changeLocale method and am just calling the setCurrentLocale method - which skips the important "this.supportedLocales = null;" line. There is no public setter for the supportedLocales list.
Got this working by creating my own class extending LocaleManager - overriding getInstance, private list supportedLocales and associated getter/setter methods - then in my createUserContext added
And now it works :) As the supportedLocales is cleared out, when login redirects user to home page, the list is rebuilt in the correct language
<managed-bean id="__73"> <managed-bean-name id="__74">jhsLocaleManager</managed-bean-name> <managed-bean-class id="__75">hmdclinical.pulse.controller.jsf.bean.HMDLocaleManager</managed-bean-class> <managed-bean-scope id="__76">session</managed-bean-scope> </managed-bean> HMDLocaleManager.getInstance().setCurrentLocale(new Locale(userLocaleStr)); HMDLocaleManager.getInstance().setSupportedLocales(null);