7

Need to change the system locale to a different country, I have tried SystemParametersInfo(), GetKeyboardLayout() which didn't help.

How would I change the system locale in C# for a console application?

2
  • 1
    are you using winform, wpf, asp.net? Commented Aug 3, 2011 at 12:01
  • No Brian am just trying it with a console application Commented Aug 3, 2011 at 12:28

2 Answers 2

3

e.g.,

 Thread.CurrentThread.CurrentCulture = new CultureInfo("es-AR"); // Espanol - Argentina Thread.CurrentThread.CurrentUICulture = new CultureInfo("es-AR");// Espanol - Argentina 

e.g,

 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); // English - US Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");// English - US 
Sign up to request clarification or add additional context in comments.

1 Comment

I think this will change at the application level but I need to change it at the system level. I mean I have all language packs installed and I want to make the current system locale to a specific locale. Do you have some solution for this
2

You can use SetLocalInfo.

[DllImport("kernel32.dll")] static extern bool SetLocaleInfo(uint Locale, uint LCType, string lpLCData); 

1 Comment

Thanks for the quick response bitbonk can you please give an example for suppose to set system locale to fr

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.