From 18fc87e81e333006e105d6479c7363e01f673343 Mon Sep 17 00:00:00 2001 From: Lilia Sviridova Date: Tue, 26 Nov 2024 11:18:02 +0200 Subject: [PATCH] Apply locale for consistent number formatting --- components/indicators/IndicatorHighlightCard.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/indicators/IndicatorHighlightCard.tsx b/components/indicators/IndicatorHighlightCard.tsx index b10a5f8f..f793252a 100644 --- a/components/indicators/IndicatorHighlightCard.tsx +++ b/components/indicators/IndicatorHighlightCard.tsx @@ -94,6 +94,8 @@ type IndicatorHighlightCardProps = { unit?: string; }; +import { useLocale } from 'next-intl'; + function IndicatorHighlightCard({ level, objectid, @@ -103,6 +105,7 @@ function IndicatorHighlightCard({ }: IndicatorHighlightCardProps) { const t = useTranslations(); const plan = usePlan(); + const locale = useLocale(); // FIXME: It sucks that we only use the context for the translation key 'action' const indicatorType = @@ -117,7 +120,7 @@ function IndicatorHighlightCard({ - {typeof value === 'number' ? beautifyValue(value) : '-'} + {typeof value === 'number' ? beautifyValue(value, locale) : '-'} {unit === 'no unit' ? '' : unit}