开发者

Localization settings after login doesn't work

开发者 https://www.devze.com 2023-03-14 12:45 出处:网络
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 chang

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消