question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Schedule: Locales not fully respected

See original GitHub issue

All European locales have first day of the week Monday [link]. But e.g. Norwegian is stariting by Sunday (søn.) in p:schedule component, which is wrong.

All, except EN schould be Mon:

PF version EN DE SV NO
8.0 Sun Mon Mon Sun
8.0.2 Sun Mon Mon Sun
8.0.5 Sun Mon Mon Sun
snapshot* Sun Sun Sun Sun

(*) primefaces-master-6_1-gf9d6444-4838.jar

  • FullCalendar demo is working correctly: https://fullcalendar.io/docs/locale-demo. E.g if I choose “nb” locale (nb - Norwegian Bokmål, nn - Norwegian Nynorsk), then week starts by monday (man.).

  • Setting of p:schedule weekNumberCalculation to “ISO” does not help, even if FullCalendar is saying “If weekNumberCalculation is set to ‘ISO’, this option defaults to 1 (Monday)”. https://fullcalendar.io/docs/firstDay

XHTML

<p:schedule id="myCalendarId"
			view="agendaWeek"
			rightHeaderTemplate="false"
			value="#{scheduleController.eventModel}"
			locale="#{scheduleController.locale}"
			timeZone="#{scheduleController.timeZone}"
			clientTimeZone="#{scheduleController.clientTimeZone}"
			weekNumberCalculation="local"
			showWeekends="true"
			allDaySlot="false"
			aspectRatio="1.2"
			timeFormat="HH:mm">
</p:schedule>

ScheduleController.java

private static final String clientTimeZone = "local";

private static final Locale LOCALE_EN_US = new Locale("en", "US");
private static final Locale LOCALE_DE_DE = new Locale("de", "DE");
private static final Locale LOCALE_SV_SE = new Locale("sv", "SE");
private static final Locale LOCALE_NO_NO = new Locale("no", "NO");

public static final ZoneId ZONE_ID_UTC = ZoneId.of("UTC");
public static final ZoneId ZONE_ID_BERLIN = ZoneId.of("Europe/Berlin");
public static final ZoneId ZONE_ID_STOCKHOLM = ZoneId.of("Europe/Stockholm");
public static final ZoneId ZONE_ID_OSLO = ZoneId.of("Europe/Oslo");

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
mellowarecommented, Nov 11, 2020

I added an Integration Test to our suite so this is caught in the future.

    @Test
    @Order(4)
    @DisplayName("Schedule: GitHub #6496 locale switching")
    public void testLocales(Page page) {
        // Arrange
        assertButton(page, "fc-today-button", "Current Date");
        assertButton(page, "fc-dayGridMonth-button", "Month");
        assertButton(page, "fc-timeGridWeek-button", "Week");
        assertButton(page, "fc-timeGridDay-button", "Day");

        // Act
        page.buttonFrench.click();

        // Assert
        assertButton(page, "fc-today-button", "Aujourd'hui");
        assertButton(page, "fc-dayGridMonth-button", "Mois");
        assertButton(page, "fc-timeGridWeek-button", "Semaine");
        assertButton(page, "fc-timeGridDay-button", "Jour");
        assertConfiguration(page.schedule.getWidgetConfiguration());
    }
1reaction
mellowarecommented, Nov 10, 2020

OK I found the problem and fixed it. the locales need to be added now for FullCalendar to be aware of them

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Programs not respecting locales - Unix & Linux Stack Exchange
Programs have to be written to respect the locale. For example if I write #!/bin/sh echo hello. and I run it with a...
Read more >
Why is my "locale" not respecting default locale? - ubuntu
"Default" implies that there are other, higher-priority settings which locale respects first. The locale is not read directly from /etc/default ...
Read more >
date() does not respect the current locale, while strftime() does
So what you're seeing is expected behavior. Use strftime() for locale formatted dates, and date() when that is not necessary.
Read more >
Locale - ArchWiki
Locales are used by glibc and other locale-aware programs or libraries for rendering text, correctly displaying regional monetary values, ...
Read more >
Locales and Resources | ICU Documentation
The locale mechanism does not require a program to know which locale the user is ... The variant code is arbitrary and completely...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found