Change language (culture) during runtime (C#)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alexis4
    New Member
    • Dec 2009
    • 113

    Change language (culture) during runtime (C#)

    Hi!

    I would like to create a multilanguage project in C#. I created a test project for that, with a simple form that contains just one button. I want the button to have an english text on it when english language is selected, and a greek text when greek language is selected. After I changed the "Localizabl e" property to true, I selected the two languages and two resource files were created, one for each language.

    What I accomplished so far, is to change the language before initialization:

    Code:
    public Form1()
    {
      Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
      //Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("el-GR"); 
    
      InitializeComponent();
    }
    What I want to do is change the language during runtime, when button is pressed:

    Code:
    private void button1_Click(object sender, EventArgs e)
    {
      //Code for language change should be placed here
    }
    Any suggestions?
    Thanks!
Working...