From 249bfe44bb5185f9c39bd19793e1ddbd1e5474b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sobral?= <63429525+jsobralgitpush@users.noreply.github.com> Date: Tue, 3 Oct 2023 00:11:30 -0300 Subject: [PATCH] fix: issue of translation for `TimeAgo.vue` (#7951) Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: iamsivin --- .../dashboard/components/ui/TimeAgo.vue | 16 ++++++++++++---- .../dashboard/i18n/locale/en/chatlist.json | 10 ++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/app/javascript/dashboard/components/ui/TimeAgo.vue b/app/javascript/dashboard/components/ui/TimeAgo.vue index 1cbd85531..787c53e1e 100644 --- a/app/javascript/dashboard/components/ui/TimeAgo.vue +++ b/app/javascript/dashboard/components/ui/TimeAgo.vue @@ -53,16 +53,24 @@ export default { const createdTimeDiff = Date.now() - this.createdAtTimestamp * 1000; const isBeforeAMonth = createdTimeDiff > DAY_IN_MILLI_SECONDS * 30; return !isBeforeAMonth - ? `Created ${this.createdAtTimeAgo}` - : `Created at: ${this.dateFormat(this.createdAtTimestamp)}`; + ? `${this.$t('CHAT_LIST.CHAT_TIME_STAMP.CREATED.LATEST')} ${ + this.createdAtTimeAgo + }` + : `${this.$t( + 'CHAT_LIST.CHAT_TIME_STAMP.CREATED.OLDEST' + )} ${this.dateFormat(this.createdAtTimestamp)}`; }, lastActivity() { const lastActivityTimeDiff = Date.now() - this.lastActivityTimestamp * 1000; const isNotActive = lastActivityTimeDiff > DAY_IN_MILLI_SECONDS * 30; return !isNotActive - ? `Last activity ${this.lastActivityAtTimeAgo}` - : `Last activity: ${this.dateFormat(this.lastActivityTimestamp)}`; + ? `${this.$t('CHAT_LIST.CHAT_TIME_STAMP.LAST_ACTIVITY.ACTIVE')} ${ + this.lastActivityAtTimeAgo + }` + : `${this.$t( + 'CHAT_LIST.CHAT_TIME_STAMP.LAST_ACTIVITY.NOT_ACTIVE' + )} ${this.dateFormat(this.lastActivityTimestamp)}`; }, tooltipText() { return `${this.createdAt} diff --git a/app/javascript/dashboard/i18n/locale/en/chatlist.json b/app/javascript/dashboard/i18n/locale/en/chatlist.json index abfe8f8d2..9c973b199 100644 --- a/app/javascript/dashboard/i18n/locale/en/chatlist.json +++ b/app/javascript/dashboard/i18n/locale/en/chatlist.json @@ -41,6 +41,16 @@ "STATUS": "Status", "ORDER_BY": "Order by" }, + "CHAT_TIME_STAMP": { + "CREATED": { + "LATEST": "Created", + "OLDEST": "Created at:" + }, + "LAST_ACTIVITY": { + "NOT_ACTIVE": "Last activity:", + "ACTIVE": "Last activity" + } + }, "CHAT_SORT_FILTER_ITEMS": { "latest": { "TEXT": "Last activity"