osseed / com.osseed.eventcalendar

CiviCRM Event Calendar
GNU General Public License v3.0
11 stars 37 forks source link

Add locale support #77

Closed samuelsov closed 4 years ago

samuelsov commented 4 years ago

The calendar should use the locale parameters of the site:

I was able to do a quick fix by adding locale-all.min.js file from fullcalendar.io and adding the following parameters to the fullcalendar constructor :

samuelsov commented 4 years ago

My quick fix:

diff --git a/CRM/Eventcalendar/Page/ShowEvents.php b/CRM/Eventcalendar/Page/ShowEvents.php
index dca7725..87bb1ac 100755
--- a/CRM/Eventcalendar/Page/ShowEvents.php
+++ b/CRM/Eventcalendar/Page/ShowEvents.php
@@ -40,6 +40,7 @@ class CRM_Eventcalendar_Page_ShowEvents extends CRM_Core_Page {
   function run() {
     CRM_Core_Resources::singleton()->addScriptFile('com.osseed.eventcalendar', 'js/moment.js',5);
     CRM_Core_Resources::singleton()->addScriptFile('com.osseed.eventcalendar', 'js/fullcalendar.js',10);
+    CRM_Core_Resources::singleton()->addScriptFile('com.osseed.eventcalendar', 'js/locale-all.min.js',11);
     CRM_Core_Resources::singleton()->addStyleFile('com.osseed.eventcalendar', 'css/civicrm_events.css');
     CRM_Core_Resources::singleton()->addStyleFile('com.osseed.eventcalendar', 'css/fullcalendar.css');

diff --git a/templates/CRM/Eventcalendar/Page/ShowEvents.tpl b/templates/CRM/Eventcalendar/Page/ShowEvents.tpl
index 5eb2455..78eaabd 100755
--- a/templates/CRM/Eventcalendar/Page/ShowEvents.tpl
+++ b/templates/CRM/Eventcalendar/Page/ShowEvents.tpl
@@ -61,7 +61,8 @@ function buildCalendar( ) {
     ],
     displayEventTime: showTime ? 1 : 0,
     firstDay:weekStartDay,
-    timeFormat: 'h(:mm)A',
+    timeFormat: 'H(:mm)',
+    locale: 'fr',
     header: {
       left: 'prev,next today',
       center: 'title',
osseed commented 4 years ago

@samuelsov Thanks we will try to add this feature in next relase.

fossil-free commented 3 years ago

Is there any progress yet on the locale issue?

I couldn't find an option yet in my installation (Event Calendar 4.1 on a Wordpress CiviCRM 5.29.0)