Hi
I have question, how DatePicker component loads names of months and days.
I can’t find it in java code. I have correctly names in my language, but I don’t find
how cuba platform swaps out those values.
Hi
I have question, how DatePicker component loads names of months and days.
I can’t find it in java code. I have correctly names in my language, but I don’t find
how cuba platform swaps out those values.
Hi,
In fact, CUBA Platform doesn’t localize month names itself. All values are obtained using SimpleDateFormat
with the correct locale at the start of the application.
Regards,
Gleb
Hi
I don’t understand. May I get months names from class SimpleDateFormat ?
Sure, for instance you can use the following snippet to iterate over short and long month names:
Locale locale = Locale.ENGLISH;
Calendar c = Calendar.getInstance(locale);
c.set(2018, 0, 1);
SimpleDateFormat shortMonthFormat = new SimpleDateFormat("MMM", locale);
SimpleDateFormat longMonthFormat = new SimpleDateFormat("MMMM", locale);
int monthsInYear = c.getMaximum(Calendar.MONTH) + 1;
for (int month = 0; month < monthsInYear; month++) {
c.set(Calendar.MONTH, month);
String shortMonth = shortMonthFormat.format(c.getTime());
String longMonth = longMonthFormat.format(c.getTime());
// do something with the names
}
Thangs of lot for help !!