You can refer to different jquery.timeago.js if there is one page per language, but this is static. To do this dynamically, you need to specify the jquery.timeago.js link on your page, at the end of your main or main file (or on the page that you use this library) you extract the $ .timeago object and change the field settings according to the flag your language:
if (typeof($.timeago) != "undefined") { jQuery.timeago.settings.strings = { prefixAgo: null, prefixFromNow: null, suffixAgo: "il ya", suffixFromNow: "d'ici", seconds: "moins d'une minute", minute: "environ une minute", minutes: "environ %d minutes", hour: "environ une heure", hours: "environ %d heures", day: "environ un jour", days: "environ %d jours", month: "environ un mois", months: "environ %d mois", year: "un an", years: "%d ans", wordSeparator: " ", numbers: [] }; };
}
Mohammad baygi
source share