Skip to content

Commit b577a47

Browse files
committed
feat(locales): add "just now" translations for multiple languages and update date formatting logic
1 parent 034dbdd commit b577a47

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

dashboard/public/statics/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1649,7 +1649,8 @@
16491649
"mins": "mins",
16501650
"second": "second",
16511651
"seconds": "seconds",
1652-
"ago": "ago"
1652+
"ago": "ago",
1653+
"justNow": "just now"
16531654
},
16541655
"notConnectedYet": "Not connected yet",
16551656
"node.xrayVersion": "Core Version",

dashboard/public/statics/locales/fa.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,8 @@
15891589
"mins": "دقیقه",
15901590
"second": "ثانیه",
15911591
"seconds": "ثانیه",
1592-
"ago": "پیش"
1592+
"ago": "پیش",
1593+
"justNow": "همین الان"
15931594
},
15941595
"notConnectedYet": "هنوز متصل نشده",
15951596
"node.xrayVersion": "نسخه هسته",

dashboard/public/statics/locales/ru.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1552,7 +1552,8 @@
15521552
"mins": "мин",
15531553
"second": "секунда",
15541554
"seconds": "секунды",
1555-
"ago": "назад"
1555+
"ago": "назад",
1556+
"justNow": "только что"
15561557
},
15571558
"notConnectedYet": "Еще не подключен",
15581559
"node.xrayVersion": "Версия ядра",

dashboard/public/statics/locales/zh.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1602,8 +1602,9 @@
16021602
"second": "",
16031603
"seconds": "",
16041604
"ago": "",
1605-
"notConnectedYet": "尚未连接"
1605+
"justNow": "刚刚"
16061606
},
1607+
"notConnectedYet": "尚未连接",
16071608
"node.xrayVersion": "核心版本",
16081609
"node.coreVersion": "节点版本",
16091610
"calendar": {

dashboard/src/utils/dateFormatter.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ export const useRelativeExpiryDate = (expiryDate: string | number | null | undef
4848
}
4949
}
5050

51-
dateInfo.time = durationSlots.join(', ') + (isAfter ? '' : ` ${t('time.ago')}`)
51+
if (!isAfter && durationSlots.length === 0 && Math.abs(duration.asMinutes()) < 1) {
52+
dateInfo.time = t('time.justNow')
53+
} else {
54+
dateInfo.time = durationSlots.join(', ') + (isAfter ? '' : ` ${t('time.ago')}`)
55+
}
5256
return dateInfo
5357
}
5458

0 commit comments

Comments
 (0)