I am trying to add specific monthly names for a specific locale. The problem I have is related to the locale for the Norwegian wine glass (nb), the names of the months returned by SimpleDateFormat are not Norwegians in English. However, locale (no) seems to work fine
eg. This code works 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()));
}
against this code which leads to 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 that I can configure SimpleDateFormat with specific DateFormatSymbols, but this does not help to maintain common code for any future locals. I was wondering if anyone knows how to change the default month values ​​for a supported java locale? I decided that there would be a resource file that I could add, but could not figure out how to do this.