CMS MADE SIMPLE FORGE

CGCalendar

 

[#11778] If language is fi, calendar view is empty

avatar
Created By: Tommi Saksa (urheat)
Date Submitted: Thu Mar 22 13:34:20 -0400 2018

Assigned To: Robert Campbell (calguy1000)
Version: 2.5.1
CMSMS Version: 2.2.7
Severity: Major
Resolution: Invalid
State: Open
Summary:
If language is fi, calendar view is empty
Detailed Description:
If the admin area language is English, the calendar view is visible (Content >
Calguys Calendar). But if the user uses Finnish, the calendar view is empty.
Haven't tested with other languages.


History

Comments
avatar
Date: 2018-03-22 14:03
Posted By: Robert Campbell (calguy1000)

insufficient information.   

      
avatar
Date: 2018-03-22 23:28
Posted By: Tommi Saksa (urheat)

And you tested the described scenario..? Please tell me what information you
need?
      
avatar
Date: 2018-04-05 04:00
Posted By: Ruud van der Velden (ruudvdvelden)

Reproduced by:
- adding Finnish language (Suomi) to CMSMS install
- select this language for backend
- open CGCalendar from Content menu (Kalenteri)
- note calendar won't display
- note error in console about unexpected ';' (because a value is missing)

Some javascript is missing values for date strings. This probably is because
json_encode fails encoding the malformed return of  get_locale_dates() (June and
July in Finnish contain 'special' chars)

Seems using utf8_encode() method for the strftime output (months in this
specific case) solves the issue.
But didn't test further.

/modules/CGCalendar/lib/class.cgcalendar_utils.php

final class cgcalendar_utils
{
    private function __construct() {}

    static public function get_locale_dates()
    {
        $out = array();
        $out['monthNames'] = array();
        $out['monthNamesShort'] = array();
        for( $i = 0; $i < 12; $i++ ) {
$out['monthNames'][] =
utf8_encode(strftime('%B',mktime(1,0,0,$i+1,1,2000)));
$out['monthNamesShort'][] =
utf8_encode(strftime('%b',mktime(1,0,0,$i+1,1,2000)));
        }

        $mod = cms_utils::get_module(MOD_CGCALENDAR);
        $fmt = 'last sunday + %d days';
        $out['dayNames'] = array();
        $out['dayNamesShort'] = array();
        $curday = (int)date('w');
        for( $i = 0; $i < 7; $i++ ) {
$out['dayNames'][] =
utf8_encode(strftime('%A',strtotime(sprintf($fmt,$i))));
$out['dayNamesShort'][] =
utf8_encode(strftime('%a',strtotime(sprintf($fmt,$i))));
        }
        return $out;
    }
      
avatar
Date: 2018-04-05 10:32
Posted By: Robert Campbell (calguy1000)

just tested in v2.5.1 in finnish
worked fine here.
      
avatar
Date: 2018-04-05 10:45
Posted By: Robert Campbell (calguy1000)

Actually this is not an issue with CGCalendar,  but with the CMSMS nls file for
finnish that specifies a non utf-8 locale early in it's search string.

Fixed for CMSMS 2.2.8
      
Updates

Updated: 2018-04-05 10:45
resolution_id: 11 => 9

Updated: 2018-04-05 10:32
resolution_id: 10 => 11

Updated: 2018-03-22 14:03
resolution_id: => 10