From 6e8e8ec68540b5ea44a5eefb661c9c20e9c95849 Mon Sep 17 00:00:00 2001 From: defacer Date: Fri, 30 Apr 2004 08:59:04 +0000 Subject: [PATCH] Fix to display correctly formatted dates in some cases where they were not being localized as they should. Also, small cosmetic addition of a space between words in the date representation (I had missed it). --- calendar/lib.php | 16 +++++++++++++--- calendar/view.php | 9 +++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/calendar/lib.php b/calendar/lib.php index 407ca16247..37ae0254e7 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -540,7 +540,7 @@ function calendar_top_controls($type, $data) { $nextname = calendar_month_name($nextdate['month']); $content .= "\n"; $content .= '\n"; - $content .= '\n"; + $content .= '\n"; $content .= '\n"; $content .= "
<< '.$prevname.' '.$prevyear."'.$monthname.' '.$data['y']."'.strftime(get_string('strftimemonthyear'), $time)."'.$nextname.' '.$nextyear." >>
\n"; break; @@ -553,7 +553,17 @@ function calendar_top_controls($type, $data) { $nextname = calendar_wday_name($nextdate['weekday']); $content .= "\n"; $content .= '\n"; - $content .= '\n"; + + // Get the format string + $text = get_string('strftimedaydate'); + // Regexp hackery to make a link out of the month/year part + $text = ereg_replace('(%B.+%Y|%Y.+%B|%Y.+%m[^ ]+)', '\\1', $text); + // Replace with actual values and lose any day leading zero + $text = strftime($text, $time); + $text = str_replace(' 0', ' ', $text); + // Print the actual thing + $content .= '\n"; + $content .= '\n"; $content .= "
<< '.$prevname."'.$dayname.', '.$data['d'].' '.$monthname.' '.$data['y']."'.$text."'.$nextname." >>
\n"; break; @@ -649,7 +659,7 @@ function calendar_day_representation($tstamp, $now = false, $usecommonwords = tr } // To have it in one place, if a change is needed - $formal = get_string($days[userdate($tstamp, '%w')], 'calendar') . userdate($tstamp, $shortformat); + $formal = get_string($days[userdate($tstamp, '%w')], 'calendar').' '.userdate($tstamp, $shortformat); // Reverse TZ compensation: make GMT stamps correspond to user's TZ $tzfix = calendar_get_tz_offset(); diff --git a/calendar/view.php b/calendar/view.php index f33050dd89..cbf58eb06f 100644 --- a/calendar/view.php +++ b/calendar/view.php @@ -74,14 +74,19 @@ $mon = intval($now['mon']); $yr = intval($now['year']); } + $time = mktime(0, 0, 0, $mon, $day, $yr); switch($_GET['view']) { case 'day': - $nav .= ' -> '.$day.' '.calendar_month_name($mon).' '.$yr; + $text = strftime(get_string('strftimedate'), $time); + if($text[0] == '0') { + $text = substr($text, 1); + } + $nav .= ' -> '.$text; $pagetitle = get_string('dayview', 'calendar'); break; case 'month': - $nav .= ' -> '.calendar_month_name($mon).' '.$yr; + $nav .= ' -> '.strftime(get_string('strftimemonthyear'), $time); $pagetitle = get_string('detailedmonthview', 'calendar'); break; case 'upcoming': -- 2.39.5