Skip to main content

Translating the "days ago" text (on an activity stream)

 

I'm translating the "days ago" text that appears in every activity stream. The format in Spanish won't be "# days ago" but rather "hace # días". It seems this can't be done with liquid replace filters, so I'm using javascript.
My Code:
$(window).load(function(){
$('.timeago').prepend('hace ');
$('.timeago').append('días');
$('.timeago').each(function(){
    $(this).html($(this).html().split("days ago").join(""));
});
});
The problem:
While this code works for 60 seconds, the text then reverts to the original English. It seems this div refreshes every minute (presumably so someone who sits on that page for days on end will still see an up-to-date "days ago" count).

Question:
Is there a way to prevent the update from taking place every 60 seconds?
Alternatively, is there a way to run my translation function every minute when the "time ago" div updates?
Thanks a lot in advance.
Official response from

Please see below!

Share this post

Showing 3 reactions

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.