Skip to content

Commit

Permalink
Merge pull request #434 from kausaltech/fix/indicator-value-locale-fo…
Browse files Browse the repository at this point in the history
…rmat

Apply locale for consistent number formatting
  • Loading branch information
lilia1891 authored Nov 27, 2024
2 parents aa7870b + 18fc87e commit 7fc248c
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 7fc248c

Please sign in to comment.