Read Browser Language Settings to set Application Culture

The GetBrowserLanguages method in the BasePage class returns all the languages set for the client-side web browser.  Override the SetPageCulture method in your page and call GetBrowserLanguages to retrieve the browser languages.  Then, set the values of:

System.Threading.Thread.CurrentThread.CurrentUICulture

System.Threading.Thread.CurrentThread.CurrentCulture

using the first value in list of browser languages.  GetBrowserLanguages returns languages in the order in which they are set in the browser.

The disadvantage of this approach is that application users in an uncontrolled environment like a web café may have web browsers set to languages not of their choosing, and there may be no way for the user to set the application culture of their choice.

See Also

Creating a Multi-Lingual Application

Localizing (Internationalizing) Your Application