Here it goes another piece of source code which I did for spelling month name by it's number and language ID.
Hopefully it would save you same time.
/// <summary>
/// Spell month name in selected language.
/// </summary>
/// <param name="Month">int</param>
/// <param name="Language">string</param>
/// <returns>string</returns>
public static string SpellMonth(int Month, string Language)
{
string MonthName = String.Empty;
if (Language == "en")
{
switch (Month)
{
case 1:
MonthName = "January";
break;
case 2:
MonthName = "February";
break;
case 3:
MonthName = "March";
break;
case 4:
MonthName = "April";
break;
case 5:
MonthName = "May";
break;
case 6:
MonthName = "June";
break;
case 7:
MonthName = "July";
break;
case 8:
MonthName = "August";
break;
case 9:
MonthName = "September";
break;
case 10:
MonthName = "October";
break;
case 11:
MonthName = "November";
break;
case 12:
MonthName = "December";
break;
default:
break;
}
}
else if (Language == "af")
{
switch (Month)
{
case 1:
MonthName = "Januarie";
break;
case 2:
MonthName = "Februarie";
break;
case 3:
MonthName = "Maart";
break;
case 4:
MonthName = "April";
break;
case 5:
MonthName = "Mei";
break;
case 6:
MonthName = "Junie";
break;
case 7:
MonthName = "Julie";
break;
case 8:
MonthName = "Augustus";
break;
case 9:
MonthName = "September";
break;
case 10:
MonthName = "Oktober";
break;
case 11:
MonthName = "November";
break;
case 12:
MonthName = "Desember";
break;
default:
break;
}
}
else if (Language == "mk")
{
switch (Month)
{
case 1:
MonthName = "Јануари";
break;
case 2:
MonthName = "Февруари";
break;
case 3:
MonthName = "Март";
break;
case 4:
MonthName = "Април";
break;
case 5:
MonthName = "Мај";
break;
case 6:
MonthName = "Јуни";
break;
case 7:
MonthName = "Јули";
break;
case 8:
MonthName = "Август";
break;
case 9:
MonthName = "Септември";
break;
case 10:
MonthName = "Октомври";
break;
case 11:
MonthName = "Ноември";
break;
case 12:
MonthName = "Декември";
break;
default:
break;
}
}
else if (Language == "es")
{
switch (Month)
{
case 1:
MonthName = "enero";
break;
case 2:
MonthName = "febrero";
break;
case 3:
MonthName = "marzo";
break;
case 4:
MonthName = "abril";
break;
case 5:
MonthName = "mayo";
break;
case 6:
MonthName = "junio";
break;
case 7:
MonthName = "julio";
break;
case 8:
MonthName = "agosto";
break;
case 9:
MonthName = "septimebre";
break;
case 10:
MonthName = "octubre";
break;
case 11:
MonthName = "noviembre";
break;
case 12:
MonthName = "diciembre";
break;
default:
break;
}
}
else if (Language == "bg")
{
switch (Month)
{
case 1:
MonthName = "януари";
break;
case 2:
MonthName = "февруари";
break;
case 3:
MonthName = "март";
break;
case 4:
MonthName = "април";
break;
case 5:
MonthName = "май";
break;
case 6:
MonthName = "юни";
break;
case 7:
MonthName = "юли";
break;
case 8:
MonthName = "август";
break;
case 9:
MonthName = "септември";
break;
case 10:
MonthName = "октомври";
break;
case 11:
MonthName = "ноември";
break;
case 12:
MonthName = "декември";
break;
default:
break;
}
}
else if (Language == "ru")
{
switch (Month)
{
case 1:
MonthName = "январь";
break;
case 2:
MonthName = "февраль";
break;
case 3:
MonthName = "март";
break;
case 4:
MonthName = "апрель";
break;
case 5:
MonthName = "май";
break;
case 6:
MonthName = "июнь";
break;
case 7:
MonthName = "июль";
break;
case 8:
MonthName = "август";
break;
case 9:
MonthName = "сентябрь";
break;
case 10:
MonthName = "октябрь";
break;
case 11:
MonthName = "ноябрь";
break;
case 12:
MonthName = "декабрь";
break;
default:
break;
}
}
return MonthName;
}
No comments:
Post a Comment