Skip to content

A local-first personal finance app

Dynamic currency display options (#5744)

Stephen Brown IIf4419b96dede
diff --git a/packages/desktop-client/src/components/settings/Currency.tsx b/packages/desktop-client/src/components/settings/Currency.tsx
index ed363347c1..ce8d6c0223 100644
--- a/packages/desktop-client/src/components/settings/Currency.tsx
+++ b/packages/desktop-client/src/components/settings/Currency.tsx
@@ -7,7 +7,7 @@ import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';
import { css } from '@emotion/css';
-import { currencies } from 'loot-core/shared/currencies';
+import { currencies, getCurrency } from 'loot-core/shared/currencies';
import { Column, Setting } from './UI';
@@ -85,10 +85,22 @@ export function CurrencySettings() {
setDefaultCurrencyCodePref(code);
};
- const symbolPositionOptions = [
- { value: 'before', label: t('Before amount (e.g. $100)') },
- { value: 'after', label: t('After amount (e.g. 100€)') },
- ];
+ const symbolPositionOptions = useMemo(() => {
+ const selectedCurrency = getCurrency(selectedCurrencyCode);
+ const symbol = selectedCurrency.symbol || '$';
+ const space = spaceEnabled === 'true' ? ' ' : '';
+
+ return [
+ {
+ value: 'before',
+ label: `${t('Before amount')} (${t('e.g.')} ${symbol}${space}100)`,
+ },
+ {
+ value: 'after',
+ label: `${t('After amount')} (${t('e.g.')} 100${space}${symbol})`,
+ },
+ ];
+ }, [selectedCurrencyCode, spaceEnabled, t]);
return (
<Setting
diff --git a/upcoming-release-notes/5744.md b/upcoming-release-notes/5744.md
new file mode 100644
index 0000000000..21650b1610
--- /dev/null
+++ b/upcoming-release-notes/5744.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [StephenBrown2]
+---
+
+Dynamically update currency display options