diff --git a/app/javascript/common/intl-polyfills/allLocales.ts b/app/javascript/common/intl-polyfills/allLocales.ts deleted file mode 100644 index 47a9fcf0f..000000000 --- a/app/javascript/common/intl-polyfills/allLocales.ts +++ /dev/null @@ -1,9 +0,0 @@ -// License: LGPL-3.0-or-later -let allLocales = ['en']; - -export function setAllLocales(locales:string[]):string[]{ - allLocales = locales; - return allLocales; -} - -export default allLocales; \ No newline at end of file diff --git a/app/javascript/common/intl-polyfills/custom/getCanonicalLocales.ts b/app/javascript/common/intl-polyfills/custom/getCanonicalLocales.ts deleted file mode 100644 index 792614baf..000000000 --- a/app/javascript/common/intl-polyfills/custom/getCanonicalLocales.ts +++ /dev/null @@ -1,7 +0,0 @@ -// License: LGPL-3.0-or-later -import {shouldPolyfill} from '@formatjs/intl-getcanonicallocales/should-polyfill'; -export default async function getCanonicalLocales(): Promise { - if (shouldPolyfill()) { - await import('@formatjs/intl-getcanonicallocales/polyfill'); - } -} \ No newline at end of file diff --git a/app/javascript/common/intl-polyfills/custom/numberFormat.ts b/app/javascript/common/intl-polyfills/custom/numberFormat.ts deleted file mode 100644 index 8f188d7a3..000000000 --- a/app/javascript/common/intl-polyfills/custom/numberFormat.ts +++ /dev/null @@ -1,22 +0,0 @@ -// License: LGPL-3.0-or-later -import {shouldPolyfill} from '@formatjs/intl-numberformat/should-polyfill'; - -import pluralRules from './pluralRules'; - -import type {Polyfilled} from './types'; - -type PolyfilledNumberFormat = Polyfilled; - -export default async function numberFormat(locales:string[]) :Promise { - await pluralRules(locales); - if (shouldPolyfill()) { - // Load the polyfill 1st BEFORE loading data - await import('@formatjs/intl-numberformat/polyfill'); - } - - if ((Intl.NumberFormat as PolyfilledNumberFormat).polyfilled) { - await Promise.all( - locales.map(l => import("@formatjs/intl-numberformat/locale-data/"+ l)) - ); - } -} \ No newline at end of file diff --git a/app/javascript/common/intl-polyfills/custom/pluralRules.ts b/app/javascript/common/intl-polyfills/custom/pluralRules.ts deleted file mode 100644 index e10640d5a..000000000 --- a/app/javascript/common/intl-polyfills/custom/pluralRules.ts +++ /dev/null @@ -1,22 +0,0 @@ -// License: LGPL-3.0-or-later - -import {shouldPolyfill} from '@formatjs/intl-pluralrules/should-polyfill'; -import type {Polyfilled} from './types'; - -import getCanonicalLocales from './getCanonicalLocales'; - -type PolyfilledPluralRules = Polyfilled; - -export default async function pluralRules(locales:string[]):Promise { - await getCanonicalLocales(); - if (shouldPolyfill()) { - // Load the polyfill 1st BEFORE loading data - await import('@formatjs/intl-pluralrules/polyfill'); - } - - if ((Intl.PluralRules as PolyfilledPluralRules).polyfilled) { - await Promise.all( - locales.map(l => import("@formatjs/intl-pluralrules/locale-data/"+ l)) - ); - } -} \ No newline at end of file diff --git a/app/javascript/common/intl-polyfills/custom/types.ts b/app/javascript/common/intl-polyfills/custom/types.ts deleted file mode 100644 index 4efcead6e..000000000 --- a/app/javascript/common/intl-polyfills/custom/types.ts +++ /dev/null @@ -1,2 +0,0 @@ -// License: LGPL-3.0-or-later -export type Polyfilled = T & {polyfilled?:boolean}; \ No newline at end of file diff --git a/app/javascript/common/intl-polyfills/getCanonicalLocales.ts b/app/javascript/common/intl-polyfills/getCanonicalLocales.ts deleted file mode 100644 index 22450d913..000000000 --- a/app/javascript/common/intl-polyfills/getCanonicalLocales.ts +++ /dev/null @@ -1,4 +0,0 @@ -// License: LGPL-3.0-or-later -import getCanonicalLocales from './custom/getCanonicalLocales'; -const promise = getCanonicalLocales(); -export default promise; \ No newline at end of file diff --git a/app/javascript/common/intl-polyfills/index.ts b/app/javascript/common/intl-polyfills/index.ts deleted file mode 100644 index 03f7e4785..000000000 --- a/app/javascript/common/intl-polyfills/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -// License: LGPL-3.0-or-later -const promises = Promise.all([ - import('./getCanonicalLocales'), - import('./pluralRules'), - import('./numberFormat'), -]) as unknown as Promise; - -export default promises; diff --git a/app/javascript/common/intl-polyfills/numberFormat.ts b/app/javascript/common/intl-polyfills/numberFormat.ts deleted file mode 100644 index 2845f65cd..000000000 --- a/app/javascript/common/intl-polyfills/numberFormat.ts +++ /dev/null @@ -1,6 +0,0 @@ -// License: LGPL-3.0-or-later -import numberFormat from './custom/numberFormat'; -import allLocales from './allLocales'; - -const promise = numberFormat(allLocales); -export default promise; \ No newline at end of file diff --git a/app/javascript/common/intl-polyfills/pluralRules.ts b/app/javascript/common/intl-polyfills/pluralRules.ts deleted file mode 100644 index d9f6a4207..000000000 --- a/app/javascript/common/intl-polyfills/pluralRules.ts +++ /dev/null @@ -1,6 +0,0 @@ -// License: LGPL-3.0-or-later -import pluralRules from './custom/pluralRules'; -import allLocales from './allLocales'; - -const promise = pluralRules(allLocales); -export default promise; \ No newline at end of file diff --git a/app/javascript/components/form_fields/MoneyTextField.tsx b/app/javascript/components/form_fields/MoneyTextField.tsx index 43f9adf78..1d85d795a 100644 --- a/app/javascript/components/form_fields/MoneyTextField.tsx +++ b/app/javascript/components/form_fields/MoneyTextField.tsx @@ -9,7 +9,6 @@ import { useIntl } from "../intl"; import { MutableRefObject, useEffect, useRef } from "react"; import { useI18nCurrencyInput, Types } from '@houdiniproject/react-i18n-currency-input'; -import '../../common/intl-polyfills/numberFormat'; import { Control, ControllerFieldState, ControllerRenderProps, FormState, useController, FieldPath, FieldValues } from "react-hook-form"; import { useId } from "@reach/auto-id";