I have dotnetnuke application and I made a custom login module. And everything works fine except loading user proff开发者_高级运维ered locale. If user default language is set to German I want to change language from english to german after login. I write this code bellow but it works on my local instalation but not on the real server :(
string p = this.UserInfo.Profile.PreferredLocale;
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(p);
DNN handles changing the locale for you; you shouldn't need to do this (and are probably running into conflicts with DNN when you do).
Go to the Languages page under the Admin menu, and make sure that all of your supported languages are enabled, and all of the settings match what you expect.
Ha, I get it :)
string lang = objUser.Profile.PreferredLocale;
Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId, true, this.PortalSettings, String.Empty, lang), true);
I must admit I haven't worked with DNN so far, but if you just want to avoid it you might want to just save the chosen culture (i.e. the IETF-Tag) in a Session-Variable and create a Class inheriting Page
which all your pages implement that overrides InitializeCulture
and sets the CurrentCulture
and CurrentUICulture
.
精彩评论