1

I have a window based application in C#. I am trying to do this for some another language, say arabic.

As we know there is resource file for each form. I have created a global resource file as ResouceFileName.ar-SA.resx . Now I want to change all labels dynamically when I change CultureInfo. If i write in designer file like

static class clsLocalization
{ 
    static  ResourceManager  resManager = new ResourceManager(typeof(Secure_Browser_CS_Version.Properties.Resources));

    public static void applyGlobalResources(Control control,string resource)
    {
        System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ar-SA");
        control.Text=resManager.GetString(resource);
    }
}

// Resource file 
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SBMainForm));//Default

//
// settingHdrLbl
// 
resources.ApplyResources(this.settingHdrLbl, "settingHdrLbl");
clsLocalization.applyGlobalResources(this.settingHdrLbl, "settingHdrLbl");
this.settingHdrLbl.BackColor = System.Drawing.Color.Transparent;
this.settingHdrLbl.Name = "settingHdrLbl";

This will be reload as default whenever i change in designer file. Pl help me out

Jason Evans
  • 28,906
  • 14
  • 90
  • 154
Sonam Mohite
  • 885
  • 4
  • 19
  • 51
  • possible duplicate of [How do I change the culture of a WinForms application at runtime](http://stackoverflow.com/questions/7556367/how-do-i-change-the-culture-of-a-winforms-application-at-runtime) – kjbartel Oct 10 '14 at 12:39

0 Answers0