I am working on the .NET Framework C# Windows form application which needs to display some languages and corresponding voices for each language, and I need to make sure that languages are displaying using user’s display language.
My Windows display language has been set to Serbian, but CultureInfo.DisplayName displays the English language names.
I was trying to set the CurrentUICulture to Serbian programatically in the app, but it also displays the English language names.
All of my windows forms have Localizable property set to true, and when I create resources.sr.resx and localize all strings into Serbian, the app shows the localized strings, but languages are also displayed in English.
My function looklikes so:
public List<string> GetLanguageNames()
{
var LanguageNamesList = new List<string>();
foreach (var Language in LanguageArray["languages"])
{
var cultureinfo = new CultureInfo(Language["lang2code"].ToString());
string LanguageName = cultureinfo.DisplayName + " " + "(" + cultureinfo.Name + ")";
LanguageNamesList.Add(LanguageName);
}
return LanguageNamesList;
}
When I run the app, it displays languages such:
English (en), Czech (cs), German (de), instead Engleski (en), Češki (cs), Nemački (de)
When I try to display NativeName instead the DisplayName, I am not satisfyed because app displays ach language using the original language name in that language, but I want all languages to be localised using the user’s UICulture. I was trying to set a different UICultures, but in all cases language names are displayed in English, but UI cultures works.
Where is the problem?
Best regards,
Darko