Add Indian Rupee (INR) Currency (#5483)

This commit is contained in:
Emil George
2025-08-07 16:49:21 +01:00
committed by GitHub
parent e21256e7a2
commit ac77c0f360
3 changed files with 31 additions and 19 deletions

View File

@@ -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;

View File

@@ -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 },

View File

@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [emilgeo]
---
Add Indian Rupee (INR) currency