use-intl 2.22.1 → 2.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -3
- package/_IntlProvider.d.ts +1 -0
- package/_useLocale.d.ts +1 -0
- package/core.d.ts +1 -0
- package/dist/_IntlProvider.js +7 -0
- package/dist/_useLocale.js +7 -0
- package/dist/core.js +7 -0
- package/dist/development/IntlContext-b5cc6be8.js +8 -0
- package/dist/development/_IntlProvider.js +53 -0
- package/dist/development/_useLocale-321e619f.js +19 -0
- package/dist/development/_useLocale.js +11 -0
- package/dist/development/core.js +66 -0
- package/dist/development/createFormatter-4848f6c8.js +453 -0
- package/dist/development/index.js +28 -0
- package/dist/development/initializeConfig-0a0b87a7.js +120 -0
- package/dist/development/react.js +145 -0
- package/dist/esm/IntlContext-381f3ce4.js +1 -0
- package/dist/esm/_IntlProvider.js +1 -0
- package/dist/esm/_useLocale-89b32eb9.js +1 -0
- package/dist/esm/_useLocale.js +1 -0
- package/dist/esm/core.js +1 -0
- package/dist/esm/createFormatter-c871a8ce.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/initializeConfig-29e7ba4c.js +1 -0
- package/dist/esm/react.js +1 -0
- package/dist/index.js +3 -4
- package/dist/production/IntlContext-381f3ce4.js +1 -0
- package/dist/production/_IntlProvider.js +1 -0
- package/dist/production/_useLocale-8e23751a.js +1 -0
- package/dist/production/_useLocale.js +1 -0
- package/dist/production/core.js +1 -0
- package/dist/production/createFormatter-7a8c6f36.js +1 -0
- package/dist/production/index.js +1 -0
- package/dist/production/initializeConfig-984a566d.js +1 -0
- package/dist/production/react.js +1 -0
- package/dist/react.js +7 -0
- package/dist/types/src/_IntlProvider.d.ts +1 -0
- package/dist/types/src/_useLocale.d.ts +1 -0
- package/dist/{src → types/src}/core/IntlConfig.d.ts +1 -1
- package/dist/{core → types/src/core}/TranslationValues.d.ts +6 -5
- package/dist/{src → types/src}/core/createBaseTranslator.d.ts +5 -9
- package/dist/{src → types/src}/core/createTranslator.d.ts +16 -4
- package/dist/types/src/core/createTranslatorImpl.d.ts +16 -0
- package/dist/{core → types/src/core}/index.d.ts +14 -9
- package/dist/types/src/core/initializeConfig.d.ts +14 -0
- package/dist/types/src/core.d.ts +1 -0
- package/dist/types/src/react/IntlProvider.d.ts +7 -0
- package/dist/{src → types/src}/react/index.d.ts +0 -1
- package/dist/types/src/react/useMessages.d.ts +2 -0
- package/dist/{src → types/src}/react/useTranslations.d.ts +10 -1
- package/dist/{src → types/src}/react/useTranslationsImpl.d.ts +2 -1
- package/dist/types/src/react.d.ts +1 -0
- package/dist/types/test/core/createFormatter.test.d.ts +1 -0
- package/dist/types/test/core/createTranslator.test.d.ts +1 -0
- package/dist/types/test/react/IntlProvider.test.d.ts +1 -0
- package/dist/types/test/react/useFormatter.test.d.ts +1 -0
- package/dist/types/test/react/useLocale.test.d.ts +1 -0
- package/dist/types/test/react/useMessages.test.d.ts +1 -0
- package/dist/types/test/react/useNow.test.d.ts +1 -0
- package/dist/types/test/react/useTimeZone.test.d.ts +1 -0
- package/dist/types/test/react/useTranslations.test.d.ts +1 -0
- package/dist/types/test/setup.d.ts +1 -0
- package/package.json +38 -21
- package/react.d.ts +1 -0
- package/dist/_virtual/use-intl.esm.js +0 -102
- package/dist/_virtual/use-intl.esm.js.map +0 -1
- package/dist/core/AbstractIntlMessages.d.ts +0 -9
- package/dist/core/DateTimeFormatOptions.d.ts +0 -73
- package/dist/core/Formats.d.ts +0 -8
- package/dist/core/IntlConfig.d.ts +0 -54
- package/dist/core/IntlError.d.ts +0 -14
- package/dist/core/MessageFormatCache.d.ts +0 -5
- package/dist/core/NumberFormatOptions.d.ts +0 -2
- package/dist/core/RelativeTimeFormatOptions.d.ts +0 -5
- package/dist/core/TimeZone.d.ts +0 -2
- package/dist/core/convertFormatsToIntlMessageFormat.d.ts +0 -11
- package/dist/core/createBaseTranslator.d.ts +0 -26
- package/dist/core/createFormatter.d.ts +0 -20
- package/dist/core/createIntl.d.ts +0 -7
- package/dist/core/createTranslator.d.ts +0 -48
- package/dist/core/createTranslatorImpl.d.ts +0 -14
- package/dist/core/defaults.d.ts +0 -11
- package/dist/core/resolveNamespace.d.ts +0 -5
- package/dist/core/use-intl.esm.js +0 -34
- package/dist/core/use-intl.esm.js.map +0 -1
- package/dist/core/use-intl.esm10.js +0 -37
- package/dist/core/use-intl.esm10.js.map +0 -1
- package/dist/core/use-intl.esm2.js +0 -36
- package/dist/core/use-intl.esm2.js.map +0 -1
- package/dist/core/use-intl.esm3.js +0 -161
- package/dist/core/use-intl.esm3.js.map +0 -1
- package/dist/core/use-intl.esm4.js +0 -14
- package/dist/core/use-intl.esm4.js.map +0 -1
- package/dist/core/use-intl.esm5.js +0 -53
- package/dist/core/use-intl.esm5.js.map +0 -1
- package/dist/core/use-intl.esm6.js +0 -15
- package/dist/core/use-intl.esm6.js.map +0 -1
- package/dist/core/use-intl.esm7.js +0 -200
- package/dist/core/use-intl.esm7.js.map +0 -1
- package/dist/core/use-intl.esm8.js +0 -10
- package/dist/core/use-intl.esm8.js.map +0 -1
- package/dist/core/use-intl.esm9.js +0 -28
- package/dist/core/use-intl.esm9.js.map +0 -1
- package/dist/core/utils/MessageKeys.d.ts +0 -5
- package/dist/core/utils/NamespaceKeys.d.ts +0 -5
- package/dist/core/utils/NestedKeyOf.d.ts +0 -4
- package/dist/core/utils/NestedValueOf.d.ts +0 -2
- package/dist/core/validateMessages.d.ts +0 -3
- package/dist/index.d.ts +0 -2
- package/dist/react/IntlContext.d.ts +0 -13
- package/dist/react/IntlProvider.d.ts +0 -7
- package/dist/react/getInitializedConfig.d.ts +0 -13
- package/dist/react/index.d.ts +0 -8
- package/dist/react/use-intl.esm.js +0 -22
- package/dist/react/use-intl.esm.js.map +0 -1
- package/dist/react/use-intl.esm10.js +0 -29
- package/dist/react/use-intl.esm10.js.map +0 -1
- package/dist/react/use-intl.esm11.js +0 -13
- package/dist/react/use-intl.esm11.js.map +0 -1
- package/dist/react/use-intl.esm12.js +0 -43
- package/dist/react/use-intl.esm12.js.map +0 -1
- package/dist/react/use-intl.esm2.js +0 -26
- package/dist/react/use-intl.esm2.js.map +0 -1
- package/dist/react/use-intl.esm3.js +0 -8
- package/dist/react/use-intl.esm3.js.map +0 -1
- package/dist/react/use-intl.esm4.js +0 -45
- package/dist/react/use-intl.esm4.js.map +0 -1
- package/dist/react/use-intl.esm5.js +0 -8
- package/dist/react/use-intl.esm5.js.map +0 -1
- package/dist/react/use-intl.esm6.js +0 -8
- package/dist/react/use-intl.esm6.js.map +0 -1
- package/dist/react/use-intl.esm7.js +0 -24
- package/dist/react/use-intl.esm7.js.map +0 -1
- package/dist/react/use-intl.esm8.js +0 -30
- package/dist/react/use-intl.esm8.js.map +0 -1
- package/dist/react/use-intl.esm9.js +0 -6
- package/dist/react/use-intl.esm9.js.map +0 -1
- package/dist/react/useFormatter.d.ts +0 -6
- package/dist/react/useIntl.d.ts +0 -6
- package/dist/react/useIntlContext.d.ts +0 -10
- package/dist/react/useLocale.d.ts +0 -1
- package/dist/react/useMessages.d.ts +0 -1
- package/dist/react/useNow.d.ts +0 -23
- package/dist/react/useTimeZone.d.ts +0 -1
- package/dist/react/useTranslations.d.ts +0 -44
- package/dist/react/useTranslationsImpl.d.ts +0 -8
- package/dist/src/core/AbstractIntlMessages.js +0 -2
- package/dist/src/core/AbstractIntlMessages.js.map +0 -1
- package/dist/src/core/DateTimeFormatOptions.js +0 -3
- package/dist/src/core/DateTimeFormatOptions.js.map +0 -1
- package/dist/src/core/Formats.js +0 -2
- package/dist/src/core/Formats.js.map +0 -1
- package/dist/src/core/IntlConfig.js +0 -2
- package/dist/src/core/IntlConfig.js.map +0 -1
- package/dist/src/core/IntlError.js +0 -24
- package/dist/src/core/IntlError.js.map +0 -1
- package/dist/src/core/MessageFormatCache.js +0 -2
- package/dist/src/core/MessageFormatCache.js.map +0 -1
- package/dist/src/core/NumberFormatOptions.js +0 -2
- package/dist/src/core/NumberFormatOptions.js.map +0 -1
- package/dist/src/core/RelativeTimeFormatOptions.js +0 -2
- package/dist/src/core/RelativeTimeFormatOptions.js.map +0 -1
- package/dist/src/core/TimeZone.js +0 -2
- package/dist/src/core/TimeZone.js.map +0 -1
- package/dist/src/core/TranslationValues.d.ts +0 -5
- package/dist/src/core/TranslationValues.js +0 -2
- package/dist/src/core/TranslationValues.js.map +0 -1
- package/dist/src/core/convertFormatsToIntlMessageFormat.js +0 -47
- package/dist/src/core/convertFormatsToIntlMessageFormat.js.map +0 -1
- package/dist/src/core/createBaseTranslator.js +0 -218
- package/dist/src/core/createBaseTranslator.js.map +0 -1
- package/dist/src/core/createFormatter.js +0 -163
- package/dist/src/core/createFormatter.js.map +0 -1
- package/dist/src/core/createIntl.d.ts +0 -7
- package/dist/src/core/createIntl.js +0 -11
- package/dist/src/core/createIntl.js.map +0 -1
- package/dist/src/core/createTranslator.js +0 -23
- package/dist/src/core/createTranslator.js.map +0 -1
- package/dist/src/core/createTranslatorImpl.d.ts +0 -14
- package/dist/src/core/createTranslatorImpl.js +0 -43
- package/dist/src/core/createTranslatorImpl.js.map +0 -1
- package/dist/src/core/defaults.js +0 -11
- package/dist/src/core/defaults.js.map +0 -1
- package/dist/src/core/index.d.ts +0 -9
- package/dist/src/core/index.js +0 -6
- package/dist/src/core/index.js.map +0 -1
- package/dist/src/core/resolveNamespace.js +0 -10
- package/dist/src/core/resolveNamespace.js.map +0 -1
- package/dist/src/core/utils/MessageKeys.js +0 -2
- package/dist/src/core/utils/MessageKeys.js.map +0 -1
- package/dist/src/core/utils/NamespaceKeys.js +0 -2
- package/dist/src/core/utils/NamespaceKeys.js.map +0 -1
- package/dist/src/core/utils/NestedKeyOf.js +0 -2
- package/dist/src/core/utils/NestedKeyOf.js.map +0 -1
- package/dist/src/core/utils/NestedValueOf.js +0 -2
- package/dist/src/core/utils/NestedValueOf.js.map +0 -1
- package/dist/src/core/validateMessages.js +0 -56
- package/dist/src/core/validateMessages.js.map +0 -1
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +0 -1
- package/dist/src/react/IntlContext.js +0 -4
- package/dist/src/react/IntlContext.js.map +0 -1
- package/dist/src/react/IntlProvider.d.ts +0 -7
- package/dist/src/react/IntlProvider.js +0 -11
- package/dist/src/react/IntlProvider.js.map +0 -1
- package/dist/src/react/getInitializedConfig.d.ts +0 -13
- package/dist/src/react/getInitializedConfig.js +0 -21
- package/dist/src/react/getInitializedConfig.js.map +0 -1
- package/dist/src/react/index.js +0 -10
- package/dist/src/react/index.js.map +0 -1
- package/dist/src/react/useFormatter.js +0 -14
- package/dist/src/react/useFormatter.js.map +0 -1
- package/dist/src/react/useIntl.d.ts +0 -6
- package/dist/src/react/useIntl.js +0 -20
- package/dist/src/react/useIntl.js.map +0 -1
- package/dist/src/react/useIntlContext.js +0 -12
- package/dist/src/react/useIntlContext.js.map +0 -1
- package/dist/src/react/useLocale.js +0 -5
- package/dist/src/react/useLocale.js.map +0 -1
- package/dist/src/react/useMessages.d.ts +0 -1
- package/dist/src/react/useMessages.js +0 -5
- package/dist/src/react/useMessages.js.map +0 -1
- package/dist/src/react/useNow.js +0 -40
- package/dist/src/react/useNow.js.map +0 -1
- package/dist/src/react/useTimeZone.js +0 -5
- package/dist/src/react/useTimeZone.js.map +0 -1
- package/dist/src/react/useTranslations.js +0 -21
- package/dist/src/react/useTranslations.js.map +0 -1
- package/dist/src/react/useTranslationsImpl.js +0 -35
- package/dist/src/react/useTranslationsImpl.js.map +0 -1
- package/dist/use-intl.cjs.development.js +0 -863
- package/dist/use-intl.cjs.development.js.map +0 -1
- package/dist/use-intl.cjs.production.min.js +0 -2
- package/dist/use-intl.cjs.production.min.js.map +0 -1
- package/dist/use-intl.esm.js +0 -13
- package/dist/use-intl.esm.js.map +0 -1
- package/src/core/AbstractIntlMessages.tsx +0 -10
- package/src/core/DateTimeFormatOptions.tsx +0 -130
- package/src/core/Formats.tsx +0 -10
- package/src/core/IntlConfig.tsx +0 -59
- package/src/core/IntlError.tsx +0 -27
- package/src/core/MessageFormatCache.tsx +0 -10
- package/src/core/NumberFormatOptions.tsx +0 -3
- package/src/core/RelativeTimeFormatOptions.tsx +0 -6
- package/src/core/TimeZone.tsx +0 -426
- package/src/core/TranslationValues.tsx +0 -22
- package/src/core/convertFormatsToIntlMessageFormat.tsx +0 -63
- package/src/core/createBaseTranslator.tsx +0 -352
- package/src/core/createFormatter.tsx +0 -242
- package/src/core/createIntl.tsx +0 -13
- package/src/core/createTranslator.tsx +0 -111
- package/src/core/createTranslatorImpl.tsx +0 -87
- package/src/core/defaults.tsx +0 -18
- package/src/core/index.tsx +0 -14
- package/src/core/resolveNamespace.tsx +0 -12
- package/src/core/utils/MessageKeys.tsx +0 -9
- package/src/core/utils/NamespaceKeys.tsx +0 -9
- package/src/core/utils/NestedKeyOf.tsx +0 -9
- package/src/core/utils/NestedValueOf.tsx +0 -12
- package/src/core/validateMessages.tsx +0 -77
- package/src/index.tsx +0 -2
- package/src/react/IntlContext.tsx +0 -12
- package/src/react/IntlProvider.tsx +0 -23
- package/src/react/getInitializedConfig.tsx +0 -29
- package/src/react/index.tsx +0 -10
- package/src/react/useFormatter.tsx +0 -19
- package/src/react/useIntl.tsx +0 -29
- package/src/react/useIntlContext.tsx +0 -16
- package/src/react/useLocale.tsx +0 -5
- package/src/react/useMessages.tsx +0 -5
- package/src/react/useNow.tsx +0 -49
- package/src/react/useTimeZone.tsx +0 -5
- package/src/react/useTranslations.tsx +0 -103
- package/src/react/useTranslationsImpl.tsx +0 -61
- /package/dist/{src → types/src}/core/AbstractIntlMessages.d.ts +0 -0
- /package/dist/{src → types/src}/core/DateTimeFormatOptions.d.ts +0 -0
- /package/dist/{src → types/src}/core/Formats.d.ts +0 -0
- /package/dist/{src → types/src}/core/IntlError.d.ts +0 -0
- /package/dist/{src → types/src}/core/MessageFormatCache.d.ts +0 -0
- /package/dist/{src → types/src}/core/NumberFormatOptions.d.ts +0 -0
- /package/dist/{src → types/src}/core/RelativeTimeFormatOptions.d.ts +0 -0
- /package/dist/{src → types/src}/core/TimeZone.d.ts +0 -0
- /package/dist/{src → types/src}/core/convertFormatsToIntlMessageFormat.d.ts +0 -0
- /package/dist/{src → types/src}/core/createFormatter.d.ts +0 -0
- /package/dist/{src → types/src}/core/defaults.d.ts +0 -0
- /package/dist/{src → types/src}/core/resolveNamespace.d.ts +0 -0
- /package/dist/{src → types/src}/core/utils/MessageKeys.d.ts +0 -0
- /package/dist/{src → types/src}/core/utils/NamespaceKeys.d.ts +0 -0
- /package/dist/{src → types/src}/core/utils/NestedKeyOf.d.ts +0 -0
- /package/dist/{src → types/src}/core/utils/NestedValueOf.d.ts +0 -0
- /package/dist/{src → types/src}/core/validateMessages.d.ts +0 -0
- /package/dist/{src → types/src}/index.d.ts +0 -0
- /package/dist/{src → types/src}/react/IntlContext.d.ts +0 -0
- /package/dist/{src → types/src}/react/useFormatter.d.ts +0 -0
- /package/dist/{src → types/src}/react/useIntlContext.d.ts +0 -0
- /package/dist/{src → types/src}/react/useLocale.d.ts +0 -0
- /package/dist/{src → types/src}/react/useNow.d.ts +0 -0
- /package/dist/{src → types/src}/react/useTimeZone.d.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-intl.esm4.js","sources":["../../src/react/useNow.tsx"],"sourcesContent":["import {useState, useEffect} from 'react';\nimport useIntlContext from './useIntlContext';\n\ntype Options = {\n updateInterval?: number;\n};\n\nfunction getNow() {\n return new Date();\n}\n\n/**\n * Reading the current date via `new Date()` in components should be avoided, as\n * it causes components to be impure and can lead to flaky tests. Instead, this\n * hook can be used.\n *\n * By default, it returns the time when the component mounts. If `updateInterval`\n * is specified, the value will be updated based on the interval.\n *\n * You can however also return a static value from this hook, if you\n * configure the `now` parameter on the context provider. Note however,\n * that if `updateInterval` is configured in this case, the component\n * will initialize with the global value, but will afterwards update\n * continuously based on the interval.\n *\n * For unit tests, this can be mocked to a constant value. For end-to-end\n * testing, an environment parameter can be passed to the `now` parameter\n * of the provider to mock this to a static value.\n */\nexport default function useNow(options?: Options) {\n const updateInterval = options?.updateInterval;\n\n const {now: globalNow} = useIntlContext();\n const [now, setNow] = useState(globalNow || getNow());\n\n useEffect(() => {\n if (!updateInterval) return;\n\n const intervalId = setInterval(() => {\n setNow(getNow());\n }, updateInterval);\n\n return () => {\n clearInterval(intervalId);\n };\n }, [globalNow, updateInterval]);\n\n return now;\n}\n"],"names":["getNow","Date","useNow","options","updateInterval","_useIntlContext","useIntlContext","globalNow","now","_useState","useState","setNow","useEffect","intervalId","setInterval","clearInterval"],"mappings":";;;AAOA,SAASA,MAAMA,GAAA;EACb,OAAO,IAAIC,IAAI,EAAE,CAAA;AACnB,CAAA;AAEA;;;;;;;;;;;;;;;;;AAiBG;AACqB,SAAAC,MAAMA,CAACC,OAAiB,EAAA;AAC9C,EAAA,IAAMC,cAAc,GAAGD,OAAO,IAAPA,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,OAAO,CAAEC,cAAc,CAAA;AAE9C,EAAA,IAAAC,eAAA,GAAyBC,cAAc,EAAE;IAA7BC,SAAS,GAAAF,eAAA,CAAdG,GAAG,CAAA;EACV,IAAAC,SAAA,GAAsBC,QAAQ,CAACH,SAAS,IAAIP,MAAM,EAAE,CAAC;AAA9CQ,IAAAA,GAAG,GAAAC,SAAA,CAAA,CAAA,CAAA;AAAEE,IAAAA,MAAM,GAAAF,SAAA,CAAA,CAAA,CAAA,CAAA;AAElBG,EAAAA,SAAS,CAAC,YAAK;IACb,IAAI,CAACR,cAAc,EAAE,OAAA;AAErB,IAAA,IAAMS,UAAU,GAAGC,WAAW,CAAC,YAAK;AAClCH,MAAAA,MAAM,CAACX,MAAM,EAAE,CAAC,CAAA;KACjB,EAAEI,cAAc,CAAC,CAAA;AAElB,IAAA,OAAO,YAAK;MACVW,aAAa,CAACF,UAAU,CAAC,CAAA;KAC1B,CAAA;AACH,GAAC,EAAE,CAACN,SAAS,EAAEH,cAAc,CAAC,CAAC,CAAA;AAE/B,EAAA,OAAOI,GAAG,CAAA;AACZ;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-intl.esm5.js","sources":["../../src/react/useTimeZone.tsx"],"sourcesContent":["import useIntlContext from './useIntlContext';\n\nexport default function useTimeZone() {\n return useIntlContext().timeZone;\n}\n"],"names":["useTimeZone","useIntlContext","timeZone"],"mappings":";;AAEc,SAAUA,WAAWA,GAAA;AACjC,EAAA,OAAOC,cAAc,EAAE,CAACC,QAAQ,CAAA;AAClC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-intl.esm6.js","sources":["../../src/react/useMessages.tsx"],"sourcesContent":["import useIntlContext from './useIntlContext';\n\nexport default function useMessages() {\n return useIntlContext().messages;\n}\n"],"names":["useMessages","useIntlContext","messages"],"mappings":";;AAEc,SAAUA,WAAWA,GAAA;AACjC,EAAA,OAAOC,cAAc,EAAE,CAACC,QAAQ,CAAA;AAClC;;;;"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import createFormatter from '../core/use-intl.esm3.js';
|
|
3
|
-
import useIntlContext from './use-intl.esm11.js';
|
|
4
|
-
|
|
5
|
-
function useFormatter() {
|
|
6
|
-
var _useIntlContext = useIntlContext(),
|
|
7
|
-
formats = _useIntlContext.formats,
|
|
8
|
-
locale = _useIntlContext.locale,
|
|
9
|
-
globalNow = _useIntlContext.now,
|
|
10
|
-
onError = _useIntlContext.onError,
|
|
11
|
-
timeZone = _useIntlContext.timeZone;
|
|
12
|
-
return useMemo(function () {
|
|
13
|
-
return createFormatter({
|
|
14
|
-
formats: formats,
|
|
15
|
-
locale: locale,
|
|
16
|
-
now: globalNow,
|
|
17
|
-
onError: onError,
|
|
18
|
-
timeZone: timeZone
|
|
19
|
-
});
|
|
20
|
-
}, [formats, globalNow, locale, onError, timeZone]);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { useFormatter as default };
|
|
24
|
-
//# sourceMappingURL=use-intl.esm7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-intl.esm7.js","sources":["../../src/react/useFormatter.tsx"],"sourcesContent":["import {useMemo} from 'react';\nimport createFormatter from '../core/createFormatter';\nimport useIntlContext from './useIntlContext';\n\nexport default function useFormatter() {\n const {formats, locale, now: globalNow, onError, timeZone} = useIntlContext();\n\n return useMemo(\n () =>\n createFormatter({\n formats,\n locale,\n now: globalNow,\n onError,\n timeZone\n }),\n [formats, globalNow, locale, onError, timeZone]\n );\n}\n"],"names":["useFormatter","_useIntlContext","useIntlContext","formats","locale","globalNow","now","onError","timeZone","useMemo","createFormatter"],"mappings":";;;;AAIc,SAAUA,YAAYA,GAAA;AAClC,EAAA,IAAAC,eAAA,GAA6DC,cAAc,EAAE;IAAtEC,OAAO,GAAAF,eAAA,CAAPE,OAAO;IAAEC,MAAM,GAAAH,eAAA,CAANG,MAAM;IAAOC,SAAS,GAAAJ,eAAA,CAAdK,GAAG;IAAaC,OAAO,GAAAN,eAAA,CAAPM,OAAO;IAAEC,QAAQ,GAAAP,eAAA,CAARO,QAAQ,CAAA;AAEzD,EAAA,OAAOC,OAAO,CACZ,YAAA;AAAA,IAAA,OACEC,eAAe,CAAC;AACdP,MAAAA,OAAO,EAAPA,OAAO;AACPC,MAAAA,MAAM,EAANA,MAAM;AACNE,MAAAA,GAAG,EAAED,SAAS;AACdE,MAAAA,OAAO,EAAPA,OAAO;AACPC,MAAAA,QAAQ,EAARA,QAAAA;AACD,KAAA,CAAC,CAAA;GACJ,EAAA,CAACL,OAAO,EAAEE,SAAS,EAAED,MAAM,EAAEG,OAAO,EAAEC,QAAQ,CAAC,CAChD,CAAA;AACH;;;;"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import createIntl from '../core/use-intl.esm4.js';
|
|
3
|
-
import useIntlContext from './use-intl.esm11.js';
|
|
4
|
-
|
|
5
|
-
var hasWarned = false;
|
|
6
|
-
/** @deprecated Switch to `useFormatter` instead. */
|
|
7
|
-
function useIntl() {
|
|
8
|
-
var _useIntlContext = useIntlContext(),
|
|
9
|
-
formats = _useIntlContext.formats,
|
|
10
|
-
locale = _useIntlContext.locale,
|
|
11
|
-
globalNow = _useIntlContext.now,
|
|
12
|
-
onError = _useIntlContext.onError,
|
|
13
|
-
timeZone = _useIntlContext.timeZone;
|
|
14
|
-
if (!hasWarned) {
|
|
15
|
-
hasWarned = true;
|
|
16
|
-
console.warn('`useIntl()` is deprecated and will be removed in the next major version. Please switch to `useFormatter()`.');
|
|
17
|
-
}
|
|
18
|
-
return useMemo(function () {
|
|
19
|
-
return createIntl({
|
|
20
|
-
formats: formats,
|
|
21
|
-
locale: locale,
|
|
22
|
-
now: globalNow,
|
|
23
|
-
onError: onError,
|
|
24
|
-
timeZone: timeZone
|
|
25
|
-
});
|
|
26
|
-
}, [formats, globalNow, locale, onError, timeZone]);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { useIntl as default };
|
|
30
|
-
//# sourceMappingURL=use-intl.esm8.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-intl.esm8.js","sources":["../../src/react/useIntl.tsx"],"sourcesContent":["import {useMemo} from 'react';\nimport createIntl from '../core/createIntl';\nimport useIntlContext from './useIntlContext';\n\nlet hasWarned = false;\n\n/** @deprecated Switch to `useFormatter` instead. */\nexport default function useIntl() {\n const {formats, locale, now: globalNow, onError, timeZone} = useIntlContext();\n\n if (!hasWarned) {\n hasWarned = true;\n console.warn(\n '`useIntl()` is deprecated and will be removed in the next major version. Please switch to `useFormatter()`.'\n );\n }\n\n return useMemo(\n () =>\n createIntl({\n formats,\n locale,\n now: globalNow,\n onError,\n timeZone\n }),\n [formats, globalNow, locale, onError, timeZone]\n );\n}\n"],"names":["hasWarned","useIntl","_useIntlContext","useIntlContext","formats","locale","globalNow","now","onError","timeZone","console","warn","useMemo","createIntl"],"mappings":";;;;AAIA,IAAIA,SAAS,GAAG,KAAK,CAAA;AAErB;AACc,SAAUC,OAAOA,GAAA;AAC7B,EAAA,IAAAC,eAAA,GAA6DC,cAAc,EAAE;IAAtEC,OAAO,GAAAF,eAAA,CAAPE,OAAO;IAAEC,MAAM,GAAAH,eAAA,CAANG,MAAM;IAAOC,SAAS,GAAAJ,eAAA,CAAdK,GAAG;IAAaC,OAAO,GAAAN,eAAA,CAAPM,OAAO;IAAEC,QAAQ,GAAAP,eAAA,CAARO,QAAQ,CAAA;EAEzD,IAAI,CAACT,SAAS,EAAE;AACdA,IAAAA,SAAS,GAAG,IAAI,CAAA;AAChBU,IAAAA,OAAO,CAACC,IAAI,CACV,6GAA6G,CAC9G,CAAA;AACF,GAAA;AAED,EAAA,OAAOC,OAAO,CACZ,YAAA;AAAA,IAAA,OACEC,UAAU,CAAC;AACTT,MAAAA,OAAO,EAAPA,OAAO;AACPC,MAAAA,MAAM,EAANA,MAAM;AACNE,MAAAA,GAAG,EAAED,SAAS;AACdE,MAAAA,OAAO,EAAPA,OAAO;AACPC,MAAAA,QAAQ,EAARA,QAAAA;AACD,KAAA,CAAC,CAAA;GACJ,EAAA,CAACL,OAAO,EAAEE,SAAS,EAAED,MAAM,EAAEG,OAAO,EAAEC,QAAQ,CAAC,CAChD,CAAA;AACH;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-intl.esm9.js","sources":["../../src/react/IntlContext.tsx"],"sourcesContent":["import {createContext} from 'react';\nimport {InitializedIntlConfig} from '../core/IntlConfig';\nimport MessageFormatCache from '../core/MessageFormatCache';\n\nconst IntlContext = createContext<\n | (InitializedIntlConfig & {\n messageFormatCache?: MessageFormatCache;\n })\n | undefined\n>(undefined);\n\nexport default IntlContext;\n"],"names":["IntlContext","createContext","undefined"],"mappings":";;AAIA,IAAMA,WAAW,gBAAGC,aAAa,CAK/BC,SAAS;;;;"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export default function useFormatter(): {
|
|
2
|
-
dateTime: (value: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
|
|
3
|
-
number: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract/types/number").NumberFormatOptions | undefined) => string;
|
|
4
|
-
relativeTime: (date: number | Date, nowOrOptions?: number | Date | import("../core/RelativeTimeFormatOptions").default | undefined) => string;
|
|
5
|
-
list: (value: Iterable<string>, formatOrOptions?: string | Intl.ListFormatOptions | undefined) => string;
|
|
6
|
-
};
|
package/dist/react/useIntl.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/** @deprecated Switch to `useFormatter` instead. */
|
|
2
|
-
export default function useIntl(): {
|
|
3
|
-
formatDateTime: (value: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
|
|
4
|
-
formatNumber: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract/types/number").NumberFormatOptions | undefined) => string;
|
|
5
|
-
formatRelativeTime: (date: number | Date, nowOrOptions?: number | Date | import("../core/RelativeTimeFormatOptions").default | undefined) => string;
|
|
6
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default function useIntlContext(): import("../core/IntlConfig").default<import("../core/AbstractIntlMessages").default> & {
|
|
2
|
-
onError: (error: import("..").IntlError) => void;
|
|
3
|
-
getMessageFallback: (info: {
|
|
4
|
-
error: import("..").IntlError;
|
|
5
|
-
key: string;
|
|
6
|
-
namespace?: string | undefined;
|
|
7
|
-
}) => string;
|
|
8
|
-
} & {
|
|
9
|
-
messageFormatCache?: import("../core/MessageFormatCache").default | undefined;
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function useLocale(): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function useMessages(): import("../core/AbstractIntlMessages").default | undefined;
|
package/dist/react/useNow.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
type Options = {
|
|
2
|
-
updateInterval?: number;
|
|
3
|
-
};
|
|
4
|
-
/**
|
|
5
|
-
* Reading the current date via `new Date()` in components should be avoided, as
|
|
6
|
-
* it causes components to be impure and can lead to flaky tests. Instead, this
|
|
7
|
-
* hook can be used.
|
|
8
|
-
*
|
|
9
|
-
* By default, it returns the time when the component mounts. If `updateInterval`
|
|
10
|
-
* is specified, the value will be updated based on the interval.
|
|
11
|
-
*
|
|
12
|
-
* You can however also return a static value from this hook, if you
|
|
13
|
-
* configure the `now` parameter on the context provider. Note however,
|
|
14
|
-
* that if `updateInterval` is configured in this case, the component
|
|
15
|
-
* will initialize with the global value, but will afterwards update
|
|
16
|
-
* continuously based on the interval.
|
|
17
|
-
*
|
|
18
|
-
* For unit tests, this can be mocked to a constant value. For end-to-end
|
|
19
|
-
* testing, an environment parameter can be passed to the `now` parameter
|
|
20
|
-
* of the provider to mock this to a static value.
|
|
21
|
-
*/
|
|
22
|
-
export default function useNow(options?: Options): Date;
|
|
23
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function useTimeZone(): import("../core/TimeZone").default | undefined;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { ReactElement, ReactNodeArray } from 'react';
|
|
2
|
-
import Formats from '../core/Formats';
|
|
3
|
-
import TranslationValues, { RichTranslationValues } from '../core/TranslationValues';
|
|
4
|
-
import MessageKeys from '../core/utils/MessageKeys';
|
|
5
|
-
import NamespaceKeys from '../core/utils/NamespaceKeys';
|
|
6
|
-
import NestedKeyOf from '../core/utils/NestedKeyOf';
|
|
7
|
-
import NestedValueOf from '../core/utils/NestedValueOf';
|
|
8
|
-
/**
|
|
9
|
-
* Translates messages from the given namespace by using the ICU syntax.
|
|
10
|
-
* See https://formatjs.io/docs/core-concepts/icu-syntax.
|
|
11
|
-
*
|
|
12
|
-
* If no namespace is provided, all available messages are returned.
|
|
13
|
-
* The namespace can also indicate nesting by using a dot
|
|
14
|
-
* (e.g. `namespace.Component`).
|
|
15
|
-
*/
|
|
16
|
-
export default function useTranslations<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>(namespace?: NestedKey): {
|
|
17
|
-
<TargetKey extends MessageKeys<NestedValueOf<{
|
|
18
|
-
'!': IntlMessages;
|
|
19
|
-
}, [
|
|
20
|
-
NestedKey
|
|
21
|
-
] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
|
|
22
|
-
'!': IntlMessages;
|
|
23
|
-
}, [
|
|
24
|
-
NestedKey
|
|
25
|
-
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: TranslationValues, formats?: Partial<Formats>): string;
|
|
26
|
-
rich<TargetKey extends MessageKeys<NestedValueOf<{
|
|
27
|
-
'!': IntlMessages;
|
|
28
|
-
}, [
|
|
29
|
-
NestedKey
|
|
30
|
-
] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
|
|
31
|
-
'!': IntlMessages;
|
|
32
|
-
}, [
|
|
33
|
-
NestedKey
|
|
34
|
-
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: RichTranslationValues, formats?: Partial<Formats>): string | ReactElement | ReactNodeArray;
|
|
35
|
-
raw<TargetKey extends MessageKeys<NestedValueOf<{
|
|
36
|
-
'!': IntlMessages;
|
|
37
|
-
}, [
|
|
38
|
-
NestedKey
|
|
39
|
-
] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
|
|
40
|
-
'!': IntlMessages;
|
|
41
|
-
}, [
|
|
42
|
-
NestedKey
|
|
43
|
-
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey): any;
|
|
44
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import AbstractIntlMessages from '../core/AbstractIntlMessages';
|
|
3
|
-
import NestedKeyOf from '../core/utils/NestedKeyOf';
|
|
4
|
-
export default function useTranslationsImpl<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>(allMessages: Messages, namespace: NestedKey, namespacePrefix: string): {
|
|
5
|
-
<TargetKey extends unknown>(key: TargetKey, values?: import("../core/TranslationValues").default | undefined, formats?: Partial<import("../core/Formats").default> | undefined): string;
|
|
6
|
-
rich: (key: string, values?: import("..").RichTranslationValues | undefined, formats?: Partial<import("../core/Formats").default> | undefined) => string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNodeArray;
|
|
7
|
-
raw(key: string): any;
|
|
8
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractIntlMessages.js","sourceRoot":"","sources":["../../../src/core/AbstractIntlMessages.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeFormatOptions.js","sourceRoot":"","sources":["../../../src/core/DateTimeFormatOptions.tsx"],"names":[],"mappings":"AAAA,uDAAuD"}
|
package/dist/src/core/Formats.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Formats.js","sourceRoot":"","sources":["../../../src/core/Formats.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IntlConfig.js","sourceRoot":"","sources":["../../../src/core/IntlConfig.tsx"],"names":[],"mappings":""}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export var IntlErrorCode;
|
|
2
|
-
(function (IntlErrorCode) {
|
|
3
|
-
IntlErrorCode["MISSING_MESSAGE"] = "MISSING_MESSAGE";
|
|
4
|
-
IntlErrorCode["MISSING_FORMAT"] = "MISSING_FORMAT";
|
|
5
|
-
IntlErrorCode["ENVIRONMENT_FALLBACK"] = "ENVIRONMENT_FALLBACK";
|
|
6
|
-
IntlErrorCode["INSUFFICIENT_PATH"] = "INSUFFICIENT_PATH";
|
|
7
|
-
IntlErrorCode["INVALID_MESSAGE"] = "INVALID_MESSAGE";
|
|
8
|
-
IntlErrorCode["INVALID_KEY"] = "INVALID_KEY";
|
|
9
|
-
IntlErrorCode["FORMATTING_ERROR"] = "FORMATTING_ERROR";
|
|
10
|
-
})(IntlErrorCode || (IntlErrorCode = {}));
|
|
11
|
-
export default class IntlError extends Error {
|
|
12
|
-
constructor(code, originalMessage) {
|
|
13
|
-
let message = code;
|
|
14
|
-
if (originalMessage) {
|
|
15
|
-
message += ': ' + originalMessage;
|
|
16
|
-
}
|
|
17
|
-
super(message);
|
|
18
|
-
this.code = code;
|
|
19
|
-
if (originalMessage) {
|
|
20
|
-
this.originalMessage = originalMessage;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=IntlError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IntlError.js","sourceRoot":"","sources":["../../../src/core/IntlError.tsx"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,oDAAmC,CAAA;IACnC,kDAAiC,CAAA;IACjC,8DAA6C,CAAA;IAC7C,wDAAuC,CAAA;IACvC,oDAAmC,CAAA;IACnC,4CAA2B,CAAA;IAC3B,sDAAqC,CAAA;AACvC,CAAC,EARW,aAAa,KAAb,aAAa,QAQxB;AAED,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,KAAK;IAI1C,YAAY,IAAmB,EAAE,eAAwB;QACvD,IAAI,OAAO,GAAW,IAAI,CAAC;QAC3B,IAAI,eAAe,EAAE;YACnB,OAAO,IAAI,IAAI,GAAG,eAAe,CAAC;SACnC;QACD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,eAAe,EAAE;YACnB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;SACxC;IACH,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MessageFormatCache.js","sourceRoot":"","sources":["../../../src/core/MessageFormatCache.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NumberFormatOptions.js","sourceRoot":"","sources":["../../../src/core/NumberFormatOptions.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RelativeTimeFormatOptions.js","sourceRoot":"","sources":["../../../src/core/RelativeTimeFormatOptions.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TimeZone.js","sourceRoot":"","sources":["../../../src/core/TimeZone.tsx"],"names":[],"mappings":""}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export type TranslationValue = string | number | boolean | Date | null | undefined;
|
|
3
|
-
type TranslationValues = Record<string, TranslationValue>;
|
|
4
|
-
export type RichTranslationValues = Record<string, TranslationValue | ((chunks: ReactNode) => ReactNode)>;
|
|
5
|
-
export default TranslationValues;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationValues.js","sourceRoot":"","sources":["../../../src/core/TranslationValues.tsx"],"names":[],"mappings":""}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-named-as-default -- False positive
|
|
2
|
-
import IntlMessageFormat from 'intl-messageformat';
|
|
3
|
-
function setTimeZoneInFormats(formats, timeZone) {
|
|
4
|
-
if (!formats)
|
|
5
|
-
return formats;
|
|
6
|
-
// The only way to set a time zone with `intl-messageformat` is to merge it into the formats
|
|
7
|
-
// https://github.com/formatjs/formatjs/blob/8256c5271505cf2606e48e3c97ecdd16ede4f1b5/packages/intl/src/message.ts#L15
|
|
8
|
-
return Object.keys(formats).reduce((acc, key) => {
|
|
9
|
-
acc[key] = {
|
|
10
|
-
timeZone,
|
|
11
|
-
...formats[key]
|
|
12
|
-
};
|
|
13
|
-
return acc;
|
|
14
|
-
}, {});
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* `intl-messageformat` uses separate keys for `date` and `time`, but there's
|
|
18
|
-
* only one native API: `Intl.DateTimeFormat`. Additionally you might want to
|
|
19
|
-
* include both a time and a date in a value, therefore the separation doesn't
|
|
20
|
-
* seem so useful. We offer a single `dateTime` namespace instead, but we have
|
|
21
|
-
* to convert the format before `intl-messageformat` can be used.
|
|
22
|
-
*/
|
|
23
|
-
export default function convertFormatsToIntlMessageFormat(formats, timeZone) {
|
|
24
|
-
const formatsWithTimeZone = timeZone
|
|
25
|
-
? { ...formats, dateTime: setTimeZoneInFormats(formats.dateTime, timeZone) }
|
|
26
|
-
: formats;
|
|
27
|
-
const mfDateDefaults = IntlMessageFormat.formats.date;
|
|
28
|
-
const defaultDateFormats = timeZone
|
|
29
|
-
? setTimeZoneInFormats(mfDateDefaults, timeZone)
|
|
30
|
-
: mfDateDefaults;
|
|
31
|
-
const mfTimeDefaults = IntlMessageFormat.formats.time;
|
|
32
|
-
const defaultTimeFormats = timeZone
|
|
33
|
-
? setTimeZoneInFormats(mfTimeDefaults, timeZone)
|
|
34
|
-
: mfTimeDefaults;
|
|
35
|
-
return {
|
|
36
|
-
...formatsWithTimeZone,
|
|
37
|
-
date: {
|
|
38
|
-
...defaultDateFormats,
|
|
39
|
-
...formatsWithTimeZone?.dateTime
|
|
40
|
-
},
|
|
41
|
-
time: {
|
|
42
|
-
...defaultTimeFormats,
|
|
43
|
-
...formatsWithTimeZone?.dateTime
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=convertFormatsToIntlMessageFormat.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertFormatsToIntlMessageFormat.js","sourceRoot":"","sources":["../../../src/core/convertFormatsToIntlMessageFormat.tsx"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,OAAO,iBAA2C,MAAM,oBAAoB,CAAC;AAK7E,SAAS,oBAAoB,CAC3B,OAA0D,EAC1D,Q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1
|
-
// eslint-disable-next-line import/no-named-as-default -- False positive
|
|
2
|
-
import IntlMessageFormat from 'intl-messageformat';
|
|
3
|
-
import { cloneElement, isValidElement } from 'react';
|
|
4
|
-
import IntlError, { IntlErrorCode } from './IntlError';
|
|
5
|
-
import convertFormatsToIntlMessageFormat from './convertFormatsToIntlMessageFormat';
|
|
6
|
-
import { defaultGetMessageFallback, defaultOnError } from './defaults';
|
|
7
|
-
function resolvePath(messages, key, namespace) {
|
|
8
|
-
if (!messages) {
|
|
9
|
-
throw new Error(process.env.NODE_ENV !== 'production'
|
|
10
|
-
? `No messages available at \`${namespace}\`.`
|
|
11
|
-
: undefined);
|
|
12
|
-
}
|
|
13
|
-
let message = messages;
|
|
14
|
-
key.split('.').forEach((part) => {
|
|
15
|
-
const next = message[part];
|
|
16
|
-
if (part == null || next == null) {
|
|
17
|
-
throw new Error(process.env.NODE_ENV !== 'production'
|
|
18
|
-
? `Could not resolve \`${key}\` in ${namespace ? `\`${namespace}\`` : 'messages'}.`
|
|
19
|
-
: undefined);
|
|
20
|
-
}
|
|
21
|
-
message = next;
|
|
22
|
-
});
|
|
23
|
-
return message;
|
|
24
|
-
}
|
|
25
|
-
function prepareTranslationValues(values) {
|
|
26
|
-
if (Object.keys(values).length === 0)
|
|
27
|
-
return undefined;
|
|
28
|
-
// Workaround for https://github.com/formatjs/formatjs/issues/1467
|
|
29
|
-
const transformedValues = {};
|
|
30
|
-
Object.keys(values).forEach((key) => {
|
|
31
|
-
let index = 0;
|
|
32
|
-
const value = values[key];
|
|
33
|
-
let transformed;
|
|
34
|
-
if (typeof value === 'function') {
|
|
35
|
-
transformed = (chunks) => {
|
|
36
|
-
const result = value(chunks);
|
|
37
|
-
return isValidElement(result)
|
|
38
|
-
? cloneElement(result, { key: key + index++ })
|
|
39
|
-
: result;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
transformed = value;
|
|
44
|
-
}
|
|
45
|
-
transformedValues[key] = transformed;
|
|
46
|
-
});
|
|
47
|
-
return transformedValues;
|
|
48
|
-
}
|
|
49
|
-
export function getMessagesOrError({ messages, namespace, onError = defaultOnError }) {
|
|
50
|
-
try {
|
|
51
|
-
if (!messages) {
|
|
52
|
-
throw new Error(process.env.NODE_ENV !== 'production'
|
|
53
|
-
? `No messages were configured on the provider.`
|
|
54
|
-
: undefined);
|
|
55
|
-
}
|
|
56
|
-
const retrievedMessages = namespace
|
|
57
|
-
? resolvePath(messages, namespace)
|
|
58
|
-
: messages;
|
|
59
|
-
if (!retrievedMessages) {
|
|
60
|
-
throw new Error(process.env.NODE_ENV !== 'production'
|
|
61
|
-
? `No messages for namespace \`${namespace}\` found.`
|
|
62
|
-
: undefined);
|
|
63
|
-
}
|
|
64
|
-
return retrievedMessages;
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
const intlError = new IntlError(IntlErrorCode.MISSING_MESSAGE, error.message);
|
|
68
|
-
onError(intlError);
|
|
69
|
-
return intlError;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function getPlainMessage(candidate, values) {
|
|
73
|
-
if (values)
|
|
74
|
-
return undefined;
|
|
75
|
-
const unescapedMessage = candidate.replace(/'([{}])/gi, '$1');
|
|
76
|
-
// Placeholders can be in the message if there are default values,
|
|
77
|
-
// or if the user has forgotten to provide values. In the latter
|
|
78
|
-
// case we need to compile the message to receive an error.
|
|
79
|
-
const hasPlaceholders = /<|{/.test(unescapedMessage);
|
|
80
|
-
if (!hasPlaceholders) {
|
|
81
|
-
return unescapedMessage;
|
|
82
|
-
}
|
|
83
|
-
return undefined;
|
|
84
|
-
}
|
|
85
|
-
export default function createBaseTranslator({ defaultTranslationValues, formats: globalFormats, getMessageFallback = defaultGetMessageFallback, locale, messageFormatCache, messagesOrError, namespace, onError, timeZone }) {
|
|
86
|
-
function getFallbackFromErrorAndNotify(key, code, message) {
|
|
87
|
-
const error = new IntlError(code, message);
|
|
88
|
-
onError(error);
|
|
89
|
-
return getMessageFallback({ error, key, namespace });
|
|
90
|
-
}
|
|
91
|
-
function translateBaseFn(
|
|
92
|
-
/** Use a dot to indicate a level of nesting (e.g. `namespace.nestedLabel`). */
|
|
93
|
-
key,
|
|
94
|
-
/** Key value pairs for values to interpolate into the message. */
|
|
95
|
-
values,
|
|
96
|
-
/** Provide custom formats for numbers, dates and times. */
|
|
97
|
-
formats) {
|
|
98
|
-
if (messagesOrError instanceof IntlError) {
|
|
99
|
-
// We have already warned about this during render
|
|
100
|
-
return getMessageFallback({
|
|
101
|
-
error: messagesOrError,
|
|
102
|
-
key,
|
|
103
|
-
namespace
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
const messages = messagesOrError;
|
|
107
|
-
let message;
|
|
108
|
-
try {
|
|
109
|
-
message = resolvePath(messages, key, namespace);
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
return getFallbackFromErrorAndNotify(key, IntlErrorCode.MISSING_MESSAGE, error.message);
|
|
113
|
-
}
|
|
114
|
-
function joinPath(parts) {
|
|
115
|
-
return parts.filter((part) => part != null).join('.');
|
|
116
|
-
}
|
|
117
|
-
const cacheKey = joinPath([locale, namespace, key, String(message)]);
|
|
118
|
-
let messageFormat;
|
|
119
|
-
if (messageFormatCache?.has(cacheKey)) {
|
|
120
|
-
messageFormat = messageFormatCache.get(cacheKey);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
if (typeof message === 'object') {
|
|
124
|
-
let code, errorMessage;
|
|
125
|
-
if (Array.isArray(message)) {
|
|
126
|
-
code = IntlErrorCode.INVALID_MESSAGE;
|
|
127
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
128
|
-
errorMessage = `Message at \`${joinPath([
|
|
129
|
-
namespace,
|
|
130
|
-
key
|
|
131
|
-
])}\` resolved to an array, but only strings are supported. See https://next-intl-docs.vercel.app/docs/usage/messages#arrays-of-messages`;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
code = IntlErrorCode.INSUFFICIENT_PATH;
|
|
136
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
137
|
-
errorMessage = `Message at \`${joinPath([
|
|
138
|
-
namespace,
|
|
139
|
-
key
|
|
140
|
-
])}\` resolved to an object, but only strings are supported. Use a \`.\` to retrieve nested messages. See https://next-intl-docs.vercel.app/docs/usage/messages#structuring-messages`;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return getFallbackFromErrorAndNotify(key, code, errorMessage);
|
|
144
|
-
}
|
|
145
|
-
// Hot path that avoids creating an `IntlMessageFormat` instance
|
|
146
|
-
const plainMessage = getPlainMessage(message, values);
|
|
147
|
-
if (plainMessage)
|
|
148
|
-
return plainMessage;
|
|
149
|
-
try {
|
|
150
|
-
messageFormat = new IntlMessageFormat(message, locale, convertFormatsToIntlMessageFormat({ ...globalFormats, ...formats }, timeZone));
|
|
151
|
-
}
|
|
152
|
-
catch (error) {
|
|
153
|
-
return getFallbackFromErrorAndNotify(key, IntlErrorCode.INVALID_MESSAGE, error.message);
|
|
154
|
-
}
|
|
155
|
-
messageFormatCache?.set(cacheKey, messageFormat);
|
|
156
|
-
}
|
|
157
|
-
try {
|
|
158
|
-
const formattedMessage = messageFormat.format(
|
|
159
|
-
// @ts-ignore `intl-messageformat` expects a different format
|
|
160
|
-
// for rich text elements since a recent minor update. This
|
|
161
|
-
// needs to be evaluated in detail, possibly also in regards
|
|
162
|
-
// to be able to format to parts.
|
|
163
|
-
prepareTranslationValues({ ...defaultTranslationValues, ...values }));
|
|
164
|
-
if (formattedMessage == null) {
|
|
165
|
-
throw new Error(process.env.NODE_ENV !== 'production'
|
|
166
|
-
? `Unable to format \`${key}\` in ${namespace ? `namespace \`${namespace}\`` : 'messages'}`
|
|
167
|
-
: undefined);
|
|
168
|
-
}
|
|
169
|
-
// Limit the function signature to return strings or React elements
|
|
170
|
-
return isValidElement(formattedMessage) ||
|
|
171
|
-
// Arrays of React elements
|
|
172
|
-
Array.isArray(formattedMessage) ||
|
|
173
|
-
typeof formattedMessage === 'string'
|
|
174
|
-
? formattedMessage
|
|
175
|
-
: String(formattedMessage);
|
|
176
|
-
}
|
|
177
|
-
catch (error) {
|
|
178
|
-
return getFallbackFromErrorAndNotify(key, IntlErrorCode.FORMATTING_ERROR, error.message);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
function translateFn(
|
|
182
|
-
/** Use a dot to indicate a level of nesting (e.g. `namespace.nestedLabel`). */
|
|
183
|
-
key,
|
|
184
|
-
/** Key value pairs for values to interpolate into the message. */
|
|
185
|
-
values,
|
|
186
|
-
/** Provide custom formats for numbers, dates and times. */
|
|
187
|
-
formats) {
|
|
188
|
-
const result = translateBaseFn(key, values, formats);
|
|
189
|
-
if (typeof result !== 'string') {
|
|
190
|
-
return getFallbackFromErrorAndNotify(key, IntlErrorCode.INVALID_MESSAGE, process.env.NODE_ENV !== 'production'
|
|
191
|
-
? `The message \`${key}\` in ${namespace ? `namespace \`${namespace}\`` : 'messages'} didn't resolve to a string. If you want to format rich text, use \`t.rich\` instead.`
|
|
192
|
-
: undefined);
|
|
193
|
-
}
|
|
194
|
-
return result;
|
|
195
|
-
}
|
|
196
|
-
translateFn.rich = translateBaseFn;
|
|
197
|
-
translateFn.raw = (
|
|
198
|
-
/** Use a dot to indicate a level of nesting (e.g. `namespace.nestedLabel`). */
|
|
199
|
-
key) => {
|
|
200
|
-
if (messagesOrError instanceof IntlError) {
|
|
201
|
-
// We have already warned about this during render
|
|
202
|
-
return getMessageFallback({
|
|
203
|
-
error: messagesOrError,
|
|
204
|
-
key,
|
|
205
|
-
namespace
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
const messages = messagesOrError;
|
|
209
|
-
try {
|
|
210
|
-
return resolvePath(messages, key, namespace);
|
|
211
|
-
}
|
|
212
|
-
catch (error) {
|
|
213
|
-
return getFallbackFromErrorAndNotify(key, IntlErrorCode.MISSING_MESSAGE, error.message);
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
return translateFn;
|
|
217
|
-
}
|
|
218
|
-
//# sourceMappingURL=createBaseTranslator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createBaseTranslator.js","sourceRoot":"","sources":["../../../src/core/createBaseTranslator.tsx"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,YAAY,EACZ,cAAc,EAIf,MAAM,OAAO,CAAC;AAIf,OAAO,SAAS,EAAE,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAGrD,OAAO,iCAAiC,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAC,yBAAyB,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAKrE,SAAS,WAAW,CAClB,QAA0C,EAC1C,GAAW,EACX,SAAkB;IAElB,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;YACnC,CAAC,CAAC,8BAA8B,SAAS,KAAK;YAC9C,CAAC,CAAC,SAAS,CACd,CAAC;KACH;IAED,IAAI,OAAO,GAAG,QAAQ,CAAC;IAEvB,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC9B,MAAM,IAAI,GAAI,OAAe,CAAC,IAAI,CAAC,CAAC;QAEpC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE;YAChC,MAAM,IAAI,KAAK,CACb,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;gBACnC,CAAC,CAAC,uBAAuB,GAAG,SACxB,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,CAAC,CAAC,CAAC,UACnC,GAAG;gBACL,CAAC,CAAC,SAAS,CACd,CAAC;SACH;QAED,OAAO,GAAG,IAAI,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO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