How do I change the culture of a WinForms application at runtime

This worked:

private void button1_Click(object sender, EventArgs e)
{
    System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-BE");
    ComponentResourceManager resources = new ComponentResourceManager(typeof(Form1));
    resources.ApplyResources(this, "$this");
    applyResources(resources, this.Controls);
}

private void applyResources(ComponentResourceManager resources, Control.ControlCollection ctls)
{
    foreach (Control ctl in ctls)
    {
        resources.ApplyResources(ctl, ctl.Name);
        applyResources(resources, ctl.Controls);
    }
}

Be careful to avoid adding whistles like this that nobody will ever use. It at best is a demo feature, in practice users don’t change their native language on-the-fly.

Leave a Comment