shoutbox elapsed time correct translation

arturo.b
Topic Author
Posts: 2
3 years 10 months ago #2833 by arturo.b
Dear all,
Very good module.

I did a little change to helper.php timeElapsed() function, in order to have time elapsed correctly translated in Italian (because of plural is not simply achieved by adding a final 's' )

public function timeElapsed($datetime, $full = false)
{
$now = JFactory::getDate();
$ago = JFactory::getDate($datetime);
$diff = $now->diff($ago);

$diff->w = floor($diff->d / 7);
$diff->d -= $diff->w * 7;

$string = array(
'y' => 'YEAR',
'm' => 'MONTH',
'w' => 'WEEK',
'd' => 'DAY',
'h' => 'HOUR',
'i' => 'MINUTE',
's' => 'SECOND',
);

foreach ($string as $k => &$v)
{
if ($diff->$k)
{
$v = $diff->$k . ' ' . JText::_( $v . ($diff->$k > 1 ? 'S' : ''));
}
else
{
unset($string[$k]);
}
}

if (!$full)
{
$string = array_slice($string, 0, 1);
}

return $string ? implode(', ', $string) .' ' . JText::_('AGO') : JText::_('JUST_NOW');
}


and added following topics to it-IT.mod_shoutbox.ini (to be done for every language needed)

AGO="fa"
JUST_NOW="Adesso"
YEAR="anno"
MONTH="mese"
WEEK="settimana"
DAY="giorno"
HOUR="ora"
MINUTE="minuto"
SECOND="secondo"
YEARS="anni"
MONTHS="mesi"
WEEKS="settimane"
DAYS="giorni"
HOURS="ore"
MINUTES="minuti"
SECONDS="secondi"


hope this will help.
Arturo

Please Log in or Create an account to join the conversation.

Lodder
Lodder's Avatar
Posts: 1167
3 years 10 months ago #2834 by Lodder
Replied by Lodder on topic shoutbox elapsed time correct translation
Hi Auturo,

Thanks for the update. We'll have a proper look at this tomorrow and implement it for the next update.

Regards,
Lodder

Please Log in or Create an account to join the conversation.

arturo.b
Topic Author
Posts: 2
3 years 10 months ago #2835 by arturo.b
Replied by arturo.b on topic shoutbox elapsed time correct translation
Great!
ThankYou.

Arturo

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum