Satellite TV for PC
Noadware.net - Spyware/Adware Remover
Get Google Ads Free

Monday, October 02, 2006

C# Localization/Multilingual


private CultureInfo english = new CultureInfo("en");
private CultureInfo french = new CultureInfo("fr");
private CultureInfo india = new CultureInfo("hi");
private CultureInfo chinese = new CultureInfo("zh-CHT");

private void radioEnglish_CheckedChanged(object sender, EventArgs e)
{
if (sender == radioEnglish)
{
setCulture(english);
}
else if (sender == radioChinese)
{
setCulture(chinese);
}
else if (sender == radioFrench)
{
setCulture(french);
}
else if (sender == radioHindi)
{
setCulture(india);
}
}


private void setCulture(CultureInfo culture)
{
System.Resources.ResourceManager rm = new System.Resources.ResourceManager(GetType());

System.Threading.Thread.CurrentThread.CurrentUICulture = culture;

button1.Text = rm.GetString("button1.Text");
this.Text = rm.GetString("$this.Text");
}