Reputation: 45961
I'm developing an application with ASP.NET 3.5 and I have read that the language that the application is shown in is the navigator's language.
Is there any way to choose the language of the application programmatically? For example, I want to see the application in English but my Internet Explorer is in Spanish.
The language is a user's preference stored in the database, so I need to change the language when the user logs in.
Upvotes: 1
Views: 10820
Reputation: 4232
You can use this <globalization culture="en-US" uiCulture="en-US"/>
in <system.web>
section of web.config.
Upvotes: 0
Reputation: 8382
You can also set it in web.config:
<configuration>
<system.web>
<globalization
requestencoding="utf-8"
responseencoding=" utf-8"
fileencoding=" utf-8"
culture="en-US"
uiculture="en-US" />
</system.web>
</configuration>
Or at the page level:
<%@ Page Culture="en-US" UICulture="en-US" ResponseEncoding="utf-8"%>
Upvotes: 0
Reputation: 285027
Are you asking how to change your browser's accept language? See http://windowshelp.microsoft.com/Windows/en-US/help/7b4a0825-28e2-4929-82f6-1feac4adb6f31033.mspx for instructions for IE 7 and IE 8. The section you want is "To add a language to Internet Explorer"
Upvotes: 0
Reputation: 21685
You can use the CultureInfo class to set the culture for your executing environment.
CultureInfo ci = new CultureInfo("en-US", false);
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;
Upvotes: 4