[PR #5797] feat(currency): Currency-influenced initial number formats #13181

Closed
opened 2026-04-10 21:49:02 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/actualbudget/actual/pull/5797

State: closed
Merged: Yes


This pull request enhances the currency settings functionality by setting initial number format, symbol position, and fraction display based on the selected currency. It does this by including more metadata in the Currency type, updates parsing and formatting logic for better locale support, and enables Japanese Yen as a currency.

Currency settings improvements:

  • When a user selects a currency in CurrencySettings, the app now automatically updates the number format, symbol position, and fraction display preferences based on the selected currency's metadata. Users can still adjust these settings afterward. (Currency.tsx, currencies.ts, util.ts) [1] [2] [3]
  • The user-facing description in the currency settings UI is updated to clarify that changing the currency also updates number format, symbol position, and fraction display, but these can be adjusted later. (Currency.tsx)

Currency metadata and support:

  • The Currency type now includes new fields: numberFormat and symbolFirst. This enables more accurate locale-specific formatting. (currencies.ts) [1]
    • Also sorts the currencies list so that e.g., EGP, JPY, QAR, SAR are in the right alphabetical order [2]
  • The translation map in Currency.tsx is updated to match the sort order of currencies and corrects the label for Japanese Yen. (Currency.tsx)

Number formatting and parsing enhancements:

  • Number format types are now exported, and the logic for handling space-based thousands separators is updated to use the correct Unicode narrow no-break space (\u202F), improving support for locales like Polish, Russian, and Ukrainian. (util.ts, arithmetic.ts) [1] [2] [3] [4]
    • arithmetic.ts is updated to include both regular NBSP and narrow NBSP characters in the regex, as unicode formatted points.

Documentation:

  • Release notes are updated to reflect the new enhancement. (upcoming-release-notes/5797.md)

Demonstration

https://github.com/user-attachments/assets/b8e6f3de-58e7-4a69-9746-3b00e3ee3ac9

NOTE: I also added the space-symbol separator setting after making this screen recording. The change adds a space if the symbol would come after the number, and no space if before.

**Original Pull Request:** https://github.com/actualbudget/actual/pull/5797 **State:** closed **Merged:** Yes --- This pull request enhances the currency settings functionality by setting initial number format, symbol position, and fraction display based on the selected currency. It does this by including more metadata in the Currency type, updates parsing and formatting logic for better locale support, and enables Japanese Yen as a currency. **Currency settings improvements:** * When a user selects a currency in `CurrencySettings`, the app now automatically updates the number format, symbol position, and fraction display preferences based on the selected currency's metadata. Users can still adjust these settings afterward. (`Currency.tsx`, `currencies.ts`, `util.ts`) [[1]](diffhunk://#diff-9b0bd6bc744bfd4afac03d8e6db423fa69216ff2dac2272f2a5dba73494e14ccR65-R66) [[2]](diffhunk://#diff-9b0bd6bc744bfd4afac03d8e6db423fa69216ff2dac2272f2a5dba73494e14ccR88-L87) [[3]](diffhunk://#diff-9b0bd6bc744bfd4afac03d8e6db423fa69216ff2dac2272f2a5dba73494e14ccL174-R181) * The user-facing description in the currency settings UI is updated to clarify that changing the currency also updates number format, symbol position, and fraction display, but these can be adjusted later. (`Currency.tsx`) **Currency metadata and support:** * The `Currency` type now includes new fields: `numberFormat` and `symbolFirst`. This enables more accurate locale-specific formatting. (`currencies.ts`) [[1]](diffhunk://#diff-e58604b34393a62d237d3e6c3c8f02502c9c3857eabb3be763b2e5a47c185068R8-R9) * Also sorts the `currencies` list so that e.g., EGP, JPY, QAR, SAR are in the right alphabetical order [[2]](diffhunk://#diff-9b0bd6bc744bfd4afac03d8e6db423fa69216ff2dac2272f2a5dba73494e14ccR29-L49) * The translation map in `Currency.tsx` is updated to match the sort order of `currencies` and corrects the label for Japanese Yen. (`Currency.tsx`) **Number formatting and parsing enhancements:** * Number format types are now exported, and the logic for handling space-based thousands separators is updated to use the correct Unicode narrow no-break space (`\u202F`), improving support for locales like Polish, Russian, and Ukrainian. (`util.ts`, `arithmetic.ts`) [[1]](diffhunk://#diff-38e21533cdabf107724be33472d5cca2ebda693ca957e11885b3a515e5f355cfL267-R267) [[2]](diffhunk://#diff-38e21533cdabf107724be33472d5cca2ebda693ca957e11885b3a515e5f355cfL280-R284) [[3]](diffhunk://#diff-38e21533cdabf107724be33472d5cca2ebda693ca957e11885b3a515e5f355cfL330-R334) [[4]](diffhunk://#diff-f00ab63a0b721dd9afc0e9f181bc480d0c002c255e741c37c596e7a2b14212a8L41-R41) * `arithmetic.ts` is updated to include both regular NBSP and narrow NBSP characters in the regex, as unicode formatted points. **Documentation:** * Release notes are updated to reflect the new enhancement. (`upcoming-release-notes/5797.md`) **Demonstration** https://github.com/user-attachments/assets/b8e6f3de-58e7-4a69-9746-3b00e3ee3ac9 NOTE: I also added the space-symbol separator setting after making this screen recording. The change adds a space if the symbol would come after the number, and no space if before.
GiteaMirror added the pull-request label 2026-04-10 21:49:02 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#13181