Question

Using:

Console.WriteLine(System.Globalization.CultureInfo.CurrentCulture.ToString());

I get "en-US".

What should I change in my control panel settings ( Region and Language ? ) to get something else for example "en-CA" .

Was it helpful?

Solution 2

In my experience, the culture was set by the version of the operating system. Not really a setting in the control panel. We used to have to have multiple VM's running multiple version of Windows to test our cultural based features

OTHER TIPS

What should I change in my control panel settings ( Region and Language ? ) to get something else for example "en-CA" .

You can change it for current thread like:

System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-CA");

and then:

Console.WriteLine(System.Globalization.CultureInfo.CurrentCulture.ToString());

would return:

en-CA

you could just define a key in your App.config like this

<configuration>
    <appSettings>
        <add key="DefaultCulture" value="en-CA" />
    </appSettings>
</configuration>

and in your application read that value and set the culture

 CultureInfo culture = new CultureInfo(ConfigurationManager.AppSettings["DefaultCulture"]);
    Thread.CurrentThread.CurrentCulture = culture;
    Thread.CurrentThread.CurrentUICulture = culture;

You can change the language in the Region and Language control panel. Choose English (Canada) from the drop-down combo box labeled Format. Note that this will apply for the user and is the User Locale.

As a side note, starting with Windows 8, the user locale defaults to whatever your Windows display language is and Windows Store apps make use of the language list to align the language that is used for producing date and time strings and number formatting, etc., with the language that is used for retrieving resources. .Net attempts to participate in this, so for Windows Store Apps, changing the language list is the preferred way to get this effect.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top