Hello,Can anyone help me how to switch/change the language dynamically based on user profile.
I have a column in the users table and this is simply to retrieve: CurrentUserInfo(“user_language_id”).My issue is where to force the default language for the logged user (based on his preferences, for which I have set-up a profile page).I have tried out
Session.SetValue(Config.SessionLanguageId, “en”);
Session[Config.SessionLanguageId] = “en”;
CurrentLanguage = “en”;It seems that CurrentLanguage will do the trick, as in the language menu it gets selected even if I have set-up as a default language, something else.
The default page is a custom page named "Home"I have tried out to force a different language in Page_Loading, Language_Load, User_CustomValidate and even in User_LoggedIn event of the Login page.
The site loads with the default language as it is set-up in the config of the project.Regards
Session[Config.SessionLanguageId] = Convert.ToString(CurrentUserInfo(“user_language_code”)); placed in Page_Loading() will load the default page with the default language set in the project, but a refresh/click on any link will switch it to the new language.
So, it seems that it must be loaded earlier.
You should just set the session variable when the user logged in, e.g. in User_LoggedIn or User_Validated server event.
Thanks MichaelG,User_Validated did the trick, as we’re using Windows Integrated Auth.Regards