开发者

Accessing A CultureInfo setting (locale)?

开发者 https://www.devze.com 2023-03-17 06:03 出处:网络
If I set a user\'s culture info in Global.asax such that strCulture is the locale \"en-US\": System.Threading.Thread.CurrentThread.Curre开发者_JS百科ntCulture

If I set a user's culture info in Global.asax such that strCulture is the locale "en-US":

System.Threading.Thread.CurrentThread.Curre开发者_JS百科ntCulture
    = new System.Globalization.CultureInfo(strCulture);

System.Threading.Thread.CurrentThread.CurrentUICulture
    = new System.Globalization.CultureInfo(strCulture);

then how do I access the culture i set elsewhere in the application (after login)?

Thanks.


I spent much consideration before posting this as well, but as Peter mentioned earlier in the comment I can't really come up with a better way then using CurrentUICulture.

CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;

If that's not what you are looking for, please give us more information. :)

0

精彩评论

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