You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently upgrading a site from 2.4 to 3.1 and have run into an issue with the display of date ranges. The site is principally Thai, with a small English version alongside it.
There are 2 facets to this problem.
There is no documentation regarding both how to configure the display of the date range, and the fact that it needs configured for locales other than de,nl,en. I added logging trace to CalendarDateTime::DateRange() and CalendarUtil::localize() as follows:
public static function localize($start, $end, $key) {
global $customDateTemplates;
if(is_array($customDateTemplates) && isset($customDateTemplates[$key])) {
error_log('CAL: Checking for template '.$customDateTemplates[$key]);
$template = $customDateTemplates[$key];
}
else {
error_log('CAL: Getting calendar key from locale file');
$template = _t("Calendar.$key");
}
error_log('CAL: Template='.$template);
return str_replace(self::$format_character_placeholders, self::format_character_replacements($start,$end), $template);
}
The value of $template was being logged as an empty string, hence my empty date range being displayed.
Searching for $customDateTemplates lead me to the event_calendar/_config.php
In event_calendar/_config.php the values used for some of the constants in the commented out section are legacy, I suspect from the 2.4 version.
<?php
global $customDateTemplates;
$customDateTemplates = array(
/*
You can modify the date display by assigning new date templates to any of the following
date scenarios. Use the above date format keys.
'OneDay' => '$StartMonthNameShort. $StartDayNumberShort, $StartYearFull'
'SameMonthSameYear' => '$StartMonthNameShort. $StartDayNumberShort - $EndDatNumberShort, $EndYearFull'
'DiffMonthSameYear' => '$StartMonthNameShort. $StartDayNumberShort - $EndMonthNameShort. $EndDayNumberShort, $EndYearFull'
'DiffMonthDiffYear' => '$StartMonthNameShort. $StartDayNumberShort, $StartYearFull - $EndMonthNameShort $EndDayNumberShort, $EndYearFull'
'OneDayHeader' => '$StartMonthNameFull $StartDayNumberShort$StartDaySuffix, $StartYearFull'
'MonthHeader' => '$StartMonthNameFull, $StartYearFull'
'YearHeader' => '$StartYearFull'
*/
);
For example, EndYearFull is now EndYearLong, and EndDatNumberShort is a typo (should be EndDayNumberShort)
Whilst I see now that I can copy and then tweak a language file for displaying dates in Thai, I've tested this and it fixes the problem.
Can I suggest that a README file is added and information about how to fix this problem for the non catered for locales is added?
Cheers,
Gordon
The text was updated successfully, but these errors were encountered:
Sure thing. My preference is that you send a pull request for an updated readme though, as personally I don't have time at the moment, and this isn't particularly high priority for someone else to do it.
I am currently upgrading a site from 2.4 to 3.1 and have run into an issue with the display of date ranges. The site is principally Thai, with a small English version alongside it.
There are 2 facets to this problem.
The value of $template was being logged as an empty string, hence my empty date range being displayed.
Searching for $customDateTemplates lead me to the event_calendar/_config.php
For example, EndYearFull is now EndYearLong, and EndDatNumberShort is a typo (should be EndDayNumberShort)
Whilst I see now that I can copy and then tweak a language file for displaying dates in Thai, I've tested this and it fixes the problem.
Can I suggest that a README file is added and information about how to fix this problem for the non catered for locales is added?
Cheers,
Gordon
The text was updated successfully, but these errors were encountered: