Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(dashboard): pluralize the relative time labels
Yudhi Armyndharis39f95cd15007
diff --git a/dashboard/src/i18n/locales.test.ts b/dashboard/src/i18n/locales.test.tsindex 1fd390721..704cc79d1 100644--- a/dashboard/src/i18n/locales.test.ts+++ b/dashboard/src/i18n/locales.test.ts@@ -78,9 +78,25 @@ test('chats.channels.subscribers: count=1 renders singular, count>1 renders plurassert.equal(i18n.t('chats.channels.subscribers', { count: 4 }), '4 subscribers');});+test('common.minAgo and common.hoursAgo agree with the count', () => {+ assert.equal(i18n.t('common.hoursAgo', { count: 1 }), '1 hour ago');+ assert.equal(i18n.t('common.hoursAgo', { count: 2 }), '2 hours ago');+ assert.equal(i18n.t('common.hoursAgo', { lng: 'fr', count: 1 }), 'Il y a 1 heure');+ assert.equal(i18n.t('common.hoursAgo', { lng: 'fr', count: 3 }), 'Il y a 3 heures');+ assert.equal(i18n.t('common.hoursAgo', { lng: 'he', count: 2 }), 'לפני שעתיים');+ assert.equal(i18n.t('common.minAgo', { lng: 'te', count: 5 }), '5 నిమిషాల క్రితం');+ assert.equal(i18n.t('common.minAgo', { lng: 'ar', count: 3 }), 'منذ 3 دقائق');+});+test('count badges resolve to a non-key, interpolated string in every locale', () => {for (const lng of LOCALE_IDS) {- for (const key of ['webhooks.filters.badge', 'chats.unreadBadge', 'chats.channels.subscribers']) {+ for (const key of [+ 'webhooks.filters.badge',+ 'chats.unreadBadge',+ 'chats.channels.subscribers',+ 'common.minAgo',+ 'common.hoursAgo',+ ]) {for (const count of [1, 2]) {const value = i18n.t(key, { lng, count });assert.ok(value && !value.startsWith(key), `${lng} ${key} count=${count} did not resolve (got "${value}")`);diff --git a/dashboard/src/i18n/locales/ar.json b/dashboard/src/i18n/locales/ar.jsonindex 5d31f24b4..afb1e97b3 100644--- a/dashboard/src/i18n/locales/ar.json+++ b/dashboard/src/i18n/locales/ar.json@@ -32,7 +32,17 @@"never": "أبداً","justNow": "الآن","minAgo": "منذ {{count}} دقيقة",+ "minAgo_other": "منذ {{count}} دقيقة",+ "minAgo_two": "منذ دقيقتين",+ "minAgo_few": "منذ {{count}} دقائق",+ "minAgo_many": "منذ {{count}} دقيقة",+ "minAgo_zero": "منذ {{count}} دقيقة","hoursAgo": "منذ {{count}} ساعة",+ "hoursAgo_other": "منذ {{count}} ساعة",+ "hoursAgo_two": "منذ ساعتين",+ "hoursAgo_few": "منذ {{count}} ساعات",+ "hoursAgo_many": "منذ {{count}} ساعة",+ "hoursAgo_zero": "منذ {{count}} ساعة","optional": "اختياري","language": "اللغة","back": "رجوع",diff --git a/dashboard/src/i18n/locales/de.json b/dashboard/src/i18n/locales/de.jsonindex 18a124f73..873b30027 100644--- a/dashboard/src/i18n/locales/de.json+++ b/dashboard/src/i18n/locales/de.json@@ -32,7 +32,9 @@"never": "Nie","justNow": "Gerade eben","minAgo": "vor {{count}} Min.",+ "minAgo_other": "vor {{count}} Min.","hoursAgo": "vor {{count}} Std.",+ "hoursAgo_other": "vor {{count}} Std.","optional": "optional","language": "Sprache","back": "Zurück",diff --git a/dashboard/src/i18n/locales/en.json b/dashboard/src/i18n/locales/en.jsonindex d61275242..44c11f039 100644--- a/dashboard/src/i18n/locales/en.json+++ b/dashboard/src/i18n/locales/en.json@@ -32,7 +32,9 @@"never": "Never","justNow": "Just now","minAgo": "{{count}} min ago",- "hoursAgo": "{{count}} hours ago",+ "minAgo_other": "{{count}} min ago",+ "hoursAgo": "{{count}} hour ago",+ "hoursAgo_other": "{{count}} hours ago","optional": "optional","language": "Language","back": "Back",diff --git a/dashboard/src/i18n/locales/es.json b/dashboard/src/i18n/locales/es.jsonindex 06b1b17e0..7b7e9ba86 100644--- a/dashboard/src/i18n/locales/es.json+++ b/dashboard/src/i18n/locales/es.json@@ -30,7 +30,11 @@"never": "Nunca","justNow": "Ahora mismo","minAgo": "Hace {{count}} min",- "hoursAgo": "Hace {{count}} horas",+ "minAgo_other": "Hace {{count}} min",+ "minAgo_many": "Hace {{count}} min",+ "hoursAgo": "Hace {{count}} hora",+ "hoursAgo_other": "Hace {{count}} horas",+ "hoursAgo_many": "Hace {{count}} horas","optional": "opcional","language": "Idioma","back": "Atrás",diff --git a/dashboard/src/i18n/locales/fr.json b/dashboard/src/i18n/locales/fr.jsonindex 40fa376eb..4f282d770 100644--- a/dashboard/src/i18n/locales/fr.json+++ b/dashboard/src/i18n/locales/fr.json@@ -32,7 +32,11 @@"never": "Jamais","justNow": "À l'instant","minAgo": "Il y a {{count}} min",- "hoursAgo": "Il y a {{count}} heures",+ "minAgo_other": "Il y a {{count}} min",+ "minAgo_many": "Il y a {{count}} min",+ "hoursAgo": "Il y a {{count}} heure",+ "hoursAgo_other": "Il y a {{count}} heures",+ "hoursAgo_many": "Il y a {{count}} heures","optional": "optionnel","language": "Langue","back": "Retour",diff --git a/dashboard/src/i18n/locales/he.json b/dashboard/src/i18n/locales/he.jsonindex a756d4a74..114eb58f2 100644--- a/dashboard/src/i18n/locales/he.json+++ b/dashboard/src/i18n/locales/he.json@@ -31,8 +31,12 @@"disconnected": "מנותק","never": "אף פעם","justNow": "ממש עכשיו",- "minAgo": "לפני {{count}} דקות",- "hoursAgo": "לפני {{count}} שעות",+ "minAgo": "לפני {{count}} דקה",+ "minAgo_other": "לפני {{count}} דקות",+ "minAgo_two": "לפני שתי דקות",+ "hoursAgo": "לפני {{count}} שעה",+ "hoursAgo_other": "לפני {{count}} שעות",+ "hoursAgo_two": "לפני שעתיים","optional": "אופציונלי","language": "שפה","back": "חזרה",diff --git a/dashboard/src/i18n/locales/hi.json b/dashboard/src/i18n/locales/hi.jsonindex 414972d76..8a3d7bcb5 100644--- a/dashboard/src/i18n/locales/hi.json+++ b/dashboard/src/i18n/locales/hi.json@@ -32,7 +32,9 @@"never": "कभी नहीं","justNow": "अभी-अभी","minAgo": "{{count}} मिनट पहले",- "hoursAgo": "{{count}} घंटे पहले",+ "minAgo_other": "{{count}} मिनट पहले",+ "hoursAgo": "{{count}} घंटा पहले",+ "hoursAgo_other": "{{count}} घंटे पहले","optional": "वैकल्पिक","language": "भाषा","back": "पीछे",diff --git a/dashboard/src/i18n/locales/it.json b/dashboard/src/i18n/locales/it.jsonindex 67180a83a..2f171ae8c 100644--- a/dashboard/src/i18n/locales/it.json+++ b/dashboard/src/i18n/locales/it.json@@ -32,7 +32,11 @@"never": "Mai","justNow": "Ora","minAgo": "{{count}} min fa",- "hoursAgo": "{{count}} ore fa",+ "minAgo_other": "{{count}} min fa",+ "minAgo_many": "{{count}} min fa",+ "hoursAgo": "{{count}} ora fa",+ "hoursAgo_other": "{{count}} ore fa",+ "hoursAgo_many": "{{count}} ore fa","optional": "opzionale","language": "Lingua","back": "Indietro",diff --git a/dashboard/src/i18n/locales/ko.json b/dashboard/src/i18n/locales/ko.jsonindex ad1ef236a..46c4e67ca 100644--- a/dashboard/src/i18n/locales/ko.json+++ b/dashboard/src/i18n/locales/ko.json@@ -32,7 +32,9 @@"never": "없음","justNow": "방금 전","minAgo": "{{count}}분 전",+ "minAgo_other": "{{count}}분 전","hoursAgo": "{{count}}시간 전",+ "hoursAgo_other": "{{count}}시간 전","optional": "선택 사항","language": "언어","back": "뒤로",diff --git a/dashboard/src/i18n/locales/pt-BR.json b/dashboard/src/i18n/locales/pt-BR.jsonindex 2f725dcb3..ebd3a1b43 100644--- a/dashboard/src/i18n/locales/pt-BR.json+++ b/dashboard/src/i18n/locales/pt-BR.json@@ -30,7 +30,11 @@"never": "Nunca","justNow": "Agora mesmo","minAgo": "Há {{count}} min",- "hoursAgo": "Há {{count}} horas",+ "minAgo_other": "Há {{count}} min",+ "minAgo_many": "Há {{count}} min",+ "hoursAgo": "Há {{count}} hora",+ "hoursAgo_other": "Há {{count}} horas",+ "hoursAgo_many": "Há {{count}} horas","optional": "opcional","language": "Idioma","back": "Voltar",diff --git a/dashboard/src/i18n/locales/te.json b/dashboard/src/i18n/locales/te.jsonindex 7aa037ab6..c1cb51e2f 100644--- a/dashboard/src/i18n/locales/te.json+++ b/dashboard/src/i18n/locales/te.json@@ -32,7 +32,9 @@"never": "ఎప్పుడూ కాదు","justNow": "ఇప్పుడే","minAgo": "{{count}} నిమిషం క్రితం",- "hoursAgo": "{{count}} గంటల క్రితం",+ "minAgo_other": "{{count}} నిమిషాల క్రితం",+ "hoursAgo": "{{count}} గంట క్రితం",+ "hoursAgo_other": "{{count}} గంటల క్రితం","optional": "ఐచ్ఛికం","language": "భాష","back": "వెనుకకు",diff --git a/dashboard/src/i18n/locales/tr.json b/dashboard/src/i18n/locales/tr.jsonindex f843dc4b1..42207d5cf 100644--- a/dashboard/src/i18n/locales/tr.json+++ b/dashboard/src/i18n/locales/tr.json@@ -32,7 +32,9 @@"never": "Hiçbir zaman","justNow": "Az önce","minAgo": "{{count}} dk önce",+ "minAgo_other": "{{count}} dk önce","hoursAgo": "{{count}} saat önce",+ "hoursAgo_other": "{{count}} saat önce","optional": "isteğe bağlı","language": "Dil","back": "Geri",diff --git a/dashboard/src/i18n/locales/zh-CN.json b/dashboard/src/i18n/locales/zh-CN.jsonindex 93a6258f7..d05982bca 100644--- a/dashboard/src/i18n/locales/zh-CN.json+++ b/dashboard/src/i18n/locales/zh-CN.json@@ -32,7 +32,9 @@"never": "从未","justNow": "刚刚","minAgo": "{{count}} 分钟前",+ "minAgo_other": "{{count}} 分钟前","hoursAgo": "{{count}} 小时前",+ "hoursAgo_other": "{{count}} 小时前","optional": "可选","language": "语言","back": "返回",diff --git a/dashboard/src/i18n/locales/zh-HK.json b/dashboard/src/i18n/locales/zh-HK.jsonindex eb47c1232..3c5f98cf0 100644--- a/dashboard/src/i18n/locales/zh-HK.json+++ b/dashboard/src/i18n/locales/zh-HK.json@@ -32,7 +32,9 @@"never": "從未","justNow": "剛剛","minAgo": "{{count}} 分鐘前",+ "minAgo_other": "{{count}} 分鐘前","hoursAgo": "{{count}} 小時前",+ "hoursAgo_other": "{{count}} 小時前","optional": "選填","language": "語言","back": "返回",