From 82b316e90b566c186ec94d5110405a03767f5a8e Mon Sep 17 00:00:00 2001 From: estifanos Date: Fri, 28 Aug 2026 07:37:43 +0000 Subject: [PATCH] feat: localize license status labels and display detailed status reasons in LicenseCard --- .../licensing/components/LicenseCard.tsx | 28 +++++++++++++++++-- apps/portal/src/app/i18n/locales/am.ts | 8 ++++++ apps/portal/src/app/i18n/locales/en.ts | 8 ++++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/apps/portal/src/app/features/licensing/components/LicenseCard.tsx b/apps/portal/src/app/features/licensing/components/LicenseCard.tsx index c8942a140..8fe493e76 100644 --- a/apps/portal/src/app/features/licensing/components/LicenseCard.tsx +++ b/apps/portal/src/app/features/licensing/components/LicenseCard.tsx @@ -81,6 +81,11 @@ export function LicenseCard({ // only for a cached response from before those fields existed. const days = license.daysUntilExpiry ?? daysUntil(license.expiryDate); const expired = license.status === 'EXPIRED' || days < 0; + // Suspended, cancelled and superseded are none of them "valid until" their + // expiry date — the card used to say exactly that, because only EXPIRED was + // treated as not-current. A suspended licence read as a live one with a grey + // badge. + const current = license.status === 'ACTIVE' && !expired; const renewable = license.renewable ?? false; const showDate = useDateDisplayer(); const localized = useLocalized(); @@ -100,9 +105,15 @@ export function LicenseCard({ - {expired ? t('licensing.card.expired') : license.status} + {/* The raw enum was rendered here, so an Amharic page showed + "SUSPENDED" among otherwise translated text. */} + {expired + ? t('licensing.card.expired') + : t(`licensing.card.status.${license.status}`, { + defaultValue: license.status, + })} @@ -113,8 +124,19 @@ export function LicenseCard({ {expired ? t('licensing.card.expiredOn', { date: showDate(license.expiryDate) }) - : t('licensing.card.validUntil', { date: showDate(license.expiryDate) })} + : current + ? t('licensing.card.validUntil', { date: showDate(license.expiryDate) }) + : t(`licensing.card.status.${license.status}`, { + defaultValue: license.status, + })} + {/* Why it stopped being current. The API returns it; the card threw + it away, leaving the holder to guess. */} + {!current && license.statusReason && ( + + {t('licensing.card.statusReason', { reason: license.statusReason })} + + )}