I have a strange behaviour in my WPF application using resources (.resx) for localization.
In Properties I created a new folder named Resources where I put my resx file. I created two files named Resources.resx and Resources.it-IT.resx.
In App class I did the overriede of method OnStartup:
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
Thread.CurrentThread.CurrentUICulture = new CultureInfo("it-IT");
}
What I expect is that the application starts in italian but starts in english (default in file Resources.resx).
I tried to change the name of resource for italian language from Resources.it-IT.resx to Resources.it.resx. Then I changed part where I set culture:
Thread.CurrentThread.CurrentUICulture = new CultureInfo("it");
In this way application starts in italian.
I don't understand were's the problem. Why culture info not works with it-IT? I already tried with methods CultureInfo.GetCultureInfo and CultureInfo.CreateSpecificCulture.
Furthermore, Thread.CurrentThread.CurrentUICulture is already set as italian, but if I don't create new CultureInfo it doesn't work. Why?
I already read this question but the problem is different. I can change culture but I would like to know why it works only with TwoLetterISOLanguageName.
I tried with french (fr-FR with file Resources.fr-FR.resx) language and there's no problems.