From 683b6cfcada69591a148b5aa1e42d070bf3b166e Mon Sep 17 00:00:00 2001 From: Raymond Liu Date: Tue, 4 Feb 2025 00:21:09 -0800 Subject: [PATCH] fix(ui,i18n): move plural check to i18next (#58560) --- client/i18n/locales/english/translations.json | 4 ++-- client/src/components/profile/components/heat-map.tsx | 11 +---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/client/i18n/locales/english/translations.json b/client/i18n/locales/english/translations.json index 4768031c260..71ceeaca148 100644 --- a/client/i18n/locales/english/translations.json +++ b/client/i18n/locales/english/translations.json @@ -366,8 +366,8 @@ "joined": "Joined {{date}}", "from": "From {{location}}", "total-points": "Total Points:", - "points-singular": "{{count}} point on {{date}}", - "points-plural": "{{count}} points on {{date}}", + "points_one": "{{count}} point on {{date}}", + "points_other": "{{count}} points on {{date}}", "page-number": "{{pageNumber}} of {{totalPages}}", "edit-my-profile": "Edit My Profile", "add-bluesky": "Share this certification on BlueSky", diff --git a/client/src/components/profile/components/heat-map.tsx b/client/src/components/profile/components/heat-map.tsx index df5e67a9b89..fe64715189d 100644 --- a/client/src/components/profile/components/heat-map.tsx +++ b/client/src/components/profile/components/heat-map.tsx @@ -128,17 +128,8 @@ class HeatMapInner extends Component { if (!value || value.count < 0) { return { 'data-tip': '' }; } - // Use singular translation if count == 1 else plural - if (value.count === 1) { - return { - 'data-tip': t('profile.points-singular', { - count: value.count, - date: dateFormatted - }) - }; - } return { - 'data-tip': t('profile.points-plural', { + 'data-tip': t('profile.points', { count: value.count, date: dateFormatted })