[PR #3658] [CLOSED] [WIP] [POC] Multi-Currency -- Adding Currency Support to Actual Budget #12046

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

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/3658
Author: @tlesicka
Created: 10/13/2024
Status: Closed

Base: masterHead: currency-support


📝 Commits (7)

  • fc06eba Initial Commit
  • 7fa9870 Fixed errors
  • ec4b0ee added a testing object to the console
  • 1386e34 Merge branch 'actualbudget:master' into currency-support
  • f178b9a Merge remote-tracking branch 'upstream/master' into currency-support
  • 96ebe94 Merge branch 'actualbudget:master' into currency-support
  • 1d65286 Merge branch 'actualbudget:master' into currency-support

📊 Changes

15 files changed (+1972 additions, -31 deletions)

View changed files

📝 packages/desktop-client/src/components/settings/Format.tsx (+55 -8)
📝 packages/desktop-client/src/components/sidebar/Account.tsx (+5 -1)
📝 packages/desktop-client/src/components/sidebar/Sidebar.tsx (+9 -0)
📝 packages/desktop-client/src/components/spreadsheet/CellValue.tsx (+9 -2)
📝 packages/desktop-client/src/components/spreadsheet/useFormat.ts (+43 -11)
packages/loot-core/src/shared/currency/MonetaryUnit/index.ts (+103 -0)
packages/loot-core/src/shared/currency/currencies/crypto/index.ts (+12 -0)
packages/loot-core/src/shared/currency/currencies/index.ts (+11 -0)
packages/loot-core/src/shared/currency/currencies/iso4217/index.ts (+1633 -0)
packages/loot-core/src/shared/currency/getCurrency.ts (+18 -0)
packages/loot-core/src/shared/currency/getCurrencyList.ts (+17 -0)
packages/loot-core/src/shared/currency/index.ts (+19 -0)
packages/loot-core/src/shared/currency/integerToMonetaryUnit.ts (+13 -0)
📝 packages/loot-core/src/shared/util.ts (+23 -9)
📝 packages/loot-core/src/types/prefs.d.ts (+2 -0)

📄 Description

Initial demonstration for adding Currency Support to Actual Budget.

There is still a lot of work to be done. But take a look at settings and try different currencies with symbols. Also, open console and save MonetaryUnit and currency object to a variables to test them out.

currency object:
getCurrency(currencyCode)

  • currencyCode is a string with the 3 letter currency code (ie 'eur', 'usd', etc)
    getCurrencyList(listType)
  • listType can be null, 'iso4217', or 'crypto'
    integerToMontaryUnit(amount, currencyCode)
  • amount with decimal removed ie $5.31 -> 531
  • same as currencyCode above
  • returns a MonetaryUnit

MonetaryUnit(amount, currencyCode):

  • toString(format)
    • format
type CurrencyFormat = {
  locale?: string;          // 'en-US', etc
  hideFraction?: boolean;
  showSymbol?: boolean;
  showCurrencyCode?: boolean;
};
  • valueOf() returns the internal value in BitInt
  • currency currency object for this monetary unit
  • convertTo(currency, exchangeRate)
  • getExchangeRate() Todo

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/3658 **Author:** [@tlesicka](https://github.com/tlesicka) **Created:** 10/13/2024 **Status:** ❌ Closed **Base:** `master` ← **Head:** `currency-support` --- ### 📝 Commits (7) - [`fc06eba`](https://github.com/actualbudget/actual/commit/fc06ebaead7335d67a5f2099f464ab57ecff252e) Initial Commit - [`7fa9870`](https://github.com/actualbudget/actual/commit/7fa987080a6401bb07907271e4c40ebf9e66afba) Fixed errors - [`ec4b0ee`](https://github.com/actualbudget/actual/commit/ec4b0ee0482ff4ee639713078c18b63191e92bfc) added a testing object to the console - [`1386e34`](https://github.com/actualbudget/actual/commit/1386e3400e8b445c14ce70b52eb1719fa3bf8d8e) Merge branch 'actualbudget:master' into currency-support - [`f178b9a`](https://github.com/actualbudget/actual/commit/f178b9a0b3ade526988b3d984975f11d5c278dbf) Merge remote-tracking branch 'upstream/master' into currency-support - [`96ebe94`](https://github.com/actualbudget/actual/commit/96ebe9488ea369d38631f1e7a7914de76248018a) Merge branch 'actualbudget:master' into currency-support - [`1d65286`](https://github.com/actualbudget/actual/commit/1d652869993b2847be3b2e88626e19a81a9135a6) Merge branch 'actualbudget:master' into currency-support ### 📊 Changes **15 files changed** (+1972 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/settings/Format.tsx` (+55 -8) 📝 `packages/desktop-client/src/components/sidebar/Account.tsx` (+5 -1) 📝 `packages/desktop-client/src/components/sidebar/Sidebar.tsx` (+9 -0) 📝 `packages/desktop-client/src/components/spreadsheet/CellValue.tsx` (+9 -2) 📝 `packages/desktop-client/src/components/spreadsheet/useFormat.ts` (+43 -11) ➕ `packages/loot-core/src/shared/currency/MonetaryUnit/index.ts` (+103 -0) ➕ `packages/loot-core/src/shared/currency/currencies/crypto/index.ts` (+12 -0) ➕ `packages/loot-core/src/shared/currency/currencies/index.ts` (+11 -0) ➕ `packages/loot-core/src/shared/currency/currencies/iso4217/index.ts` (+1633 -0) ➕ `packages/loot-core/src/shared/currency/getCurrency.ts` (+18 -0) ➕ `packages/loot-core/src/shared/currency/getCurrencyList.ts` (+17 -0) ➕ `packages/loot-core/src/shared/currency/index.ts` (+19 -0) ➕ `packages/loot-core/src/shared/currency/integerToMonetaryUnit.ts` (+13 -0) 📝 `packages/loot-core/src/shared/util.ts` (+23 -9) 📝 `packages/loot-core/src/types/prefs.d.ts` (+2 -0) </details> ### 📄 Description Initial demonstration for adding Currency Support to Actual Budget. There is still a lot of work to be done. But take a look at settings and try different currencies with symbols. Also, open console and save MonetaryUnit and currency object to a variables to test them out. currency object: ```getCurrency(currencyCode)``` - ```currencyCode``` is a string with the 3 letter currency code (ie ```'eur'```, ```'usd'```, etc) ```getCurrencyList(listType)``` - ```listType``` can be ```null```, ```'iso4217'```, or ```'crypto'``` ```integerToMontaryUnit(amount, currencyCode)``` - ```amount``` with decimal removed ie $5.31 -> 531 - same as ```currencyCode``` above - returns a ```MonetaryUnit``` ```MonetaryUnit(amount, currencyCode)```: - ```toString(format)``` - ```format``` ``` type CurrencyFormat = { locale?: string; // 'en-US', etc hideFraction?: boolean; showSymbol?: boolean; showCurrencyCode?: boolean; }; ``` - ```valueOf()``` returns the internal value in BitInt - ```currency``` currency object for this monetary unit - ```convertTo(currency, exchangeRate)``` - ```getExchangeRate()``` Todo --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-10 21:17:46 -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#12046