Original issue 1244 created by codenameone on 2014-12-28T17:51:14.000Z:
What steps will reproduce the problem?
- Add translated (not English) weeks to the resource bundle (localization) like this: WEEKDAY_LONGNAME_MONDAY and and short weekdays like this: WEEKDAY_SHORTNAME_MONDAY
- Use DateFormatSymbols to use the localized weeks with SimpleDateFormat:
dateFormatSymbols.setResourceBundle(UIManager.getInstance().getResourceBundle());
simpleDateFormat.setDateFormatSymbols(dateFormatSymbols);
- Choose a format (for SimpleDateFormat) with short names of the weekdays.
What is the expected output? What do you see instead?
In my case: The long name is 'maandag' and the short name is 'ma'. I expect to see 'ma' when localizing they weekday. Instead, I see 'maa' (the first three characters of the weekday longname).
What version of the product are you using? On what operating system?
CN1 revision 1972. Linux, Netbeans 8, latest plugin.
Please provide any additional information below.
I think I found in the source what the problem is:
166 public String[] getShortWeekdays() {
167 synchronized (this) {
168 if (shortWeekdays == null) {
169 shortWeekdays = createShortforms(getWeekdays(), L10N_WEEKDAY_SHORTNAME);
170 }
171 }
172 return shortWeekdays;
173 }
I think on line 169, getWeekdays() should be WEEKDAYS.
Because now the localized weekdays are returned. I think it should be just like in getShortMonths():
public String[] getShortMonths() {
synchronized (this) {
if (shortMonths == null) {
shortMonths = createShortforms(MONTHS, L10N_MONTH_SHORTNAME);
}
}
return shortMonths;
}
As you can see, the createShortforms function now gets the MONTHS array instead of the localized months. This function behaves like it should.
Original issue 1244 created by codenameone on 2014-12-28T17:51:14.000Z:
What steps will reproduce the problem?
dateFormatSymbols.setResourceBundle(UIManager.getInstance().getResourceBundle());
simpleDateFormat.setDateFormatSymbols(dateFormatSymbols);
What is the expected output? What do you see instead?
In my case: The long name is 'maandag' and the short name is 'ma'. I expect to see 'ma' when localizing they weekday. Instead, I see 'maa' (the first three characters of the weekday longname).
What version of the product are you using? On what operating system?
CN1 revision 1972. Linux, Netbeans 8, latest plugin.
Please provide any additional information below.
I think I found in the source what the problem is:
166 public String[] getShortWeekdays() {
167 synchronized (this) {
168 if (shortWeekdays == null) {
169 shortWeekdays = createShortforms(getWeekdays(), L10N_WEEKDAY_SHORTNAME);
170 }
171 }
172 return shortWeekdays;
173 }
I think on line 169, getWeekdays() should be WEEKDAYS.
Because now the localized weekdays are returned. I think it should be just like in getShortMonths():
As you can see, the createShortforms function now gets the MONTHS array instead of the localized months. This function behaves like it should.