feat(04-01): add locale parameter to formatCurrency, default 'en'

- Replace hardcoded 'de-DE' with optional locale parameter defaulting to 'en'
- Defensive locale || 'en' guard prevents RangeError on empty string
- All existing call sites get English formatting (FIX-01)
- Third arg enables locale-aware chart tooltips in follow-on plans
This commit is contained in:
2026-03-12 09:23:46 +01:00
parent 6ffce76de8
commit eb1bb8aeec

View File

@@ -1,5 +1,9 @@
export function formatCurrency(amount: number, currency: string = 'EUR'): string {
return new Intl.NumberFormat('de-DE', {
export function formatCurrency(
amount: number,
currency: string = 'EUR',
locale: string = 'en'
): string {
return new Intl.NumberFormat(locale || 'en', {
style: 'currency',
currency,
}).format(amount)