From 0bb02ae2bf767f5437621bcc7d648a5cf52f7d42 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 17 Jul 2023 07:50:55 +0200 Subject: [PATCH] Set the right locale to the fullcalendar instances --- application/core/EA_Controller.php | 2 ++ assets/js/app.js | 8 ++++++++ assets/js/utils/calendar_default_view.js | 9 +-------- assets/js/utils/calendar_table_view.js | 1 + 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/application/core/EA_Controller.php b/application/core/EA_Controller.php index e836d46f..3def9319 100644 --- a/application/core/EA_Controller.php +++ b/application/core/EA_Controller.php @@ -132,6 +132,8 @@ class EA_Controller extends CI_Controller { 'index_page' => config('index_page'), 'available_languages' => config('available_languages'), 'csrf_token' => $this->security->get_csrf_hash(), + 'language' => config('language'), + 'language_code' => config('language_code'), ]); } diff --git a/assets/js/app.js b/assets/js/app.js index c5b42262..dd4f485f 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -45,6 +45,14 @@ window.App = (function () { } $(document).ajaxError(onAjaxError); + + $(function() { + if (window.moment) { + window.moment.locale(vars('language_code')); + } + }) + + return { Components: {}, diff --git a/assets/js/utils/calendar_default_view.js b/assets/js/utils/calendar_default_view.js index 8d6aa567..b4d6e3ca 100755 --- a/assets/js/utils/calendar_default_view.js +++ b/assets/js/utils/calendar_default_view.js @@ -1448,6 +1448,7 @@ App.Utils.CalendarDefaultView = (function () { // Initialize page calendar fullCalendar = new FullCalendar.Calendar($calendar[0], { initialView, + locale: vars('language_code'), nowIndicator: true, height: getCalendarHeight(), editable: true, @@ -1461,14 +1462,6 @@ App.Utils.CalendarDefaultView = (function () { eventColor: '#7cbae8', slotLabelFormat: slotTimeFormat, allDayContent: lang('all_day'), - views: { - timeGridDay: { - dayHeaderFormat: columnFormat - }, - timeGridWeek: { - dayHeaderFormat: columnFormat - } - }, selectable: true, selectMirror: true, themeSystem: 'bootstrap5', diff --git a/assets/js/utils/calendar_table_view.js b/assets/js/utils/calendar_table_view.js index 29b49279..9aa4bc28 100755 --- a/assets/js/utils/calendar_table_view.js +++ b/assets/js/utils/calendar_table_view.js @@ -676,6 +676,7 @@ App.Utils.CalendarTableView = (function () { const firstWeekdayNumber = App.Utils.Date.getWeekdayId(firstWeekday); const fullCalendar = new FullCalendar.Calendar($wrapper[0], { + locale: vars('language_code'), initialView: 'timeGridDay', nowIndicator: true, height: getCalendarHeight(),