diff options
Diffstat (limited to 'src/components/Numpad.svelte')
| -rw-r--r-- | src/components/Numpad.svelte | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/components/Numpad.svelte b/src/components/Numpad.svelte index c321e0bc..5e3e8fa6 100644 --- a/src/components/Numpad.svelte +++ b/src/components/Numpad.svelte @@ -27,10 +27,14 @@ let position = $state("before"); function getCurrencyInfo(locale = "en-US", currency) { - const formatter = new Intl.NumberFormat(locale, { + const l = typeof locale === "function" ? locale() : locale || "en-US"; + const region = l.length >= 2 ? l.slice(-2) : ""; + const currencyDisplay = + region && currency.startsWith(region) ? "narrowSymbol" : "symbol"; + const formatter = new Intl.NumberFormat(l, { style: "currency", currency, - currencyDisplay: "symbol", + currencyDisplay, minimumFractionDigits: 2, maximumFractionDigits: 2, }); |
