diff --git a/.env.example b/.env.example
index b4e87f5..6002a9b 100644
--- a/.env.example
+++ b/.env.example
@@ -1,4 +1,4 @@
POSTGRES_PRISMA_URL=postgresql://postgres:1234@localhost
POSTGRES_URL_NON_POOLING=postgresql://postgres:1234@localhost
-NEXT_PUBLIC_DEFAULT_CURRENCY_SYMBOL=""
\ No newline at end of file
+NEXT_PUBLIC_DEFAULT_CURRENCY_CODE=""
\ No newline at end of file
diff --git a/messages/en-US.json b/messages/en-US.json
index 52b37a3..f5ded7c 100644
--- a/messages/en-US.json
+++ b/messages/en-US.json
@@ -98,7 +98,8 @@
},
"CurrencyCodeField": {
"label": "Main currency",
- "description": "All amounts and balances will be in this currency. Changing this will NOT convert expenses already entered.",
+ "createDescription": "All amounts and balances will be in this currency.",
+ "editDescription": "All amounts and balances will be in this currency. Changing this will NOT convert expenses already entered, except when the currency has different \"minor units\" than the current one (e.g. changing from US Dollar to Japanese Yen)",
"customOption": "Custom"
},
"Participants": {
diff --git a/package-lock.json b/package-lock.json
index ca9c2d1..21b75a1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5274,6 +5274,126 @@
"url": "https://github.com/sponsors/isaacs"
}
},
+ "node_modules/@next/swc-darwin-arm64": {
+ "version": "14.2.28",
+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.28.tgz",
+ "integrity": "sha512-kzGChl9setxYWpk3H6fTZXXPFFjg7urptLq5o5ZgYezCrqlemKttwMT5iFyx/p1e/JeglTwDFRtb923gTJ3R1w==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-darwin-x64": {
+ "version": "14.2.28",
+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.28.tgz",
+ "integrity": "sha512-z6FXYHDJlFOzVEOiiJ/4NG8aLCeayZdcRSMjPDysW297Up6r22xw6Ea9AOwQqbNsth8JNgIK8EkWz2IDwaLQcw==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-arm64-gnu": {
+ "version": "14.2.28",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.28.tgz",
+ "integrity": "sha512-9ARHLEQXhAilNJ7rgQX8xs9aH3yJSj888ssSjJLeldiZKR4D7N08MfMqljk77fAwZsWwsrp8ohHsMvurvv9liQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-arm64-musl": {
+ "version": "14.2.28",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.28.tgz",
+ "integrity": "sha512-p6gvatI1nX41KCizEe6JkF0FS/cEEF0u23vKDpl+WhPe/fCTBeGkEBh7iW2cUM0rvquPVwPWdiUR6Ebr/kQWxQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-x64-gnu": {
+ "version": "14.2.28",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.28.tgz",
+ "integrity": "sha512-nsiSnz2wO6GwMAX2o0iucONlVL7dNgKUqt/mDTATGO2NY59EO/ZKnKEr80BJFhuA5UC1KZOMblJHWZoqIJddpA==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-x64-musl": {
+ "version": "14.2.28",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.28.tgz",
+ "integrity": "sha512-+IuGQKoI3abrXFqx7GtlvNOpeExUH1mTIqCrh1LGFf8DnlUcTmOOCApEnPJUSLrSbzOdsF2ho2KhnQoO0I1RDw==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-win32-arm64-msvc": {
+ "version": "14.2.28",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.28.tgz",
+ "integrity": "sha512-l61WZ3nevt4BAnGksUVFKy2uJP5DPz2E0Ma/Oklvo3sGj9sw3q7vBWONFRgz+ICiHpW5mV+mBrkB3XEubMrKaA==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-win32-ia32-msvc": {
+ "version": "14.2.28",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.28.tgz",
+ "integrity": "sha512-+Kcp1T3jHZnJ9v9VTJ/yf1t/xmtFAc/Sge4v7mVc1z+NYfYzisi8kJ9AsY8itbgq+WgEwMtOpiLLJsUy2qnXZw==",
+ "cpu": [
+ "ia32"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
"node_modules/@next/swc-win32-x64-msvc": {
"version": "14.2.28",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.28.tgz",
diff --git a/src/app/groups/[groupId]/expenses/create-from-receipt-button.tsx b/src/app/groups/[groupId]/expenses/create-from-receipt-button.tsx
index 4e06c71..53a6d72 100644
--- a/src/app/groups/[groupId]/expenses/create-from-receipt-button.tsx
+++ b/src/app/groups/[groupId]/expenses/create-from-receipt-button.tsx
@@ -26,7 +26,12 @@ import {
import { ToastAction } from '@/components/ui/toast'
import { useToast } from '@/components/ui/use-toast'
import { useMediaQuery } from '@/lib/hooks'
-import { formatCurrency, formatDate, formatFileSize, getCurrencyFromGroup } from '@/lib/utils'
+import {
+ formatCurrency,
+ formatDate,
+ formatFileSize,
+ getCurrencyFromGroup,
+} from '@/lib/utils'
import { trpc } from '@/trpc/client'
import { ChevronRight, FileQuestion, Loader2, Receipt } from 'lucide-react'
import { useLocale, useTranslations } from 'next-intl'
diff --git a/src/components/group-form.tsx b/src/components/group-form.tsx
index 5cf2410..ea3235e 100644
--- a/src/components/group-form.tsx
+++ b/src/components/group-form.tsx
@@ -72,7 +72,7 @@ export function GroupForm({
: {
name: '',
information: '',
- currency: process.env.NEXT_PUBLIC_DEFAULT_CURRENCY_SYMBOL || '',
+ currencyCode: process.env.NEXT_PUBLIC_DEFAULT_CURRENCY_CODE || 'USD', // TODO: If NEXT_PUBLIC_DEFAULT_CURRENCY_CODE, is not set, determine the default currency code based on locale
participants: [
{ name: t('Participants.John') },
{ name: t('Participants.Jane') },
@@ -176,7 +176,11 @@ export function GroupForm({
isLoading={false}
/>
- {t('CurrencyCodeField.description')}
+ {t(
+ group
+ ? 'CurrencyCodeField.editDescription'
+ : 'CurrencyCodeField.createDescription',
+ )}
@@ -187,13 +191,12 @@ export function GroupForm({
control={form.control}
name="currency"
render={({ field }) => (
-
+
{t('CurrencyField.label')}
diff --git a/src/lib/currency-data.json b/src/lib/currency-data.json
index b8ac853..08478e8 100644
--- a/src/lib/currency-data.json
+++ b/src/lib/currency-data.json
@@ -1903,6 +1903,278 @@
"decimal_digits": 2
}
},
+ "ja-JP": {
+ "USD": {
+ "name": "米ドル",
+ "symbol_native": "$",
+ "symbol": "$",
+ "code": "USD",
+ "name_plural": "US dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "EUR": {
+ "name": "ユーロ",
+ "symbol_native": "€",
+ "symbol": "€",
+ "code": "EUR",
+ "name_plural": "euros",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "JPY": {
+ "name": "日本円",
+ "symbol_native": "¥",
+ "symbol": "¥",
+ "code": "JPY",
+ "name_plural": "Japanese yen",
+ "rounding": 0,
+ "decimal_digits": 0
+ },
+ "BGN": {
+ "name": "ブルガリア 新レフ",
+ "symbol_native": "лв.",
+ "symbol": "BGN",
+ "code": "BGN",
+ "name_plural": "Bulgarian leva",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "CZK": {
+ "name": "チェコ コルナ",
+ "symbol_native": "Kč",
+ "symbol": "Kč",
+ "code": "CZK",
+ "name_plural": "Czech Republic korunas",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "DKK": {
+ "name": "デンマーク クローネ",
+ "symbol_native": "kr",
+ "symbol": "Dkr",
+ "code": "DKK",
+ "name_plural": "Danish kroner",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "GBP": {
+ "name": "英国ポンド",
+ "symbol_native": "£",
+ "symbol": "£",
+ "code": "GBP",
+ "name_plural": "British pounds sterling",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "HUF": {
+ "name": "ハンガリー フォリント",
+ "symbol_native": "Ft",
+ "symbol": "Ft",
+ "code": "HUF",
+ "name_plural": "Hungarian forints",
+ "rounding": 0,
+ "decimal_digits": 0
+ },
+ "PLN": {
+ "name": "ポーランド ズウォティ",
+ "symbol_native": "zł",
+ "symbol": "zł",
+ "code": "PLN",
+ "name_plural": "Polish zlotys",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "RON": {
+ "name": "ルーマニア レイ",
+ "symbol_native": "RON",
+ "symbol": "RON",
+ "code": "RON",
+ "name_plural": "Romanian lei",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "SEK": {
+ "name": "スウェーデン クローナ",
+ "symbol_native": "kr",
+ "symbol": "Skr",
+ "code": "SEK",
+ "name_plural": "Swedish kronor",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "CHF": {
+ "name": "スイス フラン",
+ "symbol_native": "CHF",
+ "symbol": "CHF",
+ "code": "CHF",
+ "name_plural": "Swiss francs",
+ "rounding": 0.05,
+ "decimal_digits": 2
+ },
+ "ISK": {
+ "name": "アイスランド クローナ",
+ "symbol_native": "kr",
+ "symbol": "Ikr",
+ "code": "ISK",
+ "name_plural": "Icelandic krónur",
+ "rounding": 0,
+ "decimal_digits": 0
+ },
+ "NOK": {
+ "name": "ノルウェー クローネ",
+ "symbol_native": "kr",
+ "symbol": "Nkr",
+ "code": "NOK",
+ "name_plural": "Norwegian kroner",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "TRY": {
+ "name": "新トルコリラ",
+ "symbol_native": "₺",
+ "symbol": "TL",
+ "code": "TRY",
+ "name_plural": "Turkish Lira",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "AUD": {
+ "name": "オーストラリア ドル",
+ "symbol_native": "$",
+ "symbol": "AU$",
+ "code": "AUD",
+ "name_plural": "Australian dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "BRL": {
+ "name": "ブラジル レアル",
+ "symbol_native": "R$",
+ "symbol": "R$",
+ "code": "BRL",
+ "name_plural": "Brazilian reals",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "CAD": {
+ "name": "カナダ ドル",
+ "symbol_native": "$",
+ "symbol": "CA$",
+ "code": "CAD",
+ "name_plural": "Canadian dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "CNY": {
+ "name": "中国人民元",
+ "symbol_native": "CN¥",
+ "symbol": "CN¥",
+ "code": "CNY",
+ "name_plural": "Chinese yuan",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "HKD": {
+ "name": "香港ドル",
+ "symbol_native": "$",
+ "symbol": "HK$",
+ "code": "HKD",
+ "name_plural": "Hong Kong dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "IDR": {
+ "name": "インドネシア ルピア",
+ "symbol_native": "Rp",
+ "symbol": "Rp",
+ "code": "IDR",
+ "name_plural": "Indonesian rupiahs",
+ "rounding": 0,
+ "decimal_digits": 0
+ },
+ "ILS": {
+ "name": "イスラエル新シェケル",
+ "symbol_native": "₪",
+ "symbol": "₪",
+ "code": "ILS",
+ "name_plural": "Israeli new sheqels",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "INR": {
+ "name": "インド ルピー",
+ "symbol_native": "টকা",
+ "symbol": "Rs",
+ "code": "INR",
+ "name_plural": "Indian rupees",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "KRW": {
+ "name": "韓国ウォン",
+ "symbol_native": "₩",
+ "symbol": "₩",
+ "code": "KRW",
+ "name_plural": "South Korean won",
+ "rounding": 0,
+ "decimal_digits": 0
+ },
+ "MXN": {
+ "name": "メキシコ ペソ",
+ "symbol_native": "$",
+ "symbol": "MX$",
+ "code": "MXN",
+ "name_plural": "Mexican pesos",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "NZD": {
+ "name": "ニュージーランド ドル",
+ "symbol_native": "$",
+ "symbol": "NZ$",
+ "code": "NZD",
+ "name_plural": "New Zealand dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "PHP": {
+ "name": "フィリピン ペソ",
+ "symbol_native": "₱",
+ "symbol": "₱",
+ "code": "PHP",
+ "name_plural": "Philippine pesos",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "SGD": {
+ "name": "シンガポール ドル",
+ "symbol_native": "$",
+ "symbol": "S$",
+ "code": "SGD",
+ "name_plural": "Singapore dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "THB": {
+ "name": "タイ バーツ",
+ "symbol_native": "฿",
+ "symbol": "฿",
+ "code": "THB",
+ "name_plural": "Thai baht",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "ZAR": {
+ "name": "南アフリカ ランド",
+ "symbol_native": "R",
+ "symbol": "R",
+ "code": "ZAR",
+ "name_plural": "South African rand",
+ "rounding": 0,
+ "decimal_digits": 2
+ }
+ },
"pl-PL": {
"USD": {
"name": "dolar amerykański",
@@ -4078,5 +4350,549 @@
"rounding": 0,
"decimal_digits": 2
}
+ },
+ "ca": {
+ "USD": {
+ "name": "dòlar dels Estats Units",
+ "symbol_native": "$",
+ "symbol": "$",
+ "code": "USD",
+ "name_plural": "US dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "EUR": {
+ "name": "euro",
+ "symbol_native": "€",
+ "symbol": "€",
+ "code": "EUR",
+ "name_plural": "euros",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "JPY": {
+ "name": "ien japonès",
+ "symbol_native": "¥",
+ "symbol": "¥",
+ "code": "JPY",
+ "name_plural": "Japanese yen",
+ "rounding": 0,
+ "decimal_digits": 0
+ },
+ "BGN": {
+ "name": "lev búlgar",
+ "symbol_native": "лв.",
+ "symbol": "BGN",
+ "code": "BGN",
+ "name_plural": "Bulgarian leva",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "CZK": {
+ "name": "corona txeca",
+ "symbol_native": "Kč",
+ "symbol": "Kč",
+ "code": "CZK",
+ "name_plural": "Czech Republic korunas",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "DKK": {
+ "name": "corona danesa",
+ "symbol_native": "kr",
+ "symbol": "Dkr",
+ "code": "DKK",
+ "name_plural": "Danish kroner",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "GBP": {
+ "name": "lliura esterlina britànica",
+ "symbol_native": "£",
+ "symbol": "£",
+ "code": "GBP",
+ "name_plural": "British pounds sterling",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "HUF": {
+ "name": "fòrint hongarès",
+ "symbol_native": "Ft",
+ "symbol": "Ft",
+ "code": "HUF",
+ "name_plural": "Hungarian forints",
+ "rounding": 0,
+ "decimal_digits": 0
+ },
+ "PLN": {
+ "name": "zloty polonès",
+ "symbol_native": "zł",
+ "symbol": "zł",
+ "code": "PLN",
+ "name_plural": "Polish zlotys",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "RON": {
+ "name": "leu romanès",
+ "symbol_native": "RON",
+ "symbol": "RON",
+ "code": "RON",
+ "name_plural": "Romanian lei",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "SEK": {
+ "name": "corona sueca",
+ "symbol_native": "kr",
+ "symbol": "Skr",
+ "code": "SEK",
+ "name_plural": "Swedish kronor",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "CHF": {
+ "name": "franc suís",
+ "symbol_native": "CHF",
+ "symbol": "CHF",
+ "code": "CHF",
+ "name_plural": "Swiss francs",
+ "rounding": 0.05,
+ "decimal_digits": 2
+ },
+ "ISK": {
+ "name": "corona islandesa",
+ "symbol_native": "kr",
+ "symbol": "Ikr",
+ "code": "ISK",
+ "name_plural": "Icelandic krónur",
+ "rounding": 0,
+ "decimal_digits": 0
+ },
+ "NOK": {
+ "name": "corona noruega",
+ "symbol_native": "kr",
+ "symbol": "Nkr",
+ "code": "NOK",
+ "name_plural": "Norwegian kroner",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "TRY": {
+ "name": "lira turca",
+ "symbol_native": "₺",
+ "symbol": "TL",
+ "code": "TRY",
+ "name_plural": "Turkish Lira",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "AUD": {
+ "name": "dòlar australià",
+ "symbol_native": "$",
+ "symbol": "AU$",
+ "code": "AUD",
+ "name_plural": "Australian dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "BRL": {
+ "name": "real brasiler",
+ "symbol_native": "R$",
+ "symbol": "R$",
+ "code": "BRL",
+ "name_plural": "Brazilian reals",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "CAD": {
+ "name": "dòlar canadenc",
+ "symbol_native": "$",
+ "symbol": "CA$",
+ "code": "CAD",
+ "name_plural": "Canadian dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "CNY": {
+ "name": "iuan xinès",
+ "symbol_native": "CN¥",
+ "symbol": "CN¥",
+ "code": "CNY",
+ "name_plural": "Chinese yuan",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "HKD": {
+ "name": "dòlar de Hong Kong",
+ "symbol_native": "$",
+ "symbol": "HK$",
+ "code": "HKD",
+ "name_plural": "Hong Kong dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "IDR": {
+ "name": "rupia indonèsia",
+ "symbol_native": "Rp",
+ "symbol": "Rp",
+ "code": "IDR",
+ "name_plural": "Indonesian rupiahs",
+ "rounding": 0,
+ "decimal_digits": 0
+ },
+ "ILS": {
+ "name": "nou xéquel israelià",
+ "symbol_native": "₪",
+ "symbol": "₪",
+ "code": "ILS",
+ "name_plural": "Israeli new sheqels",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "INR": {
+ "name": "rupia índia",
+ "symbol_native": "টকা",
+ "symbol": "Rs",
+ "code": "INR",
+ "name_plural": "Indian rupees",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "KRW": {
+ "name": "won sud-coreà",
+ "symbol_native": "₩",
+ "symbol": "₩",
+ "code": "KRW",
+ "name_plural": "South Korean won",
+ "rounding": 0,
+ "decimal_digits": 0
+ },
+ "MXN": {
+ "name": "peso mexicà",
+ "symbol_native": "$",
+ "symbol": "MX$",
+ "code": "MXN",
+ "name_plural": "Mexican pesos",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "NZD": {
+ "name": "dòlar neozelandès",
+ "symbol_native": "$",
+ "symbol": "NZ$",
+ "code": "NZD",
+ "name_plural": "New Zealand dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "PHP": {
+ "name": "peso filipí",
+ "symbol_native": "₱",
+ "symbol": "₱",
+ "code": "PHP",
+ "name_plural": "Philippine pesos",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "SGD": {
+ "name": "dòlar de Singapur",
+ "symbol_native": "$",
+ "symbol": "S$",
+ "code": "SGD",
+ "name_plural": "Singapore dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "THB": {
+ "name": "baht tailandès",
+ "symbol_native": "฿",
+ "symbol": "฿",
+ "code": "THB",
+ "name_plural": "Thai baht",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "ZAR": {
+ "name": "rand sud-africà",
+ "symbol_native": "R",
+ "symbol": "R",
+ "code": "ZAR",
+ "name_plural": "South African rand",
+ "rounding": 0,
+ "decimal_digits": 2
+ }
+ },
+ "cs-CZ": {
+ "USD": {
+ "name": "americký dolar",
+ "symbol_native": "$",
+ "symbol": "$",
+ "code": "USD",
+ "name_plural": "US dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "EUR": {
+ "name": "euro",
+ "symbol_native": "€",
+ "symbol": "€",
+ "code": "EUR",
+ "name_plural": "euros",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "JPY": {
+ "name": "japonský jen",
+ "symbol_native": "¥",
+ "symbol": "¥",
+ "code": "JPY",
+ "name_plural": "Japanese yen",
+ "rounding": 0,
+ "decimal_digits": 0
+ },
+ "BGN": {
+ "name": "bulharský lev",
+ "symbol_native": "лв.",
+ "symbol": "BGN",
+ "code": "BGN",
+ "name_plural": "Bulgarian leva",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "CZK": {
+ "name": "česká koruna",
+ "symbol_native": "Kč",
+ "symbol": "Kč",
+ "code": "CZK",
+ "name_plural": "Czech Republic korunas",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "DKK": {
+ "name": "dánská koruna",
+ "symbol_native": "kr",
+ "symbol": "Dkr",
+ "code": "DKK",
+ "name_plural": "Danish kroner",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "GBP": {
+ "name": "britská libra",
+ "symbol_native": "£",
+ "symbol": "£",
+ "code": "GBP",
+ "name_plural": "British pounds sterling",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "HUF": {
+ "name": "maďarský forint",
+ "symbol_native": "Ft",
+ "symbol": "Ft",
+ "code": "HUF",
+ "name_plural": "Hungarian forints",
+ "rounding": 0,
+ "decimal_digits": 0
+ },
+ "PLN": {
+ "name": "polský zlotý",
+ "symbol_native": "zł",
+ "symbol": "zł",
+ "code": "PLN",
+ "name_plural": "Polish zlotys",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "RON": {
+ "name": "rumunský leu",
+ "symbol_native": "RON",
+ "symbol": "RON",
+ "code": "RON",
+ "name_plural": "Romanian lei",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "SEK": {
+ "name": "švédská koruna",
+ "symbol_native": "kr",
+ "symbol": "Skr",
+ "code": "SEK",
+ "name_plural": "Swedish kronor",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "CHF": {
+ "name": "švýcarský frank",
+ "symbol_native": "CHF",
+ "symbol": "CHF",
+ "code": "CHF",
+ "name_plural": "Swiss francs",
+ "rounding": 0.05,
+ "decimal_digits": 2
+ },
+ "ISK": {
+ "name": "islandská koruna",
+ "symbol_native": "kr",
+ "symbol": "Ikr",
+ "code": "ISK",
+ "name_plural": "Icelandic krónur",
+ "rounding": 0,
+ "decimal_digits": 0
+ },
+ "NOK": {
+ "name": "norská koruna",
+ "symbol_native": "kr",
+ "symbol": "Nkr",
+ "code": "NOK",
+ "name_plural": "Norwegian kroner",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "TRY": {
+ "name": "turecká lira",
+ "symbol_native": "₺",
+ "symbol": "TL",
+ "code": "TRY",
+ "name_plural": "Turkish Lira",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "AUD": {
+ "name": "australský dolar",
+ "symbol_native": "$",
+ "symbol": "AU$",
+ "code": "AUD",
+ "name_plural": "Australian dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "BRL": {
+ "name": "brazilský real",
+ "symbol_native": "R$",
+ "symbol": "R$",
+ "code": "BRL",
+ "name_plural": "Brazilian reals",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "CAD": {
+ "name": "kanadský dolar",
+ "symbol_native": "$",
+ "symbol": "CA$",
+ "code": "CAD",
+ "name_plural": "Canadian dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "CNY": {
+ "name": "čínský jüan",
+ "symbol_native": "CN¥",
+ "symbol": "CN¥",
+ "code": "CNY",
+ "name_plural": "Chinese yuan",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "HKD": {
+ "name": "hongkongský dolar",
+ "symbol_native": "$",
+ "symbol": "HK$",
+ "code": "HKD",
+ "name_plural": "Hong Kong dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "IDR": {
+ "name": "indonéská rupie",
+ "symbol_native": "Rp",
+ "symbol": "Rp",
+ "code": "IDR",
+ "name_plural": "Indonesian rupiahs",
+ "rounding": 0,
+ "decimal_digits": 0
+ },
+ "ILS": {
+ "name": "izraelský nový šekel",
+ "symbol_native": "₪",
+ "symbol": "₪",
+ "code": "ILS",
+ "name_plural": "Israeli new sheqels",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "INR": {
+ "name": "indická rupie",
+ "symbol_native": "টকা",
+ "symbol": "Rs",
+ "code": "INR",
+ "name_plural": "Indian rupees",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "KRW": {
+ "name": "jihokorejský won",
+ "symbol_native": "₩",
+ "symbol": "₩",
+ "code": "KRW",
+ "name_plural": "South Korean won",
+ "rounding": 0,
+ "decimal_digits": 0
+ },
+ "MXN": {
+ "name": "mexické peso",
+ "symbol_native": "$",
+ "symbol": "MX$",
+ "code": "MXN",
+ "name_plural": "Mexican pesos",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "NZD": {
+ "name": "novozélandský dolar",
+ "symbol_native": "$",
+ "symbol": "NZ$",
+ "code": "NZD",
+ "name_plural": "New Zealand dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "PHP": {
+ "name": "filipínské peso",
+ "symbol_native": "₱",
+ "symbol": "₱",
+ "code": "PHP",
+ "name_plural": "Philippine pesos",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "SGD": {
+ "name": "singapurský dolar",
+ "symbol_native": "$",
+ "symbol": "S$",
+ "code": "SGD",
+ "name_plural": "Singapore dollars",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "THB": {
+ "name": "thajský baht",
+ "symbol_native": "฿",
+ "symbol": "฿",
+ "code": "THB",
+ "name_plural": "Thai baht",
+ "rounding": 0,
+ "decimal_digits": 2
+ },
+ "ZAR": {
+ "name": "jihoafrický rand",
+ "symbol_native": "R",
+ "symbol": "R",
+ "code": "ZAR",
+ "name_plural": "South African rand",
+ "rounding": 0,
+ "decimal_digits": 2
+ }
}
}
diff --git a/src/lib/env.ts b/src/lib/env.ts
index de28453..dad5025 100644
--- a/src/lib/env.ts
+++ b/src/lib/env.ts
@@ -21,7 +21,7 @@ const envSchema = z
interpretEnvVarAsBool,
z.boolean().default(false),
),
- NEXT_PUBLIC_DEFAULT_CURRENCY_SYMBOL: z.string().optional(),
+ NEXT_PUBLIC_DEFAULT_CURRENCY_CODE: z.string().optional(),
S3_UPLOAD_KEY: z.string().optional(),
S3_UPLOAD_SECRET: z.string().optional(),
S3_UPLOAD_BUCKET: z.string().optional(),
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index 8083f1a..25508e3 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -81,7 +81,11 @@ export function getCurrencyFromGroup(
* @param amount The amount, as the number of minor units of currency (cents for most currencies)
* @param round Whether to round the amount to the nearest minor unit (e.g.: 1.5612 € => 1.56 €)
*/
-export function amountAsDecimal(amount: number, currency: Currency, round = false) {
+export function amountAsDecimal(
+ amount: number,
+ currency: Currency,
+ round = false,
+) {
const decimal = amount / 10 ** currency.decimal_digits
if (round) {
return Number(decimal.toFixed(currency.decimal_digits))