Skip to content

Conversation

@piotr-iohk
Copy link
Collaborator

Fixes #408

Description

This PR fixes currency symbol placement for currencies that display the symbol after the amount (PLN, CZK, SEK, CHF, NOK, DKK, HUF, and others). Mirrors the fix from bitkit-android#733.

  1. Adds a suffixSymbolCurrencies set and isSuffixSymbolCurrency() helper as single source of truth for currencies whose symbol goes after the amount
  2. Adds isSymbolSuffix property and formattedWithSymbol() method to ConvertedAmount
  3. Updates MoneyText and NumberPadTextField to conditionally place the symbol before or after the amount
  4. Replaces manual symbol concatenation in ReceiveCjitConfirmation, BoostSheet, and WeatherViewModel with formattedWithSymbol()
  5. Adds 15 unit tests for the new formatting logic

Adding a new suffix currency only requires adding it to the suffixSymbolCurrencies set — all UI components derive behavior from it.

Linked Issues/Tasks

Screenshot / Video

Screen.Recording.2026-02-09.at.14.12.49.mov

@piotr-iohk piotr-iohk self-assigned this Feb 9, 2026
@claude

This comment has been minimized.

@piotr-iohk piotr-iohk requested review from jvsena42 and pwltr February 9, 2026 15:14
@ovitrif
Copy link
Collaborator

ovitrif commented Feb 10, 2026

@piotr-iohk usually the Swift and Kotlin coding languages have built-in APIs for locale-based number formatting (and currency specific variants).

Did you already try to inquire with your AI agent if using those is not feasible here?!

You normally should get the "perfect" placement of currency symbol for all locales.

@piotr-iohk
Copy link
Collaborator Author

@piotr-iohk usually the Swift and Kotlin coding languages have built-in APIs for locale-based number formatting (and currency specific variants).

Did you already try to inquire with your AI agent if using those is not feasible here?!

You normally should get the "perfect" placement of currency symbol for all locales.

We did evaluate built-in locale/currency formatting APIs.
For this fix, we intentionally kept deterministic app formatting + explicit suffix rules.

Why:

  1. Fiat formatting in the app is currently not fully locale-driven (we enforce separators/patterns), so changing only symbol placement was the safest minimal fix.
  2. Currency.getInstance(...).getSymbol(...) is locale-dependent and can return codes instead of expected symbols in non-native locales, which is not always what we want for current UX.

Concrete example:

  • Currency.getInstance("PLN").getSymbol() -> PLN (default en_US)
  • Currency.getInstance("PLN").getSymbol(Locale.US) -> PLN
  • Currency.getInstance("PLN").getSymbol(pl_PL) ->

Similarly:

  • SEK with Locale.US -> SEK
  • SEK with sv_SE -> kr

So for now we use API-provided symbol values and control placement explicitly for consistent display.
Of course, this can be reevaluated in the future.

pwltr
pwltr previously approved these changes Feb 10, 2026
Copy link
Contributor

@pwltr pwltr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left one small comment

@claude
Copy link

claude bot commented Feb 10, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@piotr-iohk piotr-iohk enabled auto-merge February 10, 2026 16:11
@piotr-iohk piotr-iohk merged commit 6e641a0 into master Feb 10, 2026
13 of 16 checks passed
@piotr-iohk piotr-iohk deleted the fix/currency-symbol-position branch February 10, 2026 16:28
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.

Currency symbol displayed in wrong position for PLN, CZK, SEK and other currencies

3 participants