0

I am working on a small wpf application, and I a dropdown box to select the language.

Now I have an option in my dropdown box to select system default language. (In this case the language from the windows system).

Language dropdown

I used the following code to actually set the system default language:

System.Threading.Thread.CurrentThread.CurrentUICulture = CultureInfo.InstalledUICulture;

But it actually always give back English even when I select French as my main windows language.

What is the correct way to actually change this.

kevingoos
  • 3,785
  • 4
  • 36
  • 63
  • Could you put a breakpoint on the final `else` and check what `language`'s value is? – Keyur PATEL Sep 14 '16 at 09:04
  • @KeyurPATEL When I select system default it only comes in the first else, and there CultureInfo.InstalledUICulture will not give the correct value. – kevingoos Sep 14 '16 at 09:13
  • @KeyurPATEL I removed the code to make the question clearer. – kevingoos Sep 14 '16 at 09:14
  • Not sure if its relevant, but [What is the difference between CurrentCulture and CurrentUICulture properties of CultureInfo in .NET?](http://stackoverflow.com/questions/329033/what-is-the-difference-between-currentculture-and-currentuiculture-properties-of) – Keyur PATEL Sep 14 '16 at 09:22
  • @KeyurPATEL yea I know that part :) it is really about the installedUICulture not giving the correct windows language – kevingoos Sep 14 '16 at 09:43
  • Then it might actually be a bug. My last attempt at a suggestion: "So you must set the culture before the InitializeComponent method is called.", which I saw from [How to: Set the Culture and UI Culture for Windows Forms Globalization ](https://msdn.microsoft.com/en-us/library/b28bx3bh%28VS.80%29.aspx?f=255&MSPPError=-2147217396) – Keyur PATEL Sep 14 '16 at 10:07

0 Answers0