A local-first personal finance app
Add Indian Rupee (INR) Currency (#5483)
Emil Georgeac77c0f3601c
diff --git a/packages/desktop-client/src/components/settings/Currency.tsx b/packages/desktop-client/src/components/settings/Currency.tsxindex 4a4d8f3033..766b155aae 100644--- a/packages/desktop-client/src/components/settings/Currency.tsx+++ b/packages/desktop-client/src/components/settings/Currency.tsx@@ -1,4 +1,4 @@-import React, { ReactNode } from 'react';+import React, { useMemo } from 'react';import { useTranslation, Trans } from 'react-i18next';import { Select } from '@actual-app/components/select';@@ -17,6 +17,29 @@ import { useSyncedPref } from '@desktop-client/hooks/useSyncedPref';export function CurrencySettings() {const { t } = useTranslation();+ const currencyTranslations = useMemo(+ () =>+ new Map<string, string>([+ ['', t('None')],+ ['AUD', t('Australian Dollar')],+ ['CAD', t('Canadian Dollar')],+ ['CHF', t('Swiss Franc')],+ ['CNY', t('Yuan Renminbi')],+ ['EUR', t('Euro')],+ ['GBP', t('Pound Sterling')],+ ['HKD', t('Hong Kong Dollar')],+ ['INR', t('Indian Rupee')],+ // ['JPY', t('Yen')],+ ['PHP', t('Philippine Peso')],+ ['SEK', t('Swedish Krona')],+ ['SGD', t('Singapore Dollar')],+ ['TRY', t('Turkish Lira')],+ ['USD', t('US Dollar')],+ ['QAR', t('Qatari Riyal')],+ ]),+ [t],+ );+const [defaultCurrencyCode, setDefaultCurrencyCodePref] = useSyncedPref('defaultCurrencyCode',);@@ -35,24 +58,6 @@ export function CurrencySettings() {},});- const currencyTranslations = new Map([- ['', t('None')],- ['AUD', t('Australian Dollar')],- ['CAD', t('Canadian Dollar')],- ['CHF', t('Swiss Franc')],- ['CNY', t('Yuan Renminbi')],- ['EUR', t('Euro')],- ['GBP', t('Pound Sterling')],- ['HKD', t('Hong Kong Dollar')],- // ['JPY', t('Yen')],- ['PHP', t('Philippine Peso')],- ['SEK', t('Swedish Krona')],- ['SGD', t('Singapore Dollar')],- ['TRY', t('Turkish Lira')],- ['USD', t('US Dollar')],- ['QAR', t('Qatari Riyal')],- ]);-const currencyOptions: [string, string][] = currencies.map(currency => {const translatedName =currencyTranslations.get(currency.code) ?? currency.name;diff --git a/packages/loot-core/src/shared/currencies.ts b/packages/loot-core/src/shared/currencies.tsindex 6a3607b05f..7776228b79 100644--- a/packages/loot-core/src/shared/currencies.ts+++ b/packages/loot-core/src/shared/currencies.ts@@ -19,6 +19,7 @@ export const currencies: Currency[] = [{ code: 'EUR', name: 'Euro', symbol: '€', decimalPlaces: 2 },{ code: 'GBP', name: 'Pound Sterling', symbol: '£', decimalPlaces: 2 },{ code: 'HKD', name: 'Hong Kong Dollar', symbol: 'HK$', decimalPlaces: 2 },+ { code: 'INR', name: 'Indian Rupee', symbol: '₹', decimalPlaces: 2 },// { code: 'JPY', name: 'Yen', symbol: '¥', decimalPlaces: 0 },{ code: 'PHP', name: 'Philippine Peso', symbol: '₱', decimalPlaces: 2 },{ code: 'SEK', name: 'Swedish Krona', symbol: 'kr', decimalPlaces: 2 },diff --git a/upcoming-release-notes/5483.md b/upcoming-release-notes/5483.mdnew file mode 100644index 0000000000..f0e8158b39--- /dev/null+++ b/upcoming-release-notes/5483.md@@ -0,0 +1,6 @@+---+category: Enhancements+authors: [emilgeo]+---++Add Indian Rupee (INR) currency