Skip to content

Commit

Permalink
Apply locale for consistent number formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
lilia1891 committed Nov 26, 2024
1 parent 482a614 commit 18fc87e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/indicators/IndicatorHighlightCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ type IndicatorHighlightCardProps = {
unit?: string;
};

import { useLocale } from 'next-intl';

function IndicatorHighlightCard({
level,
objectid,
Expand All @@ -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 =
Expand All @@ -117,7 +120,7 @@ function IndicatorHighlightCard({
<IndicatorBg $level={level} />
<CardImgOverlay>
<IndicatorValue $level={level} className="action-number">
{typeof value === 'number' ? beautifyValue(value) : '-'}
{typeof value === 'number' ? beautifyValue(value, locale) : '-'}
<IndicatorUnit>{unit === 'no unit' ? '' : unit}</IndicatorUnit>
</IndicatorValue>
</CardImgOverlay>
Expand Down

0 comments on commit 18fc87e

Please sign in to comment.