lastupdate() as well the respective functionality of page_params lacks some internationalization support. As it's now, the names of the weekdays and months are available in English only, as we're using the date() function. IMHO that is the only reasonable option for now (regarding problems with locales, and that the intl extension is available only since PHP 5.3, if at all).
However, we could somewhat improve the situation by not directly calling the following:
Code: Select all
date($tx['lastupdate']['dateformat'], ...)
Code: Select all
XH_date(...)
Code: Select all
function XH_date($timestamp)
{
global $tx;
return date($tx['lastupdate']['dateformat'], $timestamp);
}
I'm not sure if it's even necessary to vote upon this change, as it is a simple refactoring. We may consider to generally allow reasonable and non BC breaking refactorings (see Hamlet Darcy's interpretation of the term).
[1] resp. an alternative function supplied by an addon or plugin, similar to Last Update or Customized lastupdate.
Christoph
PS: A custom sample implementation (I've named it XH_formatDate(), which might be better than XH_date()):
Code: Select all
<?php
/**
* Returns a formatted UNIX timestamp.
*
* @param int $timestam A UNIX timestamp.
*
* @return string
*/
function XH_formatDate($timestamp)
{
// translate the following according to your needs
$weekdayNames = array(
'Sunday' , 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday',
'Saturday'
);
$monthNames = array(
'January', 'February', 'March', 'April', 'May', 'June', 'July',
'August', 'September', 'October', 'November', 'December'
);
$year = date('Y', $timestamp);
$month = date('n', $timestamp);
$monthName = $monthNames[$month];
$day = date('j', $timestamp);
$weekday = date('w', $timestamp);
$weekdayName = $weekdayNames[$weekday];
$hour = date('H', $timestamp);
$minutes = date('i', $timestamp);
$seconds = date('s', $timestamp);
// adjust the actual format according to your needs
return "$day. $monthName $year, $hour:$minutes";
}