When you call System.Globalization.DateTimeFormatInfo.CurrentInfo.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?
views:
76answers:
1
+2
A:
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.
Dave
2009-12-07 20:34:25
For me it prints `1?`, `2?`, ..., `12?`
Fredrik Mörk
2009-12-07 20:37:31
1?, 2?...? Well, than your font can't display the kanji for month and therefore you see it as ?.
Maximilian Mayerl
2009-12-07 20:39:23
That's just a font issue. The default console font doesn't have those unicode characters defined, hence the ?. If you look at it using a font that supports the glyph (such as in the debugger, or use something like Lucida Sans Unicode in a windows forms app) you should see them.
Dave
2009-12-07 20:40:11
You might need to install japanese fonts. In japanese month names mean only sth like "first month", "second month", and therefore they are written as number+kanji for "month".
liori
2009-12-07 20:40:30