Search code examples
c#wpflocalizationresourcesresx

Run my C# application in different language


I have an application which I am trying to run and display in a language other than English which is the default language. I have assigned all text to use property files and have the relevant property files translated for each language.

However, when I run the application it is all English. I have set my keyboard, language, locale all to a foreign language and it should automatically pick this up and use the relevant property file automatically, however this is not happening.

I know there is not an awful lot of information there, but if you need any more i will provide. I am running the application from Visual studio 2010, so was wandering if this could affect it.

My files :

Strings.resx
Strings.en.resx
Strings.fr.resx

My usage:

Strings.HelloWorld

Solution

  • You have to get the current culture from the OS and use it as such:

    Basically what you need to do is set your current culture of your application somewhere:

    Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentCulture;
    

    Related: How to set Silverlight CurrentUICulture/CurrentCulture correctly?