I have translated the messages, but 'il y a' is not displaying on the correct side.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
export function time_ago(time) {
|
||||
import {useI18n} from "vue-i18n";
|
||||
|
||||
export function time_ago(time) {
|
||||
const time_date = new Date(time)
|
||||
const now_date = new Date(Date.now())
|
||||
const ago = now_date - time_date
|
||||
@@ -19,28 +21,54 @@ function internal_time_ago(time) {
|
||||
default:
|
||||
time = +new Date();
|
||||
}
|
||||
|
||||
|
||||
const {t} = useI18n();
|
||||
const I18nseconds = t('time.seconds');
|
||||
const I18nminuteago = t('time.1minuteago');
|
||||
const I181minutefromnow = t('time.1minutefromnow');
|
||||
const I181minutes = t('time.minutes');
|
||||
const I1811hourago = t('time.1hourago');
|
||||
const I1811hourfromnow = t('time.1hourfromnow');
|
||||
const I18n1hours = t('time.hours');
|
||||
const I18nyesterday = t('time.yesterday');
|
||||
const I18ntomorrow = t('time.tomorrow');
|
||||
const I18ndays = t('time.days');
|
||||
const I18nlastweek = t('time.lastweek');
|
||||
const I18nnextweek = t('time.nextweek');
|
||||
const I18nweeks = t('time.weeks');
|
||||
const I18nlastmonth = t('time.lastmonth');
|
||||
const I18nnextmonth = t('time.nextmonth');
|
||||
const I18nmonths = t('time.months');
|
||||
const I18nlastyear = t('time.lastyear');
|
||||
const I18nnextyear = t('time.nextyear');
|
||||
const I18nyears = t('time.years');
|
||||
const I18nlastcentury = t('time.lastcentury');
|
||||
const I18nnextcentury = t('time.nextcentury');
|
||||
const I18ncenturies = t('time.centuries');
|
||||
const I18nago = t('time.ago');
|
||||
|
||||
|
||||
const time_formats = [
|
||||
[60, 'seconds', 1], // 60
|
||||
[120, '1 minute ago', '1 minute from now'], // 60*2
|
||||
[3600, 'minutes', 60], // 60*60, 60
|
||||
[7200, '1 hour ago', '1 hour from now'], // 60*60*2
|
||||
[86400, 'hours', 3600], // 60*60*24, 60*60
|
||||
[172800, 'Yesterday', 'Tomorrow'], // 60*60*24*2
|
||||
[604800, 'days', 86400], // 60*60*24*7, 60*60*24
|
||||
[1209600, 'Last week', 'Next week'], // 60*60*24*7*4*2
|
||||
[2419200, 'weeks', 604800], // 60*60*24*7*4, 60*60*24*7
|
||||
[4838400, 'Last month', 'Next month'], // 60*60*24*7*4*2
|
||||
[29030400, 'months', 2419200], // 60*60*24*7*4*12, 60*60*24*7*4
|
||||
[58060800, 'Last year', 'Next year'], // 60*60*24*7*4*12*2
|
||||
[2903040000, 'years', 29030400], // 60*60*24*7*4*12*100, 60*60*24*7*4*12
|
||||
[5806080000, 'Last century', 'Next century'], // 60*60*24*7*4*12*100*2
|
||||
[58060800000, 'centuries', 2903040000] // 60*60*24*7*4*12*100*20, 60*60*24*7*4*12*100
|
||||
[60, I18nseconds, 1], // 60
|
||||
[120, I18nminuteago, I181minutefromnow], // 60*2
|
||||
[3600, I181minutes, 60], // 60*60, 60
|
||||
[7200, I1811hourago, I1811hourfromnow], // 60*60*2
|
||||
[86400, I18n1hours, 3600], // 60*60*24, 60*60
|
||||
[172800, I18nyesterday, I18ntomorrow], // 60*60*24*2
|
||||
[604800, I18ndays, 86400], // 60*60*24*7, 60*60*24
|
||||
[1209600, I18nlastweek, I18nnextweek], // 60*60*24*7*4*2
|
||||
[2419200, I18nweeks, 604800], // 60*60*24*7*4, 60*60*24*7
|
||||
[4838400, I18nlastmonth, I18nnextmonth], // 60*60*24*7*4*2
|
||||
[29030400, I18nmonths, 2419200], // 60*60*24*7*4*12, 60*60*24*7*4
|
||||
[58060800, I18nlastyear, I18nnextyear], // 60*60*24*7*4*12*2
|
||||
[2903040000, I18nyears, 29030400], // 60*60*24*7*4*12*100, 60*60*24*7*4*12
|
||||
[5806080000, I18nlastcentury, I18nnextcentury], // 60*60*24*7*4*12*100*2
|
||||
[58060800000, I18ncenturies, 2903040000] // 60*60*24*7*4*12*100*20, 60*60*24*7*4*12*100
|
||||
];
|
||||
|
||||
let seconds = time / 1000
|
||||
|
||||
let token = 'ago'
|
||||
let token = I18nago
|
||||
let list_choice = 1
|
||||
|
||||
if (seconds === 0) {
|
||||
|
||||
Reference in New Issue
Block a user