diff --git a/ui/component/walletBalance/view.jsx b/ui/component/walletBalance/view.jsx index eb2036189..2b194496d 100644 --- a/ui/component/walletBalance/view.jsx +++ b/ui/component/walletBalance/view.jsx @@ -9,7 +9,7 @@ import HelpLink from 'component/common/help-link'; import Card from 'component/common/card'; import LbcSymbol from 'component/common/lbc-symbol'; import I18nMessage from 'component/i18nMessage'; -import { formatNumberWithCommas } from 'util/number'; +import { formatCredits } from 'util/format-credits'; type Props = { balance: number, @@ -64,7 +64,7 @@ const WalletBalance = (props: Props) => { return ( } + title={} subtitle={ totalLocked > 0 ? ( }}> diff --git a/ui/util/format-credits.js b/ui/util/format-credits.js index b3b7d4eb1..a32dac0ca 100644 --- a/ui/util/format-credits.js +++ b/ui/util/format-credits.js @@ -1,11 +1,12 @@ export function formatCredits(amount, precision, shortFormat = false) { + const language = localStorage.getItem('language') || undefined; const actualAmount = Number(amount); - const safePrecision = Math.min(20, Math.max(1, precision)); + const safePrecision = Math.min(20, Math.max(1, precision || 0)); if (Number.isNaN(actualAmount) || actualAmount === 0) return '0'; if (shortFormat) { - const formatter = new Intl.NumberFormat(undefined, { + const formatter = new Intl.NumberFormat(language, { minimumFractionDigits: safePrecision, maximumFractionDigits: safePrecision, roundingIncrement: 5, @@ -16,7 +17,7 @@ export function formatCredits(amount, precision, shortFormat = false) { return formatter.format(actualAmount); } - const formatter = new Intl.NumberFormat(undefined, { + const formatter = new Intl.NumberFormat(language, { minimumFractionDigits: safePrecision, maximumFractionDigits: safePrecision, roundingIncrement: 5, diff --git a/ui/util/number.js b/ui/util/number.js index b162ff42d..b24476356 100644 --- a/ui/util/number.js +++ b/ui/util/number.js @@ -1,8 +1,9 @@ // @flow export function formatNumber(num: number, numberOfDigits?: number, short: boolean = false): string { + const language = localStorage.getItem('language') || undefined; const safePrecision = Math.min(20, numberOfDigits || 0); - const formatter = new Intl.NumberFormat(undefined, { + const formatter = new Intl.NumberFormat(language, { maximumFractionDigits: safePrecision, notation: short ? 'compact' : 'standard', compactDisplay: 'short',