Using Localization and Language Properties I have translated my Form1.
Within Form1_Load event I want to set the text for labels, buttons and so on...
private void Form1_Load(object sender, EventArgs e)
{
SetLanguage();
}
SetLanguage method:
private void SetLanguage()
{
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de");
System.Resources.ResourceManager rm = new System.Resources.ResourceManager(typeof(Form1));
button1.Text = rm.GetString("button1.Text");
linkLabel1.Text = rm.GetString("linkLabel1.Text");
checkBox1.Text = rm.GetString("checkBox1.Text");
}
But it is not working, it is always picking "default/fallback" english strings (but de CultureInfo is set). I have absolutely no idea whats wrong... I used the same code in a new sample application and it worked within this small sample application. But within my real application it does not work.
Also explicit telling ressourcemanager what Culture to use does return english string instead of german:
MessageBox.Show(rm.GetString("button1.Text", new System.Globalization.CultureInfo("de")));
Any ideas?