Open-source personal finance manager. Self-hosted, privacy-first.
feat: add Saudi riyal (SAR) and Qatari riyal (QAR) currency support (#950)
Shayn Hornikb7d87e0a8cce
diff --git a/backend/app/api/currencies.py b/backend/app/api/currencies.pyindex 3338aa8c..bdb21065 100644--- a/backend/app/api/currencies.py+++ b/backend/app/api/currencies.py@@ -46,6 +46,8 @@ CURRENCY_META = {"THB": {"symbol": "\u0e3f", "name": "Thai Baht", "flag": "\U0001F1F9\U0001F1ED"},"EGP": {"symbol": "E£", "name": "Egyptian Pound", "flag": "\U0001F1EA\U0001F1EC"},"MYR": {"symbol": "RM", "name": "Malaysian Ringgit", "flag": "\U0001F1F2\U0001F1FE"},+ "SAR": {"symbol": "ر.س", "name": "Saudi Riyal", "flag": "\U0001F1F8\U0001F1E6"},+ "QAR": {"symbol": "ر.ق", "name": "Qatari Riyal", "flag": "\U0001F1F6\U0001F1E6"},}diff --git a/backend/app/core/config.py b/backend/app/core/config.pyindex 4889400d..84ae425c 100644--- a/backend/app/core/config.py+++ b/backend/app/core/config.py@@ -66,7 +66,7 @@ class Settings(BaseSettings):# FX Ratesopenexchangerates_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,RUB,GTQ,PHP,UAH,NZD,VND,SGD,AZN,TRY,PKR,MDL,AED,THB,EGP,MYR,CNY" # 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,RUB,GTQ,PHP,UAH,NZD,VND,SGD,AZN,TRY,PKR,MDL,AED,THB,EGP,MYR,CNY,SAR,QAR" # comma-separated listfx_sync_mode: str = "on_demand" # "on_demand" or "scheduled"# Storagediff --git a/backend/tests/test_currencies_api.py b/backend/tests/test_currencies_api.pyindex 7ed2e868..dec5eb93 100644--- a/backend/tests/test_currencies_api.py+++ b/backend/tests/test_currencies_api.py@@ -194,3 +194,27 @@ async def test_currencies_include_cny_with_metadata(client: AsyncClient):assert cny["symbol"] == "¥"assert cny["name"] == "Chinese Yuan"assert cny["flag"] == "🇨🇳"+++async def test_currencies_include_sar_with_metadata(client: AsyncClient):+ response = await client.get("/api/currencies")+ data = response.json()+ sar = next((currency for currency in data if currency["code"] == "SAR"), None)++ assert sar is not None+ assert sar["symbol"] == "ر.س"+ assert sar["name"] == "Saudi Riyal"+ assert sar["flag"] == "🇸🇦"+++async def test_currencies_include_qar_with_metadata(client: AsyncClient):+ response = await client.get("/api/currencies")+ data = response.json()+ qar = next((currency for currency in data if currency["code"] == "QAR"), None)++ assert qar is not None+ assert qar["symbol"] == "ر.ق"+ assert qar["name"] == "Qatari Riyal"+ assert qar["flag"] == "🇶🇦"diff --git a/frontend/src/components/currency-select.tsx b/frontend/src/components/currency-select.tsxindex 1e8cc5e2..2aed8a21 100644--- a/frontend/src/components/currency-select.tsx+++ b/frontend/src/components/currency-select.tsx@@ -49,6 +49,8 @@ export const CURRENCIES = [{ code: 'EGP', flag: '\u{1F1EA}\u{1F1EC}', symbol: 'E£' },{ code: 'MYR', flag: '\u{1F1F2}\u{1F1FE}', symbol: 'RM' },{ code: 'CNY', flag: '\u{1F1E8}\u{1F1F3}', symbol: '¥' },+ { code: 'SAR', flag: '\u{1F1F8}\u{1F1E6}', symbol: 'ر.س' },+ { code: 'QAR', flag: '\u{1F1F6}\u{1F1E6}', symbol: 'ر.ق' },] as constinterface CurrencySelectProps {diff --git a/frontend/src/lib/format.ts b/frontend/src/lib/format.tsindex e1a1f25b..153a1868 100644--- a/frontend/src/lib/format.ts+++ b/frontend/src/lib/format.ts@@ -71,6 +71,8 @@ const CURRENCY_LOCALE: Record<string, string> = {THB: 'th-TH',EGP: 'en-EG',MYR: 'ms-MY',+ SAR: 'en-SA',+ QAR: 'en-QA',}/**