How does `MonthNames` work for different cultures?
When you call System.Globalization.DateTimeFormatInfo.CurrentI开发者_运维百科nfo.MonthNames
you get a list of Month Names based on the current culture. If I change the current thread culture to a different one I should be able to get the month names back in that language. This seems to be working for French, but not for Japanese. What do I need to do so that I can get Japanese Months back? Is there something that I need to install for the OS, or do I need to install a .NET addon?
This is working for me:
Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
foreach (var month in DateTimeFormatInfo.CurrentInfo.MonthNames)
{
Console.WriteLine(month);
}
I don't have anything special installed--at least, not that I know of!
The Wikipedia article on Japanese calendar has an explanation of the Arabic numeral format.
精彩评论