I have a WinForms app in .Net4 where I'm having problems implementing multiple languages.
Disclaimer: I have searched and found many questions about globalization/localization, but the vast majority are trying to do something unusual, or custom. I'm having trouble with the basic out of the box stuff. I have read the documentation, but am still having problems.
I have a WinForms app, the default language is English. I need to display it in French on french PCs, it could be either fr-FR
or fr-CA
, so I when I set the form to localizable:=True
, I changed the language to "French" and updated the labels, buttons, and other form controls. That part, I Think I've done correctly.
Form message boxes, I put all my strings into the resources file (by clicking my project, then the resources tab). I replaced the strings in code with references to my.ressource.{ressourcename}
I then added a new Resources.fr.resx
in the myproject folder and translated all the strings it contained.
I tried to test this by adding the following line to the new() constructor of my startup form.
Thread.CurrentThread.CurrentUICulture = New CultureInfo("fr")
I also tried:
Thread.CurrentThread.CurrentUICulture = New CultureInfo("fr-CA")
The application still loads in English, even the form controls which are set to the neutral language 'French'.
In summary, there are 4 questions:
- Am I going about this correctly?
- Have I created the French resource file correctly?
- Should the
Resources.fr.resx
file be in the My Project folder (along side the defaultResources.resx
, or should it be in the root? Or alternatively should I be using a new file likeMessageResources.resx
andMessageResources.fr.resx
and place both of those in the root? - How do I force the entire application to use French instead of default language?