I am trying to add specific month names for a particular locale. The issue I have is with locale for norwegian bokmal (nb) the names of the months returned by SimpleDateFormat are in English not norweigan. However it seems that locale (no) works fine
e.g. This code results in January, February, etc.
String pattern = "MMMM";
DateFormat monthFormat = new SimpleDateFormat(pattern, new Locale("nb"));
Calendar cal = Calendar.getInstance();
for (int i = 0; i < 12; i++) {
cal.set(Calendar.MONTH, i);
System.out.println(monthFormat.format(cal.getTime()));
}
vs this code which results in Januar, Februar etc
String pattern = "MMMM";
DateFormat monthFormat = new SimpleDateFormat(pattern, new Locale("no"));
Calendar cal = Calendar.getInstance();
for (int i = 0; i < 12; i++) {
cal.set(Calendar.MONTH, i);
System.out.println(monthFormat.format(cal.getTime()));
}
I know I can configure SimpleDateFormat with a specific DateFormatSymbols however this doesn't help keep my code generic for any future locals. I was wondering if anyone knows how to modify the default month values for a supported java locale? I figured there would be a resource file I could add but couldn't figure out how.