Allow user to influence which LanguageResources.resx is used
I am writing a web application using ASP.NET and I have utilized a global LanguageResources.re开发者_运维技巧sx file for multilingual capabilities. My problem is that I don't want the framework to automatically detect the language and use the appropriate LanguageResources.??.resx for loading the views.
I would like the user to select the language that they would like to view the site in, or at least allow the user to override the 'guess' that .net has made for me.
What's the best way to explicitly specify which resource file to use?
Set the value of the Thread.CurrentThread.CurrentCulture:
Thread.CurrentThread.CurrentCulture =
new CultureInfo("en");
Replace the "en" by the selected value from the languages list.
Refer to the following article:
Multilingual applications using C#
精彩评论