From e403e3c28ea56d6edd1bb7ffdc411128e3ad5218 Mon Sep 17 00:00:00 2001 From: brentguf Date: Thu, 23 Jan 2025 15:02:43 +0100 Subject: [PATCH 01/15] formatCurrency --- .../app/utils/currency/formatCurrency.test.ts | 30 +++++++++++++++++++ front/app/utils/currency/formatCurrency.ts | 18 +++++++++++ 2 files changed, 48 insertions(+) create mode 100644 front/app/utils/currency/formatCurrency.test.ts create mode 100644 front/app/utils/currency/formatCurrency.ts diff --git a/front/app/utils/currency/formatCurrency.test.ts b/front/app/utils/currency/formatCurrency.test.ts new file mode 100644 index 000000000000..c750b6a9ca76 --- /dev/null +++ b/front/app/utils/currency/formatCurrency.test.ts @@ -0,0 +1,30 @@ +import formatCurrency from './formatCurrency'; + +describe('formatCurrency', () => { + const nonBreakingSpace = '\xa0'; + + it('respects separator conventions', () => { + // In US English, commas are used as thousands separators and periods as decimal separators. + expect( + formatCurrency('en', 'USD', 10000, { maximumFractionDigits: 2 }) + ).toEqual(`$10,000.00`); + // In Dutch, periods are used as thousands separators and commas as decimal separators. + expect( + formatCurrency('nl-BE', 'EUR', 10000, { maximumFractionDigits: 2 }) + ).toEqual(`€${nonBreakingSpace}10.000,00`); + }); + + it('respects the currency symbol position', () => { + // USD is a currency that uses the $ symbol before the amount, without a space. + expect(formatCurrency('en', 'USD', 100)).toEqual(`$100`); + + // Depending on convention in each nation, the symbol can either precede or follow the value, + // e.g., €10 or 10 €, often with an intervening space. + expect(formatCurrency('nl-BE', 'EUR', 100)).toEqual( + `€${nonBreakingSpace}100` + ); + expect(formatCurrency('de-DE', 'EUR', 100)).toEqual( + `100${nonBreakingSpace}€` + ); + }); +}); diff --git a/front/app/utils/currency/formatCurrency.ts b/front/app/utils/currency/formatCurrency.ts new file mode 100644 index 000000000000..e847a5a03ea2 --- /dev/null +++ b/front/app/utils/currency/formatCurrency.ts @@ -0,0 +1,18 @@ +import { SupportedLocale } from 'typings'; + +import { TCurrency } from 'api/app_configuration/types'; + +function formatCurrency( + locale: SupportedLocale, + currency: TCurrency, + amount: number, + { maximumFractionDigits = 0 }: { maximumFractionDigits?: number } = {} +) { + return new Intl.NumberFormat(locale, { + style: 'currency', + currency, + maximumFractionDigits, + }).format(amount); +} + +export default formatCurrency; From e0328544232bfd9dee16a8e585766c24d432148c Mon Sep 17 00:00:00 2001 From: brentguf Date: Thu, 23 Jan 2025 15:06:15 +0100 Subject: [PATCH 02/15] Clarify comment --- front/app/utils/currency/formatCurrency.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/app/utils/currency/formatCurrency.test.ts b/front/app/utils/currency/formatCurrency.test.ts index c750b6a9ca76..ba5c7ebd1ac2 100644 --- a/front/app/utils/currency/formatCurrency.test.ts +++ b/front/app/utils/currency/formatCurrency.test.ts @@ -18,7 +18,7 @@ describe('formatCurrency', () => { // USD is a currency that uses the $ symbol before the amount, without a space. expect(formatCurrency('en', 'USD', 100)).toEqual(`$100`); - // Depending on convention in each nation, the symbol can either precede or follow the value, + // With EUR, depending on convention in each nation, the symbol can either precede or follow the value, // e.g., €10 or 10 €, often with an intervening space. expect(formatCurrency('nl-BE', 'EUR', 100)).toEqual( `€${nonBreakingSpace}100` From 247498be0d43e7133546a70054419c71b83a6b6a Mon Sep 17 00:00:00 2001 From: brentguf Date: Thu, 23 Jan 2025 16:12:55 +0100 Subject: [PATCH 03/15] Use formatCurrency inside FormattedBudget --- front/app/utils/currency/FormattedBudget.tsx | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/front/app/utils/currency/FormattedBudget.tsx b/front/app/utils/currency/FormattedBudget.tsx index 0ce9bd0f0e55..1a1121ef0cc5 100644 --- a/front/app/utils/currency/FormattedBudget.tsx +++ b/front/app/utils/currency/FormattedBudget.tsx @@ -1,13 +1,15 @@ import React from 'react'; import { Icon } from '@citizenlab/cl2-component-library'; -import { FormattedNumber } from 'react-intl'; import styled from 'styled-components'; import useAppConfiguration from 'api/app_configuration/useAppConfiguration'; +import useLocale from 'hooks/useLocale'; + import { useIntl } from 'utils/cl-intl'; +import formatCurrency from './formatCurrency'; import messages from './messages'; const StyledIcon = styled(Icon)` @@ -24,6 +26,7 @@ interface Props { const FormattedBudget = ({ value }: Props) => { const { data: appConfiguration } = useAppConfiguration(); const { formatMessage, formatNumber } = useIntl(); + const locale = useLocale(); if (!appConfiguration) return null; @@ -50,15 +53,7 @@ const FormattedBudget = ({ value }: Props) => { ); } else { - return ( - - ); + return <>{formatCurrency(locale, currency, value)}; } }; From 44560e8537c4169bd1e9c5e7c108829586ddc6b1 Mon Sep 17 00:00:00 2001 From: brentguf Date: Fri, 24 Jan 2025 08:10:29 +0100 Subject: [PATCH 04/15] useFormatCurrency hook --- front/app/utils/currency/formatCurrency.ts | 2 +- front/app/utils/currency/useFormatCurrency.ts | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 front/app/utils/currency/useFormatCurrency.ts diff --git a/front/app/utils/currency/formatCurrency.ts b/front/app/utils/currency/formatCurrency.ts index e847a5a03ea2..f83ef2dec906 100644 --- a/front/app/utils/currency/formatCurrency.ts +++ b/front/app/utils/currency/formatCurrency.ts @@ -4,7 +4,7 @@ import { TCurrency } from 'api/app_configuration/types'; function formatCurrency( locale: SupportedLocale, - currency: TCurrency, + currency: TCurrency | undefined, amount: number, { maximumFractionDigits = 0 }: { maximumFractionDigits?: number } = {} ) { diff --git a/front/app/utils/currency/useFormatCurrency.ts b/front/app/utils/currency/useFormatCurrency.ts new file mode 100644 index 000000000000..c0ff3fe98b67 --- /dev/null +++ b/front/app/utils/currency/useFormatCurrency.ts @@ -0,0 +1,15 @@ +import useAppConfiguration from 'api/app_configuration/useAppConfiguration'; + +import useLocale from 'hooks/useLocale'; + +import formatCurrency from './formatCurrency'; + +const useFormatCurrency = (amount: number) => { + const locale = useLocale(); + const { data: appConfig } = useAppConfiguration(); + const currency = appConfig?.data.attributes.settings.core.currency; + + return () => formatCurrency(locale, currency, amount); +}; + +export default useFormatCurrency; From a78473b28c4ac4e75e5af5992fa62369194fff83 Mon Sep 17 00:00:00 2001 From: brentguf Date: Fri, 24 Jan 2025 08:40:11 +0100 Subject: [PATCH 05/15] Ability to pass amount when formatCurrency is used vs. when calling the hook --- front/app/utils/currency/useFormatCurrency.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front/app/utils/currency/useFormatCurrency.ts b/front/app/utils/currency/useFormatCurrency.ts index c0ff3fe98b67..c2ef4a54d457 100644 --- a/front/app/utils/currency/useFormatCurrency.ts +++ b/front/app/utils/currency/useFormatCurrency.ts @@ -4,12 +4,12 @@ import useLocale from 'hooks/useLocale'; import formatCurrency from './formatCurrency'; -const useFormatCurrency = (amount: number) => { +const useFormatCurrency = () => { const locale = useLocale(); const { data: appConfig } = useAppConfiguration(); const currency = appConfig?.data.attributes.settings.core.currency; - return () => formatCurrency(locale, currency, amount); + return (amount: number) => formatCurrency(locale, currency, amount); }; export default useFormatCurrency; From b826fc906bb37ff116a6fca6f9733675f4851ade Mon Sep 17 00:00:00 2001 From: brentguf Date: Fri, 24 Jan 2025 10:44:35 +0100 Subject: [PATCH 06/15] Cover TOK and CRE in hook --- front/app/utils/currency/useFormatCurrency.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/front/app/utils/currency/useFormatCurrency.ts b/front/app/utils/currency/useFormatCurrency.ts index c2ef4a54d457..eb4a86a848ab 100644 --- a/front/app/utils/currency/useFormatCurrency.ts +++ b/front/app/utils/currency/useFormatCurrency.ts @@ -2,12 +2,30 @@ import useAppConfiguration from 'api/app_configuration/useAppConfiguration'; import useLocale from 'hooks/useLocale'; +import { useIntl } from 'utils/cl-intl'; + import formatCurrency from './formatCurrency'; +import messages from './messages'; const useFormatCurrency = () => { const locale = useLocale(); const { data: appConfig } = useAppConfiguration(); const currency = appConfig?.data.attributes.settings.core.currency; + const { formatMessage, formatNumber } = useIntl(); + + if (currency === 'TOK') { + return (amount: number) => formatNumber(amount); + } + + if (currency === 'CRE') { + return (amount: number) => + formatMessage( + amount === 1 ? messages.oneCredit : messages.multipleCredits, + { + numberOfTokens: formatNumber(amount), + } + ); + } return (amount: number) => formatCurrency(locale, currency, amount); }; From 776e07aa3387d84cc5a9cb5f1a06ecddb0df5924 Mon Sep 17 00:00:00 2001 From: brentguf Date: Fri, 24 Jan 2025 10:51:41 +0100 Subject: [PATCH 07/15] Add message for TOK and streamline CRE with it --- front/app/utils/currency/FormattedBudget.tsx | 9 +++------ front/app/utils/currency/messages.ts | 16 +++++++++------- front/app/utils/currency/useFormatCurrency.ts | 12 +++++------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/front/app/utils/currency/FormattedBudget.tsx b/front/app/utils/currency/FormattedBudget.tsx index 0ce9bd0f0e55..951cd1be7296 100644 --- a/front/app/utils/currency/FormattedBudget.tsx +++ b/front/app/utils/currency/FormattedBudget.tsx @@ -41,12 +41,9 @@ const FormattedBudget = ({ value }: Props) => { } else if (currency === 'CRE') { return ( <> - {formatMessage( - value === 1 ? messages.oneCredit : messages.multipleCredits, - { - numberOfTokens: formatNumber(value), - } - )} + {formatMessage(messages.xCredits, { + numberOfCredits: formatNumber(value), + })} ); } else { diff --git a/front/app/utils/currency/messages.ts b/front/app/utils/currency/messages.ts index 39c1703402cf..fb06b55cc4f4 100644 --- a/front/app/utils/currency/messages.ts +++ b/front/app/utils/currency/messages.ts @@ -5,16 +5,18 @@ export default defineMessages({ id: 'app.utils.FormattedCurrency.tokens', defaultMessage: 'tokens', }, - oneCredit: { - id: 'app.utils.FormattedCurrency.oneCredit', - defaultMessage: '1 credit', + xTokens: { + id: 'app.utils.FormattedCurrency.xTokens', + defaultMessage: + '{numberOfTokens, plural, =0 {# tokens} one {# token} other {# tokens}}', + }, + xCredits: { + id: 'app.utils.FormattedCurrency.xCredits', + defaultMessage: + '{numberOfCredits, plural, =0 {# credits} one {# credit} other {# credits}}', }, credits: { id: 'app.utils.FormattedCurrency.credits', defaultMessage: 'credits', }, - multipleCredits: { - id: 'app.utils.FormattedCurrency.multipleCredits', - defaultMessage: '{numberOfTokens} credits', - }, }); diff --git a/front/app/utils/currency/useFormatCurrency.ts b/front/app/utils/currency/useFormatCurrency.ts index eb4a86a848ab..4f71c75a9853 100644 --- a/front/app/utils/currency/useFormatCurrency.ts +++ b/front/app/utils/currency/useFormatCurrency.ts @@ -14,17 +14,15 @@ const useFormatCurrency = () => { const { formatMessage, formatNumber } = useIntl(); if (currency === 'TOK') { - return (amount: number) => formatNumber(amount); + return (amount: number) => + formatMessage(messages.xTokens, { numberOfTokens: formatNumber(amount) }); } if (currency === 'CRE') { return (amount: number) => - formatMessage( - amount === 1 ? messages.oneCredit : messages.multipleCredits, - { - numberOfTokens: formatNumber(amount), - } - ); + formatMessage(messages.xCredits, { + numberOfCredits: formatNumber(amount), + }); } return (amount: number) => formatCurrency(locale, currency, amount); From dbfa05e64cb1faeca29fa32a4ae5d68d0b79626e Mon Sep 17 00:00:00 2001 From: brentguf Date: Fri, 24 Jan 2025 10:53:14 +0100 Subject: [PATCH 08/15] Use TCountryCurrency for formatCurrency param --- front/app/api/app_configuration/types.ts | 2 +- front/app/utils/currency/formatCurrency.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/front/app/api/app_configuration/types.ts b/front/app/api/app_configuration/types.ts index 2658140ffa6d..3c428c210a92 100644 --- a/front/app/api/app_configuration/types.ts +++ b/front/app/api/app_configuration/types.ts @@ -314,7 +314,7 @@ export type TCurrency = TCustomCurrency | TCountryCurrency; type TCustomCurrency = // token, credit 'TOK' | 'CRE'; -type TCountryCurrency = +export type TCountryCurrency = // currencies associated with countries, e.g. EUR and USD // list is based on the currencies.rb file | 'AED' diff --git a/front/app/utils/currency/formatCurrency.ts b/front/app/utils/currency/formatCurrency.ts index f83ef2dec906..c1be23b6c8a3 100644 --- a/front/app/utils/currency/formatCurrency.ts +++ b/front/app/utils/currency/formatCurrency.ts @@ -1,10 +1,10 @@ import { SupportedLocale } from 'typings'; -import { TCurrency } from 'api/app_configuration/types'; +import { TCountryCurrency } from 'api/app_configuration/types'; function formatCurrency( locale: SupportedLocale, - currency: TCurrency | undefined, + currency: TCountryCurrency | undefined, amount: number, { maximumFractionDigits = 0 }: { maximumFractionDigits?: number } = {} ) { From 18126affeb48b5f8279a25f82a7ea92bf2b82b26 Mon Sep 17 00:00:00 2001 From: CircleCI Date: Fri, 24 Jan 2025 09:54:43 +0000 Subject: [PATCH 09/15] Translations updated by CI (extract-intl) --- front/app/translations/ar-MA.json | 2 -- front/app/translations/ar-SA.json | 2 -- front/app/translations/ca-ES.json | 2 -- front/app/translations/cy-GB.json | 2 -- front/app/translations/da-DK.json | 2 -- front/app/translations/de-DE.json | 2 -- front/app/translations/el-GR.json | 2 -- front/app/translations/en-CA.json | 2 -- front/app/translations/en-GB.json | 2 -- front/app/translations/en-IE.json | 2 -- front/app/translations/en.json | 4 ++-- front/app/translations/es-CL.json | 2 -- front/app/translations/es-ES.json | 2 -- front/app/translations/fi-FI.json | 2 -- front/app/translations/fr-BE.json | 2 -- front/app/translations/fr-FR.json | 2 -- front/app/translations/hr-HR.json | 2 -- front/app/translations/hu-HU.json | 2 -- front/app/translations/it-IT.json | 2 -- front/app/translations/kl-GL.json | 2 -- front/app/translations/lb-LU.json | 2 -- front/app/translations/lt-LT.json | 2 -- front/app/translations/lv-LV.json | 2 -- front/app/translations/mi.json | 2 -- front/app/translations/nb-NO.json | 2 -- front/app/translations/nl-BE.json | 2 -- front/app/translations/nl-NL.json | 2 -- front/app/translations/pa-IN.json | 2 -- front/app/translations/pl-PL.json | 2 -- front/app/translations/pt-BR.json | 2 -- front/app/translations/ro-RO.json | 2 -- front/app/translations/sr-Latn.json | 2 -- front/app/translations/sr-SP.json | 2 -- front/app/translations/sv-SE.json | 2 -- front/app/translations/tr-TR.json | 2 -- front/app/translations/ur-PK.json | 2 -- 36 files changed, 2 insertions(+), 72 deletions(-) diff --git a/front/app/translations/ar-MA.json b/front/app/translations/ar-MA.json index 17286ae498d0..f6ed8f4b8698 100644 --- a/front/app/translations/ar-MA.json +++ b/front/app/translations/ar-MA.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "تجميع المدخلات والملاحظات", "app.utils.AdminPage.ProjectEdit.shareInformation": "إتاحة المعلومات للمشاركة", "app.utils.FormattedCurrency.credits": "رمز/رموز ائتمان", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} رمز/رموز ائتمان", - "app.utils.FormattedCurrency.oneCredit": "رمز ائتمان واحد", "app.utils.FormattedCurrency.tokens": "رمز/رموز مميزة", "app.utils.IdeaCards.mostDiscussed": "الأكثر مناقشة", "app.utils.IdeaCards.mostReacted": "معظم ردود الفعل", diff --git a/front/app/translations/ar-SA.json b/front/app/translations/ar-SA.json index 1678316f5fb3..1aebecfa3cd2 100644 --- a/front/app/translations/ar-SA.json +++ b/front/app/translations/ar-SA.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "تجميع المدخلات والملاحظات", "app.utils.AdminPage.ProjectEdit.shareInformation": "إتاحة المعلومات للمشاركة", "app.utils.FormattedCurrency.credits": "رمز/رموز ائتمان", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} رمز/رموز ائتمان", - "app.utils.FormattedCurrency.oneCredit": "رمز ائتمان واحد", "app.utils.FormattedCurrency.tokens": "رمز/رموز مميزة", "app.utils.IdeaCards.mostDiscussed": "الأكثر مناقشة", "app.utils.IdeaCards.mostReacted": "معظم ردود الفعل", diff --git a/front/app/translations/ca-ES.json b/front/app/translations/ca-ES.json index cfc68af74c05..310d9471c582 100644 --- a/front/app/translations/ca-ES.json +++ b/front/app/translations/ca-ES.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Recolliu aportacions i comentaris", "app.utils.AdminPage.ProjectEdit.shareInformation": "Compartir informació", "app.utils.FormattedCurrency.credits": "crèdits", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} crèdits", - "app.utils.FormattedCurrency.oneCredit": "1 crèdit", "app.utils.FormattedCurrency.tokens": "fitxes", "app.utils.IdeaCards.mostDiscussed": "El més discutit", "app.utils.IdeaCards.mostReacted": "La majoria de reaccions", diff --git a/front/app/translations/cy-GB.json b/front/app/translations/cy-GB.json index 1c017924de63..d83e23b17c74 100644 --- a/front/app/translations/cy-GB.json +++ b/front/app/translations/cy-GB.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Casglu mewnbwn ac adborth", "app.utils.AdminPage.ProjectEdit.shareInformation": "Rhannu gwybodaeth", "app.utils.FormattedCurrency.credits": "credydau", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} credydau", - "app.utils.FormattedCurrency.oneCredit": "1 credyd", "app.utils.FormattedCurrency.tokens": "tocynnau", "app.utils.IdeaCards.mostDiscussed": "Trafodwyd fwyaf", "app.utils.IdeaCards.mostReacted": "Y rhan fwyaf o adweithiau", diff --git a/front/app/translations/da-DK.json b/front/app/translations/da-DK.json index bc6f997a477e..2cd73829c204 100644 --- a/front/app/translations/da-DK.json +++ b/front/app/translations/da-DK.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Indsaml input og feedback", "app.utils.AdminPage.ProjectEdit.shareInformation": "Del information", "app.utils.FormattedCurrency.credits": "kreditter", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} kreditter", - "app.utils.FormattedCurrency.oneCredit": "1 kredit", "app.utils.FormattedCurrency.tokens": "tokens", "app.utils.IdeaCards.mostDiscussed": "Mest diskuteret", "app.utils.IdeaCards.mostReacted": "Flest stemmer", diff --git a/front/app/translations/de-DE.json b/front/app/translations/de-DE.json index 48950869ea2d..50640497a84e 100644 --- a/front/app/translations/de-DE.json +++ b/front/app/translations/de-DE.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Beiträge und Feedback sammeln", "app.utils.AdminPage.ProjectEdit.shareInformation": "Informationen teilen", "app.utils.FormattedCurrency.credits": "Guthaben", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} Guthaben", - "app.utils.FormattedCurrency.oneCredit": "1 Guthaben", "app.utils.FormattedCurrency.tokens": "Wertmarken", "app.utils.IdeaCards.mostDiscussed": "Meist diskutiert", "app.utils.IdeaCards.mostReacted": "Meiste Reaktionen", diff --git a/front/app/translations/el-GR.json b/front/app/translations/el-GR.json index 9e3fe4b52ce1..d5d6b1b87ae5 100644 --- a/front/app/translations/el-GR.json +++ b/front/app/translations/el-GR.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Συλλογή εισηγήσεων και ανατροφοδότησης", "app.utils.AdminPage.ProjectEdit.shareInformation": "Κοινοποιείστε πληροφορίες", "app.utils.FormattedCurrency.credits": "μονάδες", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} μονάδες", - "app.utils.FormattedCurrency.oneCredit": "1 μονάδα", "app.utils.FormattedCurrency.tokens": "διακριτικά", "app.utils.IdeaCards.mostDiscussed": "Τα πιο συζητημένα", "app.utils.IdeaCards.mostReacted": "Οι περισσότερες αντιδράσεις", diff --git a/front/app/translations/en-CA.json b/front/app/translations/en-CA.json index 31208fb11cbe..ebc3305de962 100644 --- a/front/app/translations/en-CA.json +++ b/front/app/translations/en-CA.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Collect input and feedback", "app.utils.AdminPage.ProjectEdit.shareInformation": "Share information", "app.utils.FormattedCurrency.credits": "credits", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} credits", - "app.utils.FormattedCurrency.oneCredit": "1 credit", "app.utils.FormattedCurrency.tokens": "tokens", "app.utils.IdeaCards.mostDiscussed": "Most discussed", "app.utils.IdeaCards.mostReacted": "Most reactions", diff --git a/front/app/translations/en-GB.json b/front/app/translations/en-GB.json index 38ae9ab39cdc..42394a41004b 100644 --- a/front/app/translations/en-GB.json +++ b/front/app/translations/en-GB.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Collect input and feedback", "app.utils.AdminPage.ProjectEdit.shareInformation": "Share information", "app.utils.FormattedCurrency.credits": "credits", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} credits", - "app.utils.FormattedCurrency.oneCredit": "1 credit", "app.utils.FormattedCurrency.tokens": "tokens", "app.utils.IdeaCards.mostDiscussed": "Most discussed", "app.utils.IdeaCards.mostReacted": "Most reactions", diff --git a/front/app/translations/en-IE.json b/front/app/translations/en-IE.json index 6fba8e5180fe..769d61abdf1e 100644 --- a/front/app/translations/en-IE.json +++ b/front/app/translations/en-IE.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Collect input and feedback", "app.utils.AdminPage.ProjectEdit.shareInformation": "Share information", "app.utils.FormattedCurrency.credits": "credits", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} credits", - "app.utils.FormattedCurrency.oneCredit": "1 credit", "app.utils.FormattedCurrency.tokens": "tokens", "app.utils.IdeaCards.mostDiscussed": "Most discussed", "app.utils.IdeaCards.mostReacted": "Most reactions", diff --git a/front/app/translations/en.json b/front/app/translations/en.json index 6fba8e5180fe..ab89e9f2af25 100644 --- a/front/app/translations/en.json +++ b/front/app/translations/en.json @@ -2056,9 +2056,9 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Collect input and feedback", "app.utils.AdminPage.ProjectEdit.shareInformation": "Share information", "app.utils.FormattedCurrency.credits": "credits", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} credits", - "app.utils.FormattedCurrency.oneCredit": "1 credit", "app.utils.FormattedCurrency.tokens": "tokens", + "app.utils.FormattedCurrency.xCredits": "{numberOfCredits, plural, =0 {# credits} one {# credit} other {# credits}}", + "app.utils.FormattedCurrency.xTokens": "{numberOfTokens, plural, =0 {# tokens} one {# token} other {# tokens}}", "app.utils.IdeaCards.mostDiscussed": "Most discussed", "app.utils.IdeaCards.mostReacted": "Most reactions", "app.utils.IdeaCards.newest": "Newest", diff --git a/front/app/translations/es-CL.json b/front/app/translations/es-CL.json index e7256a98bcce..9e38f24177e1 100644 --- a/front/app/translations/es-CL.json +++ b/front/app/translations/es-CL.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Recopilar aportes y retroalimentaciones", "app.utils.AdminPage.ProjectEdit.shareInformation": "Comparte información", "app.utils.FormattedCurrency.credits": "créditos", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} créditos", - "app.utils.FormattedCurrency.oneCredit": "1 crédito", "app.utils.FormattedCurrency.tokens": "fichas", "app.utils.IdeaCards.mostDiscussed": "Lo más discutido", "app.utils.IdeaCards.mostReacted": "Con más reacciones", diff --git a/front/app/translations/es-ES.json b/front/app/translations/es-ES.json index 304d7aefa76d..ebc71d2fa6aa 100644 --- a/front/app/translations/es-ES.json +++ b/front/app/translations/es-ES.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Recopilar aportes y retroalimentaciones", "app.utils.AdminPage.ProjectEdit.shareInformation": "Comparte información", "app.utils.FormattedCurrency.credits": "créditos", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} créditos", - "app.utils.FormattedCurrency.oneCredit": "1 crédito", "app.utils.FormattedCurrency.tokens": "fichas", "app.utils.IdeaCards.mostDiscussed": "Lo más discutido", "app.utils.IdeaCards.mostReacted": "Con más reacciones", diff --git a/front/app/translations/fi-FI.json b/front/app/translations/fi-FI.json index 403d22108b86..987d5695896b 100644 --- a/front/app/translations/fi-FI.json +++ b/front/app/translations/fi-FI.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Kerää palautetta ja palautetta", "app.utils.AdminPage.ProjectEdit.shareInformation": "Jakaa tietoa", "app.utils.FormattedCurrency.credits": "krediittejä", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} krediittiä", - "app.utils.FormattedCurrency.oneCredit": "1 luotto", "app.utils.FormattedCurrency.tokens": "rahakkeita", "app.utils.IdeaCards.mostDiscussed": "Eniten keskusteltu", "app.utils.IdeaCards.mostReacted": "Suurin osa reaktioista", diff --git a/front/app/translations/fr-BE.json b/front/app/translations/fr-BE.json index a1f0d50857a2..b85097db04c4 100644 --- a/front/app/translations/fr-BE.json +++ b/front/app/translations/fr-BE.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Recueillir des contributions et des commentaires", "app.utils.AdminPage.ProjectEdit.shareInformation": "Partager l'information", "app.utils.FormattedCurrency.credits": "crédits", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} crédits", - "app.utils.FormattedCurrency.oneCredit": "1 crédit", "app.utils.FormattedCurrency.tokens": "jetons", "app.utils.IdeaCards.mostDiscussed": "Les plus discutés", "app.utils.IdeaCards.mostReacted": "Plus de réactions", diff --git a/front/app/translations/fr-FR.json b/front/app/translations/fr-FR.json index 058ac561d0eb..162d5c335c7b 100644 --- a/front/app/translations/fr-FR.json +++ b/front/app/translations/fr-FR.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Recueillir des contributions et des commentaires", "app.utils.AdminPage.ProjectEdit.shareInformation": "Partager l'information", "app.utils.FormattedCurrency.credits": "crédits", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} crédits", - "app.utils.FormattedCurrency.oneCredit": "1 crédit", "app.utils.FormattedCurrency.tokens": "jetons", "app.utils.IdeaCards.mostDiscussed": "Les plus discutés", "app.utils.IdeaCards.mostReacted": "Plus de réactions", diff --git a/front/app/translations/hr-HR.json b/front/app/translations/hr-HR.json index aaa82283dde2..2ebc8abe344c 100644 --- a/front/app/translations/hr-HR.json +++ b/front/app/translations/hr-HR.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Prikupljajte unose i povratne informacije", "app.utils.AdminPage.ProjectEdit.shareInformation": "Podijelite informacije", "app.utils.FormattedCurrency.credits": "krediti", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} kredita", - "app.utils.FormattedCurrency.oneCredit": "1 kredit", "app.utils.FormattedCurrency.tokens": "tokeni", "app.utils.IdeaCards.mostDiscussed": "Najviše raspravljano", "app.utils.IdeaCards.mostReacted": "Većina reakcija", diff --git a/front/app/translations/hu-HU.json b/front/app/translations/hu-HU.json index 44da08394631..f3a42cb719f8 100644 --- a/front/app/translations/hu-HU.json +++ b/front/app/translations/hu-HU.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Gyűjtsön bemeneteket és visszajelzéseket", "app.utils.AdminPage.ProjectEdit.shareInformation": "Ossza meg az információkat", "app.utils.FormattedCurrency.credits": "krediteket", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} kredit", - "app.utils.FormattedCurrency.oneCredit": "1 kredit", "app.utils.FormattedCurrency.tokens": "zsetonok", "app.utils.IdeaCards.mostDiscussed": "A legtöbbet megvitatták", "app.utils.IdeaCards.mostReacted": "A legtöbb reakció", diff --git a/front/app/translations/it-IT.json b/front/app/translations/it-IT.json index dabd9e249bcb..4b23172f43d9 100644 --- a/front/app/translations/it-IT.json +++ b/front/app/translations/it-IT.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Raccogliere input e feedback", "app.utils.AdminPage.ProjectEdit.shareInformation": "Condividi informazioni", "app.utils.FormattedCurrency.credits": "crediti", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} crediti", - "app.utils.FormattedCurrency.oneCredit": "1 credito", "app.utils.FormattedCurrency.tokens": "gettoni", "app.utils.IdeaCards.mostDiscussed": "I più discussi", "app.utils.IdeaCards.mostReacted": "La maggior parte delle reazioni", diff --git a/front/app/translations/kl-GL.json b/front/app/translations/kl-GL.json index c30d467b81eb..1cc716ff3f25 100644 --- a/front/app/translations/kl-GL.json +++ b/front/app/translations/kl-GL.json @@ -1339,8 +1339,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Collect input and feedback", "app.utils.AdminPage.ProjectEdit.shareInformation": "Share information", "app.utils.FormattedCurrency.credits": "credits", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} credits", - "app.utils.FormattedCurrency.oneCredit": "1 credit", "app.utils.FormattedCurrency.tokens": "tokens", "app.utils.IdeaCards.mostReacted": "Most reactions", "app.utils.IdeaCards.newest": "Newest", diff --git a/front/app/translations/lb-LU.json b/front/app/translations/lb-LU.json index 9eff90913f46..bca45518fe6d 100644 --- a/front/app/translations/lb-LU.json +++ b/front/app/translations/lb-LU.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Bäiträg a Feedback sammelen", "app.utils.AdminPage.ProjectEdit.shareInformation": "Informatiounen deelen", "app.utils.FormattedCurrency.credits": "Kreditter", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} Kreditter", - "app.utils.FormattedCurrency.oneCredit": "1 Kredit", "app.utils.FormattedCurrency.tokens": "Jetonen", "app.utils.IdeaCards.mostDiscussed": "Déi meescht diskutéiert", "app.utils.IdeaCards.mostReacted": "Déi meescht Reaktiounen", diff --git a/front/app/translations/lt-LT.json b/front/app/translations/lt-LT.json index f2f1d7816077..3652cf7804cc 100644 --- a/front/app/translations/lt-LT.json +++ b/front/app/translations/lt-LT.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Rinkti informaciją ir atsiliepimus", "app.utils.AdminPage.ProjectEdit.shareInformation": "Dalytis informacija", "app.utils.FormattedCurrency.credits": "kreditai", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} kreditai", - "app.utils.FormattedCurrency.oneCredit": "1 kreditas", "app.utils.FormattedCurrency.tokens": "žetonai", "app.utils.IdeaCards.mostDiscussed": "Daugiausia diskusijų", "app.utils.IdeaCards.mostReacted": "Dauguma reakcijų", diff --git a/front/app/translations/lv-LV.json b/front/app/translations/lv-LV.json index 69f82f763a30..6c9e7e819d1e 100644 --- a/front/app/translations/lv-LV.json +++ b/front/app/translations/lv-LV.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Iegūtie dati un atsauksmes", "app.utils.AdminPage.ProjectEdit.shareInformation": "Kopīgot informāciju", "app.utils.FormattedCurrency.credits": "kredīti", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} kredīti", - "app.utils.FormattedCurrency.oneCredit": "1 kredīts", "app.utils.FormattedCurrency.tokens": "žetoni", "app.utils.IdeaCards.mostDiscussed": "Visvairāk apspriesto", "app.utils.IdeaCards.mostReacted": "Lielākā daļa reakciju", diff --git a/front/app/translations/mi.json b/front/app/translations/mi.json index ae50f96b1260..15559f22e713 100644 --- a/front/app/translations/mi.json +++ b/front/app/translations/mi.json @@ -919,8 +919,6 @@ "app.modules.project_folder.citizen.components.ProjectFolderSharingModal.twitterMessage": "{projectFolderName}", "app.modules.project_folder.citizen.components.ProjectFolderSharingModal.whatsAppMessage": "{projectFolderName} | from the participation platform of {orgName}", "app.utils.FormattedCurrency.credits": "credits", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} credits", - "app.utils.FormattedCurrency.oneCredit": "1 credit", "app.utils.FormattedCurrency.tokens": "tokens", "app.utils.errors.api_error_default.in": "Is not right", "app.utils.errors.default.ajv_error_birthyear_required": "Please fill in your year of birth", diff --git a/front/app/translations/nb-NO.json b/front/app/translations/nb-NO.json index ec10292307b3..1e9c6ae16ae5 100644 --- a/front/app/translations/nb-NO.json +++ b/front/app/translations/nb-NO.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Samle inn innspill og tilbakemeldinger", "app.utils.AdminPage.ProjectEdit.shareInformation": "Del informasjon", "app.utils.FormattedCurrency.credits": "studiepoeng", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} studiepoeng", - "app.utils.FormattedCurrency.oneCredit": "1 studiepoeng", "app.utils.FormattedCurrency.tokens": "symboler", "app.utils.IdeaCards.mostDiscussed": "Mest diskutert", "app.utils.IdeaCards.mostReacted": "De fleste reaksjonene", diff --git a/front/app/translations/nl-BE.json b/front/app/translations/nl-BE.json index 53690d3e72ad..1b41b54d269b 100644 --- a/front/app/translations/nl-BE.json +++ b/front/app/translations/nl-BE.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Input en/of feedback verzamelen", "app.utils.AdminPage.ProjectEdit.shareInformation": "Informatie delen", "app.utils.FormattedCurrency.credits": "credits", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} credits", - "app.utils.FormattedCurrency.oneCredit": "1 krediet", "app.utils.FormattedCurrency.tokens": "penningen", "app.utils.IdeaCards.mostDiscussed": "Meest besproken", "app.utils.IdeaCards.mostReacted": "De meeste reacties", diff --git a/front/app/translations/nl-NL.json b/front/app/translations/nl-NL.json index 3eec9857e51b..aa376f7dfc14 100644 --- a/front/app/translations/nl-NL.json +++ b/front/app/translations/nl-NL.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Input en/of feedback verzamelen", "app.utils.AdminPage.ProjectEdit.shareInformation": "Informatie delen", "app.utils.FormattedCurrency.credits": "credits", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} credits", - "app.utils.FormattedCurrency.oneCredit": "1 credit", "app.utils.FormattedCurrency.tokens": "tokens", "app.utils.IdeaCards.mostDiscussed": "Meest besproken", "app.utils.IdeaCards.mostReacted": "De meeste reacties", diff --git a/front/app/translations/pa-IN.json b/front/app/translations/pa-IN.json index 6efa10fe9930..2832a23ba6e8 100644 --- a/front/app/translations/pa-IN.json +++ b/front/app/translations/pa-IN.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "ਇਨਪੁਟ ਅਤੇ ਫੀਡਬੈਕ ਇਕੱਠਾ ਕਰੋ", "app.utils.AdminPage.ProjectEdit.shareInformation": "ਜਾਣਕਾਰੀ ਸਾਂਝੀ ਕਰੋ", "app.utils.FormattedCurrency.credits": "ਕ੍ਰੈਡਿਟ", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} ਕ੍ਰੈਡਿਟ", - "app.utils.FormattedCurrency.oneCredit": "1 ਕ੍ਰੈਡਿਟ", "app.utils.FormattedCurrency.tokens": "ਟੋਕਨ", "app.utils.IdeaCards.mostDiscussed": "ਸਭ ਤੋਂ ਵੱਧ ਚਰਚਾ ਕੀਤੀ", "app.utils.IdeaCards.mostReacted": "ਜ਼ਿਆਦਾਤਰ ਪ੍ਰਤੀਕਰਮ", diff --git a/front/app/translations/pl-PL.json b/front/app/translations/pl-PL.json index c1d9aeba0d7c..8f4b890ee46e 100644 --- a/front/app/translations/pl-PL.json +++ b/front/app/translations/pl-PL.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Zbieranie inicjatyw i informacji zwrotnych", "app.utils.AdminPage.ProjectEdit.shareInformation": "Podziel się informacjami", "app.utils.FormattedCurrency.credits": "kredyty", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} kredytów", - "app.utils.FormattedCurrency.oneCredit": "1 kredyt", "app.utils.FormattedCurrency.tokens": "tokeny", "app.utils.IdeaCards.mostDiscussed": "Najczęściej omawiane", "app.utils.IdeaCards.mostReacted": "Większość reakcji", diff --git a/front/app/translations/pt-BR.json b/front/app/translations/pt-BR.json index 9b98afe31a23..3ced64b2b064 100644 --- a/front/app/translations/pt-BR.json +++ b/front/app/translations/pt-BR.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Colete comentários e feedback", "app.utils.AdminPage.ProjectEdit.shareInformation": "Compartilhar informação", "app.utils.FormattedCurrency.credits": "créditos", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} créditos", - "app.utils.FormattedCurrency.oneCredit": "1 crédito", "app.utils.FormattedCurrency.tokens": "fichas", "app.utils.IdeaCards.mostDiscussed": "Mais discutido", "app.utils.IdeaCards.mostReacted": "Mais reações", diff --git a/front/app/translations/ro-RO.json b/front/app/translations/ro-RO.json index 06944e2097fa..98e87ab99382 100644 --- a/front/app/translations/ro-RO.json +++ b/front/app/translations/ro-RO.json @@ -1127,8 +1127,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Colectarea de informații și feedback", "app.utils.AdminPage.ProjectEdit.shareInformation": "Informații de partajare", "app.utils.FormattedCurrency.credits": "credite", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} credite", - "app.utils.FormattedCurrency.oneCredit": "1 credit", "app.utils.FormattedCurrency.tokens": "tokenuri", "app.utils.IdeaCards.newest": "Cel mai nou", "app.utils.IdeaCards.oldest": "Cel mai vechi", diff --git a/front/app/translations/sr-Latn.json b/front/app/translations/sr-Latn.json index 9787e8956ab8..2a5f42e8784c 100644 --- a/front/app/translations/sr-Latn.json +++ b/front/app/translations/sr-Latn.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "prikupljajte unose i povratne informacije", "app.utils.AdminPage.ProjectEdit.shareInformation": "Delite informacije", "app.utils.FormattedCurrency.credits": "krediti", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} kredita", - "app.utils.FormattedCurrency.oneCredit": "1 kredit", "app.utils.FormattedCurrency.tokens": "tokeni", "app.utils.IdeaCards.mostDiscussed": "Most discussed", "app.utils.IdeaCards.mostReacted": "Najviše reakcija", diff --git a/front/app/translations/sr-SP.json b/front/app/translations/sr-SP.json index ae049c708620..7b0bc67b9cb1 100644 --- a/front/app/translations/sr-SP.json +++ b/front/app/translations/sr-SP.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Прикупите унос и повратне информације", "app.utils.AdminPage.ProjectEdit.shareInformation": "Делите информације", "app.utils.FormattedCurrency.credits": "кредити", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} кредита", - "app.utils.FormattedCurrency.oneCredit": "1 кредит", "app.utils.FormattedCurrency.tokens": "токенс", "app.utils.IdeaCards.mostDiscussed": "Most discussed", "app.utils.IdeaCards.mostReacted": "Највише реакција", diff --git a/front/app/translations/sv-SE.json b/front/app/translations/sv-SE.json index e35baf35f7f8..9ef7f6f6cd44 100644 --- a/front/app/translations/sv-SE.json +++ b/front/app/translations/sv-SE.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Samla in indata och återkoppling", "app.utils.AdminPage.ProjectEdit.shareInformation": "Dela information", "app.utils.FormattedCurrency.credits": "krediter", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} krediter", - "app.utils.FormattedCurrency.oneCredit": "1 kredit", "app.utils.FormattedCurrency.tokens": "token", "app.utils.IdeaCards.mostDiscussed": "Mest diskuterade", "app.utils.IdeaCards.mostReacted": "Flest reaktioner", diff --git a/front/app/translations/tr-TR.json b/front/app/translations/tr-TR.json index bff0a3227de3..2d11cd7cd5b3 100644 --- a/front/app/translations/tr-TR.json +++ b/front/app/translations/tr-TR.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "Girdi ve geri bildirim toplayın", "app.utils.AdminPage.ProjectEdit.shareInformation": "Bilgi paylaşın", "app.utils.FormattedCurrency.credits": "kredi", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} kredi", - "app.utils.FormattedCurrency.oneCredit": "1 kredi", "app.utils.FormattedCurrency.tokens": "jeton", "app.utils.IdeaCards.mostDiscussed": "En çok tartışılanlar", "app.utils.IdeaCards.mostReacted": "Çoğu reaksiyon", diff --git a/front/app/translations/ur-PK.json b/front/app/translations/ur-PK.json index f0b0259c0071..9a7262daafc5 100644 --- a/front/app/translations/ur-PK.json +++ b/front/app/translations/ur-PK.json @@ -2056,8 +2056,6 @@ "app.utils.AdminPage.ProjectEdit.inputAndFeedback": "ان پٹ اور آراء جمع کریں۔", "app.utils.AdminPage.ProjectEdit.shareInformation": "معلومات شیئر کریں۔", "app.utils.FormattedCurrency.credits": "کریڈٹ", - "app.utils.FormattedCurrency.multipleCredits": "{numberOfTokens} کریڈٹس", - "app.utils.FormattedCurrency.oneCredit": "1 کریڈٹ", "app.utils.FormattedCurrency.tokens": "ٹوکن", "app.utils.IdeaCards.mostDiscussed": "سب سے زیادہ زیر بحث", "app.utils.IdeaCards.mostReacted": "زیادہ تر رد عمل", From 41f82e90f5fde5ffbff05c0a97f406f15a8e773a Mon Sep 17 00:00:00 2001 From: brentguf Date: Fri, 24 Jan 2025 11:06:10 +0100 Subject: [PATCH 10/15] Add fallback to currency formatter when locale is not defined (yet) --- front/app/utils/currency/formatCurrency.test.ts | 8 ++++++-- front/app/utils/currency/formatCurrency.ts | 8 +++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/front/app/utils/currency/formatCurrency.test.ts b/front/app/utils/currency/formatCurrency.test.ts index ba5c7ebd1ac2..cdbcb2d26194 100644 --- a/front/app/utils/currency/formatCurrency.test.ts +++ b/front/app/utils/currency/formatCurrency.test.ts @@ -7,7 +7,7 @@ describe('formatCurrency', () => { // In US English, commas are used as thousands separators and periods as decimal separators. expect( formatCurrency('en', 'USD', 10000, { maximumFractionDigits: 2 }) - ).toEqual(`$10,000.00`); + ).toEqual('$10,000.00'); // In Dutch, periods are used as thousands separators and commas as decimal separators. expect( formatCurrency('nl-BE', 'EUR', 10000, { maximumFractionDigits: 2 }) @@ -16,7 +16,7 @@ describe('formatCurrency', () => { it('respects the currency symbol position', () => { // USD is a currency that uses the $ symbol before the amount, without a space. - expect(formatCurrency('en', 'USD', 100)).toEqual(`$100`); + expect(formatCurrency('en', 'USD', 100)).toEqual('$100'); // With EUR, depending on convention in each nation, the symbol can either precede or follow the value, // e.g., €10 or 10 €, often with an intervening space. @@ -27,4 +27,8 @@ describe('formatCurrency', () => { `100${nonBreakingSpace}€` ); }); + + it('has a reasonable fallback if the currency is undefined', () => { + expect(formatCurrency('en', undefined, 100)).toEqual('100'); + }); }); diff --git a/front/app/utils/currency/formatCurrency.ts b/front/app/utils/currency/formatCurrency.ts index c1be23b6c8a3..8a08537f56d6 100644 --- a/front/app/utils/currency/formatCurrency.ts +++ b/front/app/utils/currency/formatCurrency.ts @@ -8,11 +8,13 @@ function formatCurrency( amount: number, { maximumFractionDigits = 0 }: { maximumFractionDigits?: number } = {} ) { - return new Intl.NumberFormat(locale, { - style: 'currency', + const formatter = new Intl.NumberFormat(locale, { + style: currency ? 'currency' : 'decimal', currency, maximumFractionDigits, - }).format(amount); + }); + + return formatter.format(amount); } export default formatCurrency; From 6e14e7744d96d41af9842ba9e9605894c82ee144 Mon Sep 17 00:00:00 2001 From: brentguf Date: Fri, 24 Jan 2025 15:32:30 +0100 Subject: [PATCH 11/15] use useFormatCurrency hook instead of formatCurrency directly --- front/app/utils/currency/FormattedBudget.tsx | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/front/app/utils/currency/FormattedBudget.tsx b/front/app/utils/currency/FormattedBudget.tsx index 8698d4b1abae..a6975d71766f 100644 --- a/front/app/utils/currency/FormattedBudget.tsx +++ b/front/app/utils/currency/FormattedBudget.tsx @@ -5,12 +5,9 @@ import styled from 'styled-components'; import useAppConfiguration from 'api/app_configuration/useAppConfiguration'; -import useLocale from 'hooks/useLocale'; - import { useIntl } from 'utils/cl-intl'; -import formatCurrency from './formatCurrency'; -import messages from './messages'; +import useFormatCurrency from './useFormatCurrency'; const StyledIcon = styled(Icon)` margin-top: 3px; @@ -25,8 +22,8 @@ interface Props { const FormattedBudget = ({ value }: Props) => { const { data: appConfiguration } = useAppConfiguration(); - const { formatMessage, formatNumber } = useIntl(); - const locale = useLocale(); + const { formatNumber } = useIntl(); + const formatCurrency = useFormatCurrency(); if (!appConfiguration) return null; @@ -41,16 +38,8 @@ const FormattedBudget = ({ value }: Props) => { {formatNumber(value)} ); - } else if (currency === 'CRE') { - return ( - <> - {formatMessage(messages.xCredits, { - numberOfCredits: formatNumber(value), - })} - - ); } else { - return <>{formatCurrency(locale, currency, value)}; + return <>{formatCurrency(value)}; } }; From af17527e9dd281688b3b11f856aba7d9731d4ee0 Mon Sep 17 00:00:00 2001 From: brentguf Date: Wed, 29 Jan 2025 13:32:15 +0100 Subject: [PATCH 12/15] Comment on TOK custom implementation --- front/app/utils/currency/FormattedBudget.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/front/app/utils/currency/FormattedBudget.tsx b/front/app/utils/currency/FormattedBudget.tsx index a6975d71766f..357e62d86953 100644 --- a/front/app/utils/currency/FormattedBudget.tsx +++ b/front/app/utils/currency/FormattedBudget.tsx @@ -29,8 +29,8 @@ const FormattedBudget = ({ value }: Props) => { const currency = appConfiguration.data.attributes.settings.core.currency; - // custom implementations for custom currencies - // see appConfiguration.ts for all currencies + // Custom implementations for 'TOK' currency for this component. + // Others are dealt with by the useFormatCurrency hook. if (currency === 'TOK') { return ( <> @@ -39,6 +39,7 @@ const FormattedBudget = ({ value }: Props) => { ); } else { + // return <>{formatCurrency(value)}; } }; From 54dd38ffc617ca4d37903c2ad6692f93784da502 Mon Sep 17 00:00:00 2001 From: brentguf Date: Wed, 29 Jan 2025 14:08:58 +0100 Subject: [PATCH 13/15] Remove empty comment --- front/app/utils/currency/FormattedBudget.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/front/app/utils/currency/FormattedBudget.tsx b/front/app/utils/currency/FormattedBudget.tsx index 357e62d86953..8ce3a0f0a021 100644 --- a/front/app/utils/currency/FormattedBudget.tsx +++ b/front/app/utils/currency/FormattedBudget.tsx @@ -39,7 +39,6 @@ const FormattedBudget = ({ value }: Props) => { ); } else { - // return <>{formatCurrency(value)}; } }; From 6a454581e97cf29ad28999592fcdbd65722b781e Mon Sep 17 00:00:00 2001 From: brentguf Date: Wed, 29 Jan 2025 17:18:17 +0100 Subject: [PATCH 14/15] Use currencyDisplay option (until formatCurrency is implemented everywhere) --- .../app/utils/currency/formatCurrency.test.ts | 58 +++++++++---------- front/app/utils/currency/formatCurrency.ts | 1 + 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/front/app/utils/currency/formatCurrency.test.ts b/front/app/utils/currency/formatCurrency.test.ts index cdbcb2d26194..5f6bd2e0ecee 100644 --- a/front/app/utils/currency/formatCurrency.test.ts +++ b/front/app/utils/currency/formatCurrency.test.ts @@ -1,34 +1,34 @@ -import formatCurrency from './formatCurrency'; +// import formatCurrency from './formatCurrency'; -describe('formatCurrency', () => { - const nonBreakingSpace = '\xa0'; +// describe('formatCurrency', () => { +// const nonBreakingSpace = '\xa0'; - it('respects separator conventions', () => { - // In US English, commas are used as thousands separators and periods as decimal separators. - expect( - formatCurrency('en', 'USD', 10000, { maximumFractionDigits: 2 }) - ).toEqual('$10,000.00'); - // In Dutch, periods are used as thousands separators and commas as decimal separators. - expect( - formatCurrency('nl-BE', 'EUR', 10000, { maximumFractionDigits: 2 }) - ).toEqual(`€${nonBreakingSpace}10.000,00`); - }); +// it('respects separator conventions', () => { +// // In US English, commas are used as thousands separators and periods as decimal separators. +// expect( +// formatCurrency('en', 'USD', 10000, { maximumFractionDigits: 2 }) +// ).toEqual('$10,000.00'); +// // In Dutch, periods are used as thousands separators and commas as decimal separators. +// expect( +// formatCurrency('nl-BE', 'EUR', 10000, { maximumFractionDigits: 2 }) +// ).toEqual(`€${nonBreakingSpace}10.000,00`); +// }); - it('respects the currency symbol position', () => { - // USD is a currency that uses the $ symbol before the amount, without a space. - expect(formatCurrency('en', 'USD', 100)).toEqual('$100'); +// it('respects the currency symbol position', () => { +// // USD is a currency that uses the $ symbol before the amount, without a space. +// expect(formatCurrency('en', 'USD', 100)).toEqual('$100'); - // With EUR, depending on convention in each nation, the symbol can either precede or follow the value, - // e.g., €10 or 10 €, often with an intervening space. - expect(formatCurrency('nl-BE', 'EUR', 100)).toEqual( - `€${nonBreakingSpace}100` - ); - expect(formatCurrency('de-DE', 'EUR', 100)).toEqual( - `100${nonBreakingSpace}€` - ); - }); +// // With EUR, depending on convention in each nation, the symbol can either precede or follow the value, +// // e.g., €10 or 10 €, often with an intervening space. +// expect(formatCurrency('nl-BE', 'EUR', 100)).toEqual( +// `€${nonBreakingSpace}100` +// ); +// expect(formatCurrency('de-DE', 'EUR', 100)).toEqual( +// `100${nonBreakingSpace}€` +// ); +// }); - it('has a reasonable fallback if the currency is undefined', () => { - expect(formatCurrency('en', undefined, 100)).toEqual('100'); - }); -}); +// it('has a reasonable fallback if the currency is undefined', () => { +// expect(formatCurrency('en', undefined, 100)).toEqual('100'); +// }); +// }); diff --git a/front/app/utils/currency/formatCurrency.ts b/front/app/utils/currency/formatCurrency.ts index 8a08537f56d6..79375fe0a0f9 100644 --- a/front/app/utils/currency/formatCurrency.ts +++ b/front/app/utils/currency/formatCurrency.ts @@ -12,6 +12,7 @@ function formatCurrency( style: currency ? 'currency' : 'decimal', currency, maximumFractionDigits, + currencyDisplay: 'code', }); return formatter.format(amount); From aae74f764389ed7110924eaa83554d983e6368fe Mon Sep 17 00:00:00 2001 From: brentguf Date: Wed, 29 Jan 2025 17:27:37 +0100 Subject: [PATCH 15/15] Align test with currency symbol (code such EUR instead of euro sign) --- .../app/utils/currency/formatCurrency.test.ts | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/front/app/utils/currency/formatCurrency.test.ts b/front/app/utils/currency/formatCurrency.test.ts index 5f6bd2e0ecee..f6cdf2d42007 100644 --- a/front/app/utils/currency/formatCurrency.test.ts +++ b/front/app/utils/currency/formatCurrency.test.ts @@ -1,34 +1,36 @@ -// import formatCurrency from './formatCurrency'; +import formatCurrency from './formatCurrency'; -// describe('formatCurrency', () => { -// const nonBreakingSpace = '\xa0'; +describe('formatCurrency', () => { + const nonBreakingSpace = '\xa0'; -// it('respects separator conventions', () => { -// // In US English, commas are used as thousands separators and periods as decimal separators. -// expect( -// formatCurrency('en', 'USD', 10000, { maximumFractionDigits: 2 }) -// ).toEqual('$10,000.00'); -// // In Dutch, periods are used as thousands separators and commas as decimal separators. -// expect( -// formatCurrency('nl-BE', 'EUR', 10000, { maximumFractionDigits: 2 }) -// ).toEqual(`€${nonBreakingSpace}10.000,00`); -// }); + it('respects separator conventions', () => { + // In US English, commas are used as thousands separators and periods as decimal separators. + expect( + formatCurrency('en', 'USD', 10000, { maximumFractionDigits: 2 }) + ).toEqual(`USD${nonBreakingSpace}10,000.00`); + // In Dutch, periods are used as thousands separators and commas as decimal separators. + expect( + formatCurrency('nl-BE', 'EUR', 10000, { maximumFractionDigits: 2 }) + ).toEqual(`EUR${nonBreakingSpace}10.000,00`); + }); -// it('respects the currency symbol position', () => { -// // USD is a currency that uses the $ symbol before the amount, without a space. -// expect(formatCurrency('en', 'USD', 100)).toEqual('$100'); + it('respects the currency symbol position', () => { + // USD is a currency that uses the $ symbol before the amount, without a space. + expect(formatCurrency('en', 'USD', 100)).toEqual( + `USD${nonBreakingSpace}100` + ); -// // With EUR, depending on convention in each nation, the symbol can either precede or follow the value, -// // e.g., €10 or 10 €, often with an intervening space. -// expect(formatCurrency('nl-BE', 'EUR', 100)).toEqual( -// `€${nonBreakingSpace}100` -// ); -// expect(formatCurrency('de-DE', 'EUR', 100)).toEqual( -// `100${nonBreakingSpace}€` -// ); -// }); + // With EUR, depending on convention in each nation, the symbol can either precede or follow the value, + // e.g., €10 or 10 €, often with an intervening space. + expect(formatCurrency('nl-BE', 'EUR', 100)).toEqual( + `EUR${nonBreakingSpace}100` + ); + expect(formatCurrency('de-DE', 'EUR', 100)).toEqual( + `100${nonBreakingSpace}EUR` + ); + }); -// it('has a reasonable fallback if the currency is undefined', () => { -// expect(formatCurrency('en', undefined, 100)).toEqual('100'); -// }); -// }); + it('has a reasonable fallback if the currency is undefined', () => { + expect(formatCurrency('en', undefined, 100)).toEqual('100'); + }); +});