Globalization is the process of designing and developing applications that function for multiple cultures.
To Load all cultureinformations in a combobox
using System.Globalization;
private void Form1_Load(object sender, EventArgs e)
{
CultureInfo[] cis = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
foreach (CultureInfo ci in cis)
ComboBox1.Items.Add(String.Format(ci.ToString()));
}
here first portion represents the Language Code and the second portion represents the Country Code.
To display DayNames and Month names corresponding to each culture
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
lstDetails.Items.Clear();
CultureInfo ci = new CultureInfo(comboBox1.Text);
lstDetails.Items.Add(ci.DisplayName.ToString());
lstDetails.Items.Add(ci.NativeName.ToString());
lstDetails.Items.Add("");
lstDetails.Items.Add("Day names");
string[] strDayNames = ci.DateTimeFormat.DayNames;
foreach (string strDay in strDayNames)
lstDetails.Items.Add(strDay);
lstDetails.Items.Add("");
lstDetails.Items.Add("Month Names");
string[] strMonthNames = ci.DateTimeFormat.MonthNames;
foreach (string strMonth in strMonthNames)
lstDetails.Items.Add(strMonth);
}
0 comments:
Post a Comment