Hello,
I started using the Recently Viewed Posts and I liked it to be in Dutch.
I haven't got any experience with php but still managed to translate it.
Replace this:
function recently_viewed_posts_time_since( $original ) {
// array of time period chunks
$chunks = array(
array( 60 * 60 * 24 * 365 , 'year' ),
array( 60 * 60 * 24 * 30 , 'month' ),
array( 60 * 60 * 24 * 7, 'week' ),
array( 60 * 60 * 24 , 'day' ),
array( 60 * 60 , 'hour' ),
array( 60 , 'minute' ),
array( 1, 'second' ),
);
$today = time(); /* Current unix time */
$since = $today - $original;
// $j saves performing the count function each time around the loop
for ( $i = 0, $j = count( $chunks ); $i < $j; $i++ ) {
$seconds = $chunks[$i][0];
$name = $chunks[$i][1];
// finding the biggest chunk ( if the chunk fits, break )
if ( ( $count = floor( $since / $seconds ) ) != 0 ) {
// DEBUG print "<!-- It's $name -->\n";
break;
}
}
$print = ( $count == 1 ) ? '1 '.$name : "$count {$name}s";
if ( $i + 1 < $j ) {
// now getting the second item
$seconds2 = $chunks[$i + 1][0];
$name2 = $chunks[$i + 1][1];
// add second item if it's greater than 0
if ( ( $count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 ) ) != 0 ) {
$print .= ( $count2 == 1 ) ? ', 1 '.$name2 : ", $count2 {$name2}s";
}
}
return $print;
}
By this:
function recently_viewed_posts_time_since( $original ) {
// array of time period chunks
$chunks = array(
array( 60 * 60 * 24 * 365 , 'jaar' , 'jaar' ),
array( 60 * 60 * 24 * 30 , 'month' , 'maanden' ),
array( 60 * 60 * 24 * 7, 'week' , 'weken' ),
array( 60 * 60 * 24 , 'dag' , 'dagen' ),
array( 60 * 60 , 'uur' , 'uur' ),
array( 60 , 'minuut' , 'minuten' ),
array( 1, 'seconde' , 'seconden' ),
);
$today = time(); /* Current unix time */
$since = $today - $original;
// $j saves performing the count function each time around the loop
for ( $i = 0, $j = count( $chunks ); $i < $j; $i++ ) {
$seconds = $chunks[$i][0];
$name = $chunks[$i][1];
$names = $chunks[$i][2];
// finding the biggest chunk ( if the chunk fits, break )
if ( ( $count = floor( $since / $seconds ) ) != 0 ) {
// DEBUG print "<!-- It's $name -->\n";
break;
}
}
$print = ( $count == 1 ) ? '1 '.$name : "$count {$names}";
if ( $i + 1 < $j ) {
// now getting the second item
$seconds2 = $chunks[$i + 1][0];
$name2 = $chunks[$i + 1][1];
$names2 = $chunks[$i + 1][2];
// add second item if it's greater than 0
if ( ( $count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 ) ) != 0 ) {
$print .= ( $count2 == 1 ) ? ', 1 '.$name2 : ", $count2 {$names2}";
}
}
return $print;
}
And ofcourse replace the word 'ago' with 'geleden'.
I wanted to suggest this to the author but his site doesn't work here.
Nederlands: vertaling Recently Viewed Posts naar het Nederlands
See it live:
http://www.clephas.nl