Using localization and language properties I translated my form1.
In the Form1_Load event, I want to set text for labels, buttons, etc.
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 does not work, it always selects the "default / fallback" English lines (but the CultureInfo parameter is set). I donโt know at all whatโs wrong ... I used the same code in a new example application and worked in this small sample application. But in my real application this does not work.
There is also an explicit indication to ressourcemanager that Culture to use returns an English string instead of german:
MessageBox.Show(rm.GetString("button1.Text", new System.Globalization.CultureInfo("de")));
Any ideas?
source share