Topic: [HACK] Translate the date (show_news.php)
$matches[1] Translate the date
$matches[1] FUNimations, though other versions have been on the forum ".handle_img_tag($matches[1].$matches[3], false)."
$matches[1] 1.3.6 - * (no incompatibility reported yet)
$matches[1] Translate the month/weeknames
$matches[1] The date template hack
$matches[1]
Be sure to have that other hack installed. It'll be easier to implement the hack
open functions.inc.php and add before (at the bottom of the file)
?>
function my_date( $data, $type )
{
$list = array();
$list['months'] = array();
$list['months']['1'] = "januari";
$list['months']['2'] = "februari";
$list['months']['3'] = "march";
$list['months']['4'] = "april";
$list['months']['5'] = "mai";
$list['months']['6'] = "june";
$list['months']['7'] = "juli";
$list['months']['8'] = "august";
$list['months']['9'] = "september";
$list['months']['10'] = "october";
$list['months']['11'] = "november";
$list['months']['11'] = "december";
$list['weekday'] = array();
$list['weekday']['1'] = "monday";
$list['weekday']['2'] = "tuesday";
$list['weekday']['3'] = "wednesday";
$list['weekday']['4'] = "thursday";
$list['weekday']['5'] = "friday";
$list['weekday']['6'] = "saterday";
$list['weekday']['0'] = "sunday";
return $list[$type][$data];
}
Now comes the trick to translating the dates. It's a bit tricky so keep your mind with it and UNDERSTAND what you're doing.
As mentioned in the 'Date Template Hack' depending on the tokens(parameters) entered the date() function will return a value. It's important in order to use this hack that the return value is a $matches[1]
now let's translate the month
$output = str_replace("{month}", date("n", $news_arr[0]), $output);
will become$output = str_replace("{month}", $matches[1]date("n", $news_arr[0])$matches[1], $output);
now the {month} will be replaced with the translated month name.We don't have a tag for the 'weekday' so add this line
$output = str_replace("{weekday}", $matches[1]date("w", $news_arr[0])$matches[1], $output);
