Skip to content

fix: use user's fiat currency and locale settings consistently#68

Open
BitHighlander wants to merge 2 commits intodevelopfrom
fix/locale-currency-consistency
Open

fix: use user's fiat currency and locale settings consistently#68
BitHighlander wants to merge 2 commits intodevelopfrom
fix/locale-currency-consistency

Conversation

@BitHighlander
Copy link
Copy Markdown
Collaborator

Summary

  • Replace all hardcoded $/USD/en-US formatting with the user's chosen currency and locale from FiatProvider
  • Remove legacy formatUsd() function — all 10+ call sites now use useFiat().fmtCompact()
  • Update AnimatedUsd component to derive symbol and separators from fiat context instead of hardcoding $ and ,
  • Fix all 15 asset.json locale files: "$0.00 USD ({{count}})""{{zeroValue}} ({{count}})"
  • Fix all 10 staking.json locale files: ~${{usd}}~{{fiatValue}}
  • Add browser language auto-detection on first launch (navigator.language → supported language match)
  • Backend reports (PDF/swap) now use stored number_locale and fiat_currency settings instead of hardcoded en-US
  • ZcashPrivacyTab block numbers use user's locale for thousand separators
  • ReportDialog dates and totals use user's locale

Files changed (38)

  • Removed: formatUsd() from formatting.ts
  • Updated: AnimatedUsd, SendForm, AssetPage, SwapDialog, BtcXpubSelector, EvmAddressSelector, StakingPanel, ZcashPrivacyTab, ReportDialog
  • Backend: reports.ts, swap-report.ts
  • i18n: 15 asset.json + 10 staking.json locale files
  • Init: i18n/index.ts (browser locale detection)

Test plan

  • Change currency in Settings → verify all amounts show correct symbol/format across Dashboard, AssetPage, SendForm, SwapDialog
  • Change number format locale → verify thousand/decimal separators update in DonutChart, AnimatedUsd, token balances
  • Set browser language to a supported non-English locale, clear localStorage, reload → verify auto-detection picks the language
  • Generate a PDF report → verify currency formatting matches user settings
  • Check Zcash privacy tab block numbers render with locale-appropriate separators
  • Verify staking rewards display with non-USD currency selected

Replace all hardcoded USD/en-US formatting with the user's chosen
currency and locale from FiatProvider. Removes legacy formatUsd(),
updates AnimatedUsd to use fiat symbol, fixes i18n strings that
hardcoded "$0.00 USD", and adds browser language auto-detection on
first launch.
…review restored

1. Reports: stored values are USD — keep USD currency label, only use
   user's number_locale for digit separators (no relabeling bug).
2. AnimatedUsd: replace brittle separator guessing with CountUp's
   formattingFn backed by Intl.NumberFormat. Correctly handles fr-FR
   spaces, pl-PL suffix symbols, de-CH apostrophes, and 0-decimal
   currencies (JPY/KRW/HUF).
3. SendForm: zero preview now falls back to fmt(0) instead of
   fmtCompact(0) which returns '' for zero values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant