Skip to content

Open-source personal finance manager. Self-hosted, privacy-first.

feat: add South African rand (ZAR) currency support (#1225)

Shayn Hornik0ea8393d1e67
diff --git a/backend/app/api/currencies.py b/backend/app/api/currencies.py
index 222fa109..5e47b864 100644
--- a/backend/app/api/currencies.py
+++ b/backend/app/api/currencies.py
@@ -54,6 +54,7 @@ CURRENCY_META = {
"MKD": {"symbol": "ден", "name": "Macedonian Denar", "flag": "\U0001F1F2\U0001F1F0"},
"HKD": {"symbol": "HK$", "name": "Hong Kong Dollar", "flag": "\U0001F1ED\U0001F1F0"},
"TWD": {"symbol": "NT$", "name": "New Taiwan Dollar", "flag": "\U0001F1F9\U0001F1FC"},
+ "ZAR": {"symbol": "R", "name": "South African Rand", "flag": "\U0001F1FF\U0001F1E6"},
}
diff --git a/backend/app/core/config.py b/backend/app/core/config.py
index d40802ba..87bd419e 100644
--- a/backend/app/core/config.py
+++ b/backend/app/core/config.py
@@ -72,7 +72,7 @@ class Settings(BaseSettings):
# FX Rates
openexchangerates_app_id: str = ""
- supported_currencies: str = "USD,EUR,GBP,BRL,CAD,AUD,CHF,ARS,JPY,MXN,INR,SEK,DKK,NOK,PLN,CZK,HUF,RON,CRC,IDR,COP,CLP,DOP,KZT,RUB,GTQ,PHP,UAH,NZD,VND,SGD,AZN,TRY,PKR,MDL,AED,THB,EGP,MYR,CNY,SAR,QAR,JMD,RSD,MKD,HKD,TWD" # comma-separated list
+ supported_currencies: str = "USD,EUR,GBP,BRL,CAD,AUD,CHF,ARS,JPY,MXN,INR,SEK,DKK,NOK,PLN,CZK,HUF,RON,CRC,IDR,COP,CLP,DOP,KZT,RUB,GTQ,PHP,UAH,NZD,VND,SGD,AZN,TRY,PKR,MDL,AED,THB,EGP,MYR,CNY,SAR,QAR,JMD,RSD,MKD,HKD,TWD,ZAR" # comma-separated list
fx_sync_mode: str = "on_demand" # "on_demand" or "scheduled"
# Storage
diff --git a/backend/tests/test_currencies_api.py b/backend/tests/test_currencies_api.py
index ed44b482..ce055f5d 100644
--- a/backend/tests/test_currencies_api.py
+++ b/backend/tests/test_currencies_api.py
@@ -275,3 +275,15 @@ async def test_currencies_include_twd_with_metadata(client: AsyncClient):
assert twd["symbol"] == "NT$"
assert twd["name"] == "New Taiwan Dollar"
assert twd["flag"] == "🇹🇼"
+
+
+async def test_currencies_include_zar_with_metadata(client: AsyncClient):
+ response = await client.get("/api/currencies")
+ data = response.json()
+ zar = next((currency for currency in data if currency["code"] == "ZAR"), None)
+
+ assert zar is not None
+ assert zar["symbol"] == "R"
+ assert zar["name"] == "South African Rand"
+ assert zar["flag"] == "🇿🇦"
diff --git a/frontend/src/components/currency-select.tsx b/frontend/src/components/currency-select.tsx
index e0141e61..256c5534 100644
--- a/frontend/src/components/currency-select.tsx
+++ b/frontend/src/components/currency-select.tsx
@@ -57,6 +57,7 @@ export const CURRENCIES = [
{ code: 'MKD', flag: '\u{1F1F2}\u{1F1F0}', symbol: 'ден' },
{ code: 'HKD', flag: '\u{1F1ED}\u{1F1F0}', symbol: 'HK$' },
{ code: 'TWD', flag: '\u{1F1F9}\u{1F1FC}', symbol: 'NT$' },
+ { code: 'ZAR', flag: '\u{1F1FF}\u{1F1E6}', symbol: 'R' },
] as const
interface CurrencySelectProps {
diff --git a/frontend/src/lib/format.test.ts b/frontend/src/lib/format.test.ts
index 75c266cc..ebd2525f 100644
--- a/frontend/src/lib/format.test.ts
+++ b/frontend/src/lib/format.test.ts
@@ -36,6 +36,7 @@ describe('resolveDisplayLocale', () => {
expect(resolveDisplayLocale('auto', 'MKD')).toBe('mk-MK')
expect(resolveDisplayLocale('auto', 'HKD')).toBe('zh-HK')
expect(resolveDisplayLocale('auto', 'TWD')).toBe('zh-TW')
+ expect(resolveDisplayLocale('auto', 'ZAR')).toBe('en-ZA')
})
it('treats a missing number format like auto', () => {
diff --git a/frontend/src/lib/format.ts b/frontend/src/lib/format.ts
index e083a2c4..ee392bd7 100644
--- a/frontend/src/lib/format.ts
+++ b/frontend/src/lib/format.ts
@@ -79,6 +79,7 @@ const CURRENCY_LOCALE: Record<string, string> = {
MKD: 'mk-MK',
HKD: 'zh-HK',
TWD: 'zh-TW',
+ ZAR: 'en-ZA',
}
/**