1

i am building an installer to a program which must have the system locale to be "en-US".

i am able to read the current state using the following line:

CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture

but when I tried to change it, it does not work. this is how I try to change it:

if (!currentCulture.Name.Equals("en-US"))
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

any suggestions how to do it properly? (the servers which i am going to use this installer on are only win-2012 servers).

thank you.

Omer
  • 21
  • 1

1 Answers1

0

The current culture is divided in two:

  1. Current culture
  2. Current UI culture

In order to fully change the culture you must change both of them.

Read the MSDN post about this.

Botea Bogdan
  • 192
  • 3
  • 16
  • I change both of them, still after the code is done, in the next run the system locale returns to the origin. – Omer Oct 08 '15 at 12:10
  • The system locale always returns to the locale origin on restart, but you must override the current culture every time in the entry point of the application. But in this case why don't you use Invariant Culture? – Botea Bogdan Oct 08 '15 at 12:27
  • Botea Bogdan may you please explain more what do you mean about "Invariant Culture"? – Omer Oct 08 '15 at 12:49
  • I can, but is faster for you to read [this post](http://stackoverflow.com/questions/5060446/difference-between-currentculture-invariantculture-currentuiculture-and-instal). If you have other questions just ask :) – Botea Bogdan Oct 08 '15 at 12:57