Calendar gui component locale (change days/months language)

Hi, I would like to set the locale for the Calendar ui component, so that days ‘Monday’ ‘Tuesday’, etc… are shown in another language.
The Vaadin calendar component has a setlocale method which can do this - how could I access this method for the Calendar Cuba component?

If this is not possible using the native Cuba component, would there be another way to change the days and months language easily?



Currently we do not have API that can solve your task, but you can unwrap CUBA component and set Locale to Vaadin calendar instance:

protected Calendar calendar;
// get Vaadin calendar from CUBA component
CubaCalendar vCalendar = calendar.unwrap(CubaCalendar.class);
vCalendar.setMonthNamesShort(null); // disable automatic month names
vCalendar.setDayNamesShort(null); // disable automatic day names
1 Like

Hi Yuriy,

Thank you for your answer and sample code!
This is an easy way to achieve what I want to do.

Best regards


Since the platform version 6.5.0, the following methods are available for the Calendar component.

Map<DayOfWeek, String> getDayNames();
void setDayNames(Map<DayOfWeek, String> dayNames);

Map<Month, String> getMonthNames();
void setMonthNames(Map<Month, String> monthNames);

So you can customize days and months programmatically.

public class EventBrowse extends AbstractLookup {

    private Calendar eventsCalendar;

    public void init(Map<String, Object> params) {
        Map<DayOfWeek, String> days = eventsCalendar.getDayNames();

        days.put(DayOfWeek.MONDAY, "Primidi");
        days.put(DayOfWeek.TUESDAY, "Duodi");
        days.put(DayOfWeek.WEDNESDAY, "Tridi");
        days.put(DayOfWeek.THURSDAY, "Quardidi");
        days.put(DayOfWeek.FRIDAY, "Quintidi");
        days.put(DayOfWeek.SATURDAY, "Sextidi");
        days.put(DayOfWeek.SUNDAY, "Septidi");



Good to know! Thanks for implementing and following up!!

:ticket: See the following issue in our bug tracker:

I think there is a bug with the allocation of Days. I have checked this in my own project and a sample project and happens in both. It appears to be doing this:
Sunday = Monday
Monday = Tuesday

View post