I wanted to have my app display
September 2014
in English locale and
2014年9月
in Chinese locale.
Are there any way in Java (especially, Java 1.6 in Android) can do this?
I am interesting in the "natural" way to display the year and the month in a specific culture. So English and Chinese cultures are just an example, and the solution shall work for all system supported cultures.
For the example above, if I have something like 9月 2014
I am sure every Chinese speaker will know what it means but it is just looked very odd in that culture. On the other hand, 2014年九月
is acceptable.
Attempts
The pattern for
SimpleDateFormat
need you to specify the order of year and month field. Since this is vary in different languages this is not going to solve it.If you try to bend the rule to allow displaying
2014, September
for English and2014年, 9月
for Chinese (this is acceptable, but2014, 9月
is still odd) and considerCalendar.getDisplayName
, unfortunately it returns null forCalendar.Year
.