What is the proper way to change Form language at runtime?
- Setting all controls manually using recursion like this
- Save language choice to file > Restart Application > Load languge
choice beforeInitializeComponent(); - Using Form constructor to replace instance of active from (if this is even possible)
- Something else
There is so much half written threads about this but none provides real answer on what is proper way to do this?
UPDATE:
To clarify my question:
Doing something like this:
public Form1()
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo("de");
this.InitializeComponent();
}
works fine and all my controls and everything else in resources get translated correctly.
And doing something like:
private void button1_Click(object sender, EventArgs e)
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");
}
does nothing, Form stays in language I set up before InitializeComponent();
I believe the solution shown in Hans Passant’s comment might be the only (general) solution.
Personally, I use this base class for all forms that need to be localized:
Then instead of directly changing Thread.CurrentThread.CurrentUICulture, I use this property in static manager class to change UI culture: