use-intl 2.17.4-alpha.1 → 2.17.5-alpha.1
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/dist/_virtual/use-intl.esm.js +102 -0
- package/dist/_virtual/use-intl.esm.js.map +1 -0
- package/dist/core/AbstractIntlMessages.d.ts +9 -10
- package/dist/core/DateTimeFormatOptions.d.ts +73 -75
- package/dist/core/Formats.d.ts +8 -11
- package/dist/core/IntlConfig.d.ts +54 -60
- package/dist/core/IntlError.d.ts +13 -15
- package/dist/core/NumberFormatOptions.d.ts +2 -2
- package/dist/core/TimeZone.d.ts +2 -3
- package/dist/core/TranslationValues.d.ts +5 -7
- package/dist/core/convertFormatsToIntlMessageFormat.d.ts +11 -16
- package/dist/core/createBaseTranslator.d.ts +26 -32
- package/dist/core/createFormatter.d.ts +19 -21
- package/dist/core/createIntl.d.ts +7 -15
- package/dist/core/createTranslator.d.ts +48 -57
- package/dist/core/createTranslatorImpl.d.ts +14 -25
- package/dist/core/defaults.d.ts +11 -14
- package/dist/core/index.d.ts +9 -17
- package/dist/core/resolveNamespace.d.ts +5 -7
- package/dist/core/use-intl.esm.js +33 -0
- package/dist/core/use-intl.esm.js.map +1 -0
- package/dist/core/use-intl.esm10.js +32 -0
- package/dist/core/use-intl.esm10.js.map +1 -0
- package/dist/core/use-intl.esm2.js +138 -0
- package/dist/core/use-intl.esm2.js.map +1 -0
- package/dist/core/use-intl.esm3.js +14 -0
- package/dist/core/use-intl.esm3.js.map +1 -0
- package/dist/core/use-intl.esm4.js +37 -0
- package/dist/core/use-intl.esm4.js.map +1 -0
- package/dist/core/use-intl.esm5.js +15 -0
- package/dist/core/use-intl.esm5.js.map +1 -0
- package/dist/core/use-intl.esm6.js +53 -0
- package/dist/core/use-intl.esm6.js.map +1 -0
- package/dist/core/use-intl.esm7.js +28 -0
- package/dist/core/use-intl.esm7.js.map +1 -0
- package/dist/core/use-intl.esm8.js +10 -0
- package/dist/core/use-intl.esm8.js.map +1 -0
- package/dist/core/use-intl.esm9.js +191 -0
- package/dist/core/use-intl.esm9.js.map +1 -0
- package/dist/core/utils/MessageKeys.d.ts +5 -7
- package/dist/core/utils/NamespaceKeys.d.ts +5 -7
- package/dist/core/utils/NestedKeyOf.d.ts +4 -5
- package/dist/core/utils/NestedValueOf.d.ts +2 -3
- package/dist/core/validateMessages.d.ts +3 -6
- package/dist/index.d.ts +2 -25
- package/dist/index.js +8 -2
- package/dist/react/IntlContext.d.ts +4 -13
- package/dist/react/IntlProvider.d.ts +7 -16
- package/dist/react/getInitializedConfig.d.ts +13 -24
- package/dist/react/index.d.ts +8 -21
- package/dist/react/use-intl.esm.js +16 -0
- package/dist/react/use-intl.esm.js.map +1 -0
- package/dist/react/use-intl.esm10.js +6 -0
- package/dist/react/use-intl.esm10.js.map +1 -0
- package/dist/react/use-intl.esm11.js +13 -0
- package/dist/react/use-intl.esm11.js.map +1 -0
- package/dist/react/use-intl.esm12.js +43 -0
- package/dist/react/use-intl.esm12.js.map +1 -0
- package/dist/react/use-intl.esm2.js +8 -0
- package/dist/react/use-intl.esm2.js.map +1 -0
- package/dist/react/use-intl.esm3.js +26 -0
- package/dist/react/use-intl.esm3.js.map +1 -0
- package/dist/react/use-intl.esm4.js +8 -0
- package/dist/react/use-intl.esm4.js.map +1 -0
- package/dist/react/{useNow.d.mts → use-intl.esm5.js} +42 -21
- package/dist/react/use-intl.esm5.js.map +1 -0
- package/dist/react/use-intl.esm6.js +24 -0
- package/dist/react/use-intl.esm6.js.map +1 -0
- package/dist/react/use-intl.esm7.js +30 -0
- package/dist/react/use-intl.esm7.js.map +1 -0
- package/dist/react/use-intl.esm8.js +8 -0
- package/dist/react/use-intl.esm8.js.map +1 -0
- package/dist/react/use-intl.esm9.js +29 -0
- package/dist/react/use-intl.esm9.js.map +1 -0
- package/dist/react/useFormatter.d.ts +6 -12
- package/dist/react/useIntl.d.ts +6 -12
- package/dist/react/useIntlContext.d.ts +1 -13
- package/dist/react/useLocale.d.ts +1 -3
- package/dist/react/useMessages.d.ts +1 -5
- package/dist/react/useNow.d.ts +23 -24
- package/dist/react/useTimeZone.d.ts +1 -5
- package/dist/react/useTranslations.d.ts +44 -50
- package/dist/react/useTranslationsImpl.d.ts +8 -16
- package/dist/src/core/AbstractIntlMessages.d.ts +1 -2
- package/dist/src/core/AbstractIntlMessages.js +1 -1
- package/dist/src/core/AbstractIntlMessages.js.map +1 -1
- package/dist/src/core/DateTimeFormatOptions.d.ts +2 -4
- package/dist/src/core/DateTimeFormatOptions.js +2 -1
- package/dist/src/core/DateTimeFormatOptions.js.map +1 -1
- package/dist/src/core/Formats.d.ts +3 -6
- package/dist/src/core/Formats.js +1 -1
- package/dist/src/core/Formats.js.map +1 -1
- package/dist/src/core/IntlConfig.d.ts +6 -12
- package/dist/src/core/IntlConfig.js +1 -1
- package/dist/src/core/IntlConfig.js.map +1 -1
- package/dist/src/core/IntlError.d.ts +2 -4
- package/dist/src/core/IntlError.js +22 -1
- package/dist/src/core/IntlError.js.map +1 -1
- package/dist/src/core/NumberFormatOptions.d.ts +2 -2
- package/dist/src/core/NumberFormatOptions.js +1 -1
- package/dist/src/core/NumberFormatOptions.js.map +1 -1
- package/dist/src/core/TimeZone.d.ts +1 -2
- package/dist/src/core/TimeZone.js +1 -1
- package/dist/src/core/TimeZone.js.map +1 -1
- package/dist/src/core/TranslationValues.d.ts +3 -5
- package/dist/src/core/TranslationValues.js +1 -1
- package/dist/src/core/TranslationValues.js.map +1 -1
- package/dist/src/core/convertFormatsToIntlMessageFormat.d.ts +4 -9
- package/dist/src/core/convertFormatsToIntlMessageFormat.js +30 -1
- package/dist/src/core/convertFormatsToIntlMessageFormat.js.map +1 -1
- package/dist/src/core/createBaseTranslator.d.ts +11 -17
- package/dist/src/core/createBaseTranslator.js +205 -1
- package/dist/src/core/createBaseTranslator.js.map +1 -1
- package/dist/src/core/createFormatter.d.ts +7 -9
- package/dist/src/core/createFormatter.js +128 -1
- package/dist/src/core/createFormatter.js.map +1 -1
- package/dist/src/core/createIntl.d.ts +4 -12
- package/dist/src/core/createIntl.js +10 -1
- package/dist/src/core/createIntl.js.map +1 -1
- package/dist/src/core/createTranslator.d.ts +9 -18
- package/dist/src/core/createTranslator.js +23 -1
- package/dist/src/core/createTranslator.js.map +1 -1
- package/dist/src/core/createTranslatorImpl.d.ts +9 -20
- package/dist/src/core/createTranslatorImpl.js +42 -1
- package/dist/src/core/createTranslatorImpl.js.map +1 -1
- package/dist/src/core/defaults.d.ts +3 -6
- package/dist/src/core/defaults.js +10 -1
- package/dist/src/core/defaults.js.map +1 -1
- package/dist/src/core/index.d.ts +9 -17
- package/dist/src/core/index.js +5 -1
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/core/resolveNamespace.d.ts +1 -3
- package/dist/src/core/resolveNamespace.js +9 -1
- package/dist/src/core/resolveNamespace.js.map +1 -1
- package/dist/src/core/utils/MessageKeys.d.ts +2 -4
- package/dist/src/core/utils/MessageKeys.js +1 -1
- package/dist/src/core/utils/MessageKeys.js.map +1 -1
- package/dist/src/core/utils/NamespaceKeys.d.ts +2 -4
- package/dist/src/core/utils/NamespaceKeys.js +1 -1
- package/dist/src/core/utils/NamespaceKeys.js.map +1 -1
- package/dist/src/core/utils/NestedKeyOf.d.ts +1 -2
- package/dist/src/core/utils/NestedKeyOf.js +1 -1
- package/dist/src/core/utils/NestedKeyOf.js.map +1 -1
- package/dist/src/core/utils/NestedValueOf.d.ts +1 -2
- package/dist/src/core/utils/NestedValueOf.js +1 -1
- package/dist/src/core/utils/NestedValueOf.js.map +1 -1
- package/dist/src/core/validateMessages.d.ts +3 -6
- package/dist/src/core/validateMessages.js +25 -3
- package/dist/src/core/validateMessages.js.map +1 -1
- package/dist/src/index.d.ts +2 -25
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/react/IntlContext.d.ts +4 -13
- package/dist/src/react/IntlContext.js +3 -1
- package/dist/src/react/IntlContext.js.map +1 -1
- package/dist/src/react/IntlProvider.d.ts +3 -12
- package/dist/src/react/IntlProvider.js +6 -1
- package/dist/src/react/IntlProvider.js.map +1 -1
- package/dist/src/react/getInitializedConfig.d.ts +5 -16
- package/dist/src/react/getInitializedConfig.js +20 -1
- package/dist/src/react/getInitializedConfig.js.map +1 -1
- package/dist/src/react/index.d.ts +8 -21
- package/dist/src/react/index.js +9 -1
- package/dist/src/react/index.js.map +1 -1
- package/dist/src/react/useFormatter.d.ts +3 -9
- package/dist/src/react/useFormatter.js +13 -1
- package/dist/src/react/useFormatter.js.map +1 -1
- package/dist/src/react/useIntl.d.ts +3 -9
- package/dist/src/react/useIntl.js +19 -1
- package/dist/src/react/useIntl.js.map +1 -1
- package/dist/src/react/useIntlContext.d.ts +1 -13
- package/dist/src/react/useIntlContext.js +11 -1
- package/dist/src/react/useIntlContext.js.map +1 -1
- package/dist/src/react/useLocale.d.ts +1 -3
- package/dist/src/react/useLocale.js +4 -1
- package/dist/src/react/useLocale.js.map +1 -1
- package/dist/src/react/useMessages.d.ts +1 -5
- package/dist/src/react/useMessages.js +4 -1
- package/dist/src/react/useMessages.js.map +1 -1
- package/dist/src/react/useNow.d.ts +2 -3
- package/dist/src/react/useNow.js +39 -1
- package/dist/src/react/useNow.js.map +1 -1
- package/dist/src/react/useTimeZone.d.ts +1 -5
- package/dist/src/react/useTimeZone.js +4 -1
- package/dist/src/react/useTimeZone.js.map +1 -1
- package/dist/src/react/useTranslations.d.ts +7 -13
- package/dist/src/react/useTranslations.js +20 -1
- package/dist/src/react/useTranslations.js.map +1 -1
- package/dist/src/react/useTranslationsImpl.d.ts +6 -14
- package/dist/src/react/useTranslationsImpl.js +34 -1
- package/dist/src/react/useTranslationsImpl.js.map +1 -1
- package/dist/use-intl.cjs.development.js +821 -0
- package/dist/use-intl.cjs.development.js.map +1 -0
- package/dist/use-intl.cjs.production.min.js +2 -0
- package/dist/use-intl.cjs.production.min.js.map +1 -0
- package/dist/use-intl.esm.js +13 -0
- package/dist/use-intl.esm.js.map +1 -0
- package/package.json +20 -5
- package/dist/core/AbstractIntlMessages.d.mts +0 -10
- package/dist/core/AbstractIntlMessages.js +0 -2
- package/dist/core/AbstractIntlMessages.js.map +0 -1
- package/dist/core/AbstractIntlMessages.mjs +0 -1
- package/dist/core/AbstractIntlMessages.mjs.map +0 -1
- package/dist/core/DateTimeFormatOptions.d.mts +0 -75
- package/dist/core/DateTimeFormatOptions.js +0 -2
- package/dist/core/DateTimeFormatOptions.js.map +0 -1
- package/dist/core/DateTimeFormatOptions.mjs +0 -1
- package/dist/core/DateTimeFormatOptions.mjs.map +0 -1
- package/dist/core/Formats.d.mts +0 -11
- package/dist/core/Formats.js +0 -2
- package/dist/core/Formats.js.map +0 -1
- package/dist/core/Formats.mjs +0 -1
- package/dist/core/Formats.mjs.map +0 -1
- package/dist/core/IntlConfig.d.mts +0 -60
- package/dist/core/IntlConfig.js +0 -2
- package/dist/core/IntlConfig.js.map +0 -1
- package/dist/core/IntlConfig.mjs +0 -1
- package/dist/core/IntlConfig.mjs.map +0 -1
- package/dist/core/IntlError.d.mts +0 -15
- package/dist/core/IntlError.js +0 -2
- package/dist/core/IntlError.js.map +0 -1
- package/dist/core/IntlError.mjs +0 -2
- package/dist/core/IntlError.mjs.map +0 -1
- package/dist/core/NumberFormatOptions.d.mts +0 -2
- package/dist/core/NumberFormatOptions.js +0 -2
- package/dist/core/NumberFormatOptions.js.map +0 -1
- package/dist/core/NumberFormatOptions.mjs +0 -2
- package/dist/core/NumberFormatOptions.mjs.map +0 -1
- package/dist/core/TimeZone.d.mts +0 -3
- package/dist/core/TimeZone.js +0 -2
- package/dist/core/TimeZone.js.map +0 -1
- package/dist/core/TimeZone.mjs +0 -1
- package/dist/core/TimeZone.mjs.map +0 -1
- package/dist/core/TranslationValues.d.mts +0 -7
- package/dist/core/TranslationValues.js +0 -2
- package/dist/core/TranslationValues.js.map +0 -1
- package/dist/core/TranslationValues.mjs +0 -1
- package/dist/core/TranslationValues.mjs.map +0 -1
- package/dist/core/convertFormatsToIntlMessageFormat.d.mts +0 -16
- package/dist/core/convertFormatsToIntlMessageFormat.js +0 -2
- package/dist/core/convertFormatsToIntlMessageFormat.js.map +0 -1
- package/dist/core/convertFormatsToIntlMessageFormat.mjs +0 -2
- package/dist/core/convertFormatsToIntlMessageFormat.mjs.map +0 -1
- package/dist/core/createBaseTranslator.d.mts +0 -32
- package/dist/core/createBaseTranslator.js +0 -2
- package/dist/core/createBaseTranslator.js.map +0 -1
- package/dist/core/createBaseTranslator.mjs +0 -2
- package/dist/core/createBaseTranslator.mjs.map +0 -1
- package/dist/core/createFormatter.d.mts +0 -21
- package/dist/core/createFormatter.js +0 -2
- package/dist/core/createFormatter.js.map +0 -1
- package/dist/core/createFormatter.mjs +0 -2
- package/dist/core/createFormatter.mjs.map +0 -1
- package/dist/core/createIntl.d.mts +0 -15
- package/dist/core/createIntl.js +0 -2
- package/dist/core/createIntl.js.map +0 -1
- package/dist/core/createIntl.mjs +0 -2
- package/dist/core/createIntl.mjs.map +0 -1
- package/dist/core/createTranslator.d.mts +0 -57
- package/dist/core/createTranslator.js +0 -2
- package/dist/core/createTranslator.js.map +0 -1
- package/dist/core/createTranslator.mjs +0 -2
- package/dist/core/createTranslator.mjs.map +0 -1
- package/dist/core/createTranslatorImpl.d.mts +0 -25
- package/dist/core/createTranslatorImpl.js +0 -2
- package/dist/core/createTranslatorImpl.js.map +0 -1
- package/dist/core/createTranslatorImpl.mjs +0 -2
- package/dist/core/createTranslatorImpl.mjs.map +0 -1
- package/dist/core/defaults.d.mts +0 -14
- package/dist/core/defaults.js +0 -2
- package/dist/core/defaults.js.map +0 -1
- package/dist/core/defaults.mjs +0 -2
- package/dist/core/defaults.mjs.map +0 -1
- package/dist/core/index.d.mts +0 -17
- package/dist/core/index.js +0 -2
- package/dist/core/index.js.map +0 -1
- package/dist/core/index.mjs +0 -2
- package/dist/core/index.mjs.map +0 -1
- package/dist/core/resolveNamespace.d.mts +0 -7
- package/dist/core/resolveNamespace.js +0 -2
- package/dist/core/resolveNamespace.js.map +0 -1
- package/dist/core/resolveNamespace.mjs +0 -2
- package/dist/core/resolveNamespace.mjs.map +0 -1
- package/dist/core/utils/MessageKeys.d.mts +0 -7
- package/dist/core/utils/MessageKeys.js +0 -2
- package/dist/core/utils/MessageKeys.js.map +0 -1
- package/dist/core/utils/MessageKeys.mjs +0 -1
- package/dist/core/utils/MessageKeys.mjs.map +0 -1
- package/dist/core/utils/NamespaceKeys.d.mts +0 -7
- package/dist/core/utils/NamespaceKeys.js +0 -2
- package/dist/core/utils/NamespaceKeys.js.map +0 -1
- package/dist/core/utils/NamespaceKeys.mjs +0 -1
- package/dist/core/utils/NamespaceKeys.mjs.map +0 -1
- package/dist/core/utils/NestedKeyOf.d.mts +0 -5
- package/dist/core/utils/NestedKeyOf.js +0 -2
- package/dist/core/utils/NestedKeyOf.js.map +0 -1
- package/dist/core/utils/NestedKeyOf.mjs +0 -1
- package/dist/core/utils/NestedKeyOf.mjs.map +0 -1
- package/dist/core/utils/NestedValueOf.d.mts +0 -3
- package/dist/core/utils/NestedValueOf.js +0 -2
- package/dist/core/utils/NestedValueOf.js.map +0 -1
- package/dist/core/utils/NestedValueOf.mjs +0 -1
- package/dist/core/utils/NestedValueOf.mjs.map +0 -1
- package/dist/core/validateMessages.d.mts +0 -6
- package/dist/core/validateMessages.js +0 -34
- package/dist/core/validateMessages.js.map +0 -1
- package/dist/core/validateMessages.mjs +0 -34
- package/dist/core/validateMessages.mjs.map +0 -1
- package/dist/index.d.mts +0 -25
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -2
- package/dist/index.mjs.map +0 -1
- package/dist/react/IntlContext.d.mts +0 -13
- package/dist/react/IntlContext.js +0 -2
- package/dist/react/IntlContext.js.map +0 -1
- package/dist/react/IntlContext.mjs +0 -2
- package/dist/react/IntlContext.mjs.map +0 -1
- package/dist/react/IntlProvider.d.mts +0 -16
- package/dist/react/IntlProvider.js +0 -2
- package/dist/react/IntlProvider.js.map +0 -1
- package/dist/react/IntlProvider.mjs +0 -2
- package/dist/react/IntlProvider.mjs.map +0 -1
- package/dist/react/getInitializedConfig.d.mts +0 -24
- package/dist/react/getInitializedConfig.js +0 -2
- package/dist/react/getInitializedConfig.js.map +0 -1
- package/dist/react/getInitializedConfig.mjs +0 -2
- package/dist/react/getInitializedConfig.mjs.map +0 -1
- package/dist/react/index.d.mts +0 -21
- package/dist/react/index.js +0 -2
- package/dist/react/index.js.map +0 -1
- package/dist/react/index.mjs +0 -2
- package/dist/react/index.mjs.map +0 -1
- package/dist/react/useFormatter.d.mts +0 -12
- package/dist/react/useFormatter.js +0 -2
- package/dist/react/useFormatter.js.map +0 -1
- package/dist/react/useFormatter.mjs +0 -2
- package/dist/react/useFormatter.mjs.map +0 -1
- package/dist/react/useIntl.d.mts +0 -12
- package/dist/react/useIntl.js +0 -2
- package/dist/react/useIntl.js.map +0 -1
- package/dist/react/useIntl.mjs +0 -2
- package/dist/react/useIntl.mjs.map +0 -1
- package/dist/react/useIntlContext.d.mts +0 -13
- package/dist/react/useIntlContext.js +0 -2
- package/dist/react/useIntlContext.js.map +0 -1
- package/dist/react/useIntlContext.mjs +0 -2
- package/dist/react/useIntlContext.mjs.map +0 -1
- package/dist/react/useLocale.d.mts +0 -3
- package/dist/react/useLocale.js +0 -2
- package/dist/react/useLocale.js.map +0 -1
- package/dist/react/useLocale.mjs +0 -2
- package/dist/react/useLocale.mjs.map +0 -1
- package/dist/react/useMessages.d.mts +0 -5
- package/dist/react/useMessages.js +0 -2
- package/dist/react/useMessages.js.map +0 -1
- package/dist/react/useMessages.mjs +0 -2
- package/dist/react/useMessages.mjs.map +0 -1
- package/dist/react/useNow.js +0 -2
- package/dist/react/useNow.js.map +0 -1
- package/dist/react/useNow.mjs +0 -2
- package/dist/react/useNow.mjs.map +0 -1
- package/dist/react/useTimeZone.d.mts +0 -5
- package/dist/react/useTimeZone.js +0 -2
- package/dist/react/useTimeZone.js.map +0 -1
- package/dist/react/useTimeZone.mjs +0 -2
- package/dist/react/useTimeZone.mjs.map +0 -1
- package/dist/react/useTranslations.d.mts +0 -50
- package/dist/react/useTranslations.js +0 -2
- package/dist/react/useTranslations.js.map +0 -1
- package/dist/react/useTranslations.mjs +0 -2
- package/dist/react/useTranslations.mjs.map +0 -1
- package/dist/react/useTranslationsImpl.d.mts +0 -16
- package/dist/react/useTranslationsImpl.js +0 -2
- package/dist/react/useTranslationsImpl.js.map +0 -1
- package/dist/react/useTranslationsImpl.mjs +0 -2
- package/dist/react/useTranslationsImpl.mjs.map +0 -1
- package/dist/src/core/AbstractIntlMessages.d.mts +0 -10
- package/dist/src/core/AbstractIntlMessages.mjs +0 -1
- package/dist/src/core/AbstractIntlMessages.mjs.map +0 -1
- package/dist/src/core/DateTimeFormatOptions.d.mts +0 -75
- package/dist/src/core/DateTimeFormatOptions.mjs +0 -1
- package/dist/src/core/DateTimeFormatOptions.mjs.map +0 -1
- package/dist/src/core/Formats.d.mts +0 -11
- package/dist/src/core/Formats.mjs +0 -1
- package/dist/src/core/Formats.mjs.map +0 -1
- package/dist/src/core/IntlConfig.d.mts +0 -60
- package/dist/src/core/IntlConfig.mjs +0 -1
- package/dist/src/core/IntlConfig.mjs.map +0 -1
- package/dist/src/core/IntlError.d.mts +0 -15
- package/dist/src/core/IntlError.mjs +0 -2
- package/dist/src/core/IntlError.mjs.map +0 -1
- package/dist/src/core/NumberFormatOptions.d.mts +0 -2
- package/dist/src/core/NumberFormatOptions.mjs +0 -2
- package/dist/src/core/NumberFormatOptions.mjs.map +0 -1
- package/dist/src/core/TimeZone.d.mts +0 -3
- package/dist/src/core/TimeZone.mjs +0 -1
- package/dist/src/core/TimeZone.mjs.map +0 -1
- package/dist/src/core/TranslationValues.d.mts +0 -7
- package/dist/src/core/TranslationValues.mjs +0 -1
- package/dist/src/core/TranslationValues.mjs.map +0 -1
- package/dist/src/core/convertFormatsToIntlMessageFormat.d.mts +0 -16
- package/dist/src/core/convertFormatsToIntlMessageFormat.mjs +0 -2
- package/dist/src/core/convertFormatsToIntlMessageFormat.mjs.map +0 -1
- package/dist/src/core/createBaseTranslator.d.mts +0 -32
- package/dist/src/core/createBaseTranslator.mjs +0 -2
- package/dist/src/core/createBaseTranslator.mjs.map +0 -1
- package/dist/src/core/createFormatter.d.mts +0 -21
- package/dist/src/core/createFormatter.mjs +0 -2
- package/dist/src/core/createFormatter.mjs.map +0 -1
- package/dist/src/core/createIntl.d.mts +0 -15
- package/dist/src/core/createIntl.mjs +0 -2
- package/dist/src/core/createIntl.mjs.map +0 -1
- package/dist/src/core/createTranslator.d.mts +0 -57
- package/dist/src/core/createTranslator.mjs +0 -2
- package/dist/src/core/createTranslator.mjs.map +0 -1
- package/dist/src/core/createTranslatorImpl.d.mts +0 -25
- package/dist/src/core/createTranslatorImpl.mjs +0 -2
- package/dist/src/core/createTranslatorImpl.mjs.map +0 -1
- package/dist/src/core/defaults.d.mts +0 -14
- package/dist/src/core/defaults.mjs +0 -2
- package/dist/src/core/defaults.mjs.map +0 -1
- package/dist/src/core/index.d.mts +0 -17
- package/dist/src/core/index.mjs +0 -2
- package/dist/src/core/index.mjs.map +0 -1
- package/dist/src/core/resolveNamespace.d.mts +0 -7
- package/dist/src/core/resolveNamespace.mjs +0 -2
- package/dist/src/core/resolveNamespace.mjs.map +0 -1
- package/dist/src/core/utils/MessageKeys.d.mts +0 -7
- package/dist/src/core/utils/MessageKeys.mjs +0 -1
- package/dist/src/core/utils/MessageKeys.mjs.map +0 -1
- package/dist/src/core/utils/NamespaceKeys.d.mts +0 -7
- package/dist/src/core/utils/NamespaceKeys.mjs +0 -1
- package/dist/src/core/utils/NamespaceKeys.mjs.map +0 -1
- package/dist/src/core/utils/NestedKeyOf.d.mts +0 -5
- package/dist/src/core/utils/NestedKeyOf.mjs +0 -1
- package/dist/src/core/utils/NestedKeyOf.mjs.map +0 -1
- package/dist/src/core/utils/NestedValueOf.d.mts +0 -3
- package/dist/src/core/utils/NestedValueOf.mjs +0 -1
- package/dist/src/core/utils/NestedValueOf.mjs.map +0 -1
- package/dist/src/core/validateMessages.d.mts +0 -6
- package/dist/src/core/validateMessages.mjs +0 -34
- package/dist/src/core/validateMessages.mjs.map +0 -1
- package/dist/src/index.d.mts +0 -25
- package/dist/src/index.mjs +0 -2
- package/dist/src/index.mjs.map +0 -1
- package/dist/src/react/IntlContext.d.mts +0 -13
- package/dist/src/react/IntlContext.mjs +0 -2
- package/dist/src/react/IntlContext.mjs.map +0 -1
- package/dist/src/react/IntlProvider.d.mts +0 -16
- package/dist/src/react/IntlProvider.mjs +0 -2
- package/dist/src/react/IntlProvider.mjs.map +0 -1
- package/dist/src/react/getInitializedConfig.d.mts +0 -24
- package/dist/src/react/getInitializedConfig.mjs +0 -2
- package/dist/src/react/getInitializedConfig.mjs.map +0 -1
- package/dist/src/react/index.d.mts +0 -21
- package/dist/src/react/index.mjs +0 -2
- package/dist/src/react/index.mjs.map +0 -1
- package/dist/src/react/useFormatter.d.mts +0 -12
- package/dist/src/react/useFormatter.mjs +0 -2
- package/dist/src/react/useFormatter.mjs.map +0 -1
- package/dist/src/react/useIntl.d.mts +0 -12
- package/dist/src/react/useIntl.mjs +0 -2
- package/dist/src/react/useIntl.mjs.map +0 -1
- package/dist/src/react/useIntlContext.d.mts +0 -13
- package/dist/src/react/useIntlContext.mjs +0 -2
- package/dist/src/react/useIntlContext.mjs.map +0 -1
- package/dist/src/react/useLocale.d.mts +0 -3
- package/dist/src/react/useLocale.mjs +0 -2
- package/dist/src/react/useLocale.mjs.map +0 -1
- package/dist/src/react/useMessages.d.mts +0 -5
- package/dist/src/react/useMessages.mjs +0 -2
- package/dist/src/react/useMessages.mjs.map +0 -1
- package/dist/src/react/useNow.d.mts +0 -24
- package/dist/src/react/useNow.mjs +0 -2
- package/dist/src/react/useNow.mjs.map +0 -1
- package/dist/src/react/useTimeZone.d.mts +0 -5
- package/dist/src/react/useTimeZone.mjs +0 -2
- package/dist/src/react/useTimeZone.mjs.map +0 -1
- package/dist/src/react/useTranslations.d.mts +0 -50
- package/dist/src/react/useTranslations.mjs +0 -2
- package/dist/src/react/useTranslations.mjs.map +0 -1
- package/dist/src/react/useTranslationsImpl.d.mts +0 -16
- package/dist/src/react/useTranslationsImpl.mjs +0 -2
- package/dist/src/react/useTranslationsImpl.mjs.map +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
type TimeZone = 'Africa/Abidjan' | 'Africa/Accra' | 'Africa/Addis_Ababa' | 'Africa/Algiers' | 'Africa/Asmara' | 'Africa/Bamako' | 'Africa/Bangui' | 'Africa/Banjul' | 'Africa/Bissau' | 'Africa/Blantyre' | 'Africa/Brazzaville' | 'Africa/Bujumbura' | 'Africa/Cairo' | 'Africa/Casablanca' | 'Africa/Ceuta' | 'Africa/Conakry' | 'Africa/Dakar' | 'Africa/Dar_es_Salaam' | 'Africa/Djibouti' | 'Africa/Douala' | 'Africa/El_Aaiun' | 'Africa/Freetown' | 'Africa/Gaborone' | 'Africa/Harare' | 'Africa/Johannesburg' | 'Africa/Juba' | 'Africa/Kampala' | 'Africa/Khartoum' | 'Africa/Kigali' | 'Africa/Kinshasa' | 'Africa/Lagos' | 'Africa/Libreville' | 'Africa/Lome' | 'Africa/Luanda' | 'Africa/Lubumbashi' | 'Africa/Lusaka' | 'Africa/Malabo' | 'Africa/Maputo' | 'Africa/Maseru' | 'Africa/Mbabane' | 'Africa/Mogadishu' | 'Africa/Monrovia' | 'Africa/Nairobi' | 'Africa/Ndjamena' | 'Africa/Niamey' | 'Africa/Nouakchott' | 'Africa/Ouagadougou' | 'Africa/Porto-Novo' | 'Africa/Sao_Tome' | 'Africa/Tripoli' | 'Africa/Tunis' | 'Africa/Windhoek' | 'America/Adak' | 'America/Anchorage' | 'America/Anguilla' | 'America/Antigua' | 'America/Araguaina' | 'America/Argentina/Buenos_Aires' | 'America/Argentina/Catamarca' | 'America/Argentina/Cordoba' | 'America/Argentina/Jujuy' | 'America/Argentina/La_Rioja' | 'America/Argentina/Mendoza' | 'America/Argentina/Rio_Gallegos' | 'America/Argentina/Salta' | 'America/Argentina/San_Juan' | 'America/Argentina/San_Luis' | 'America/Argentina/Tucuman' | 'America/Argentina/Ushuaia' | 'America/Aruba' | 'America/Asuncion' | 'America/Atikokan' | 'America/Bahia' | 'America/Bahia_Banderas' | 'America/Barbados' | 'America/Belem' | 'America/Belize' | 'America/Blanc-Sablon' | 'America/Boa_Vista' | 'America/Bogota' | 'America/Boise' | 'America/Cambridge_Bay' | 'America/Campo_Grande' | 'America/Cancun' | 'America/Caracas' | 'America/Cayenne' | 'America/Cayman' | 'America/Chicago' | 'America/Chihuahua' | 'America/Costa_Rica' | 'America/Creston' | 'America/Cuiaba' | 'America/Curacao' | 'America/Danmarkshavn' | 'America/Dawson' | 'America/Dawson_Creek' | 'America/Denver' | 'America/Detroit' | 'America/Dominica' | 'America/Edmonton' | 'America/Eirunepe' | 'America/El_Salvador' | 'America/Fort_Nelson' | 'America/Fortaleza' | 'America/Glace_Bay' | 'America/Godthab' | 'America/Goose_Bay' | 'America/Grand_Turk' | 'America/Grenada' | 'America/Guadeloupe' | 'America/Guatemala' | 'America/Guayaquil' | 'America/Guyana' | 'America/Halifax' | 'America/Havana' | 'America/Hermosillo' | 'America/Indiana/Indianapolis' | 'America/Indiana/Knox' | 'America/Indiana/Marengo' | 'America/Indiana/Petersburg' | 'America/Indiana/Tell_City' | 'America/Indiana/Vevay' | 'America/Indiana/Vincennes' | 'America/Indiana/Winamac' | 'America/Inuvik' | 'America/Iqaluit' | 'America/Jamaica' | 'America/Juneau' | 'America/Kentucky/Louisville' | 'America/Kentucky/Monticello' | 'America/Kralendijk' | 'America/La_Paz' | 'America/Lima' | 'America/Los_Angeles' | 'America/Lower_Princes' | 'America/Maceio' | 'America/Managua' | 'America/Manaus' | 'America/Marigot' | 'America/Martinique' | 'America/Matamoros' | 'America/Mazatlan' | 'America/Menominee' | 'America/Merida' | 'America/Metlakatla' | 'America/Mexico_City' | 'America/Miquelon' | 'America/Moncton' | 'America/Monterrey' | 'America/Montevideo' | 'America/Montserrat' | 'America/Nassau' | 'America/New_York' | 'America/Nipigon' | 'America/Nome' | 'America/Noronha' | 'America/North_Dakota/Beulah' | 'America/North_Dakota/Center' | 'America/North_Dakota/New_Salem' | 'America/Ojinaga' | 'America/Panama' | 'America/Pangnirtung' | 'America/Paramaribo' | 'America/Phoenix' | 'America/Port-au-Prince' | 'America/Port_of_Spain' | 'America/Porto_Velho' | 'America/Puerto_Rico' | 'America/Punta_Arenas' | 'America/Rainy_River' | 'America/Rankin_Inlet' | 'America/Recife' | 'America/Regina' | 'America/Resolute' | 'America/Rio_Branco' | 'America/Santarem' | 'America/Santiago' | 'America/Santo_Domingo' | 'America/Sao_Paulo' | 'America/Scoresbysund' | 'America/Sitka' | 'America/St_Barthelemy' | 'America/St_Johns' | 'America/St_Kitts' | 'America/St_Lucia' | 'America/St_Thomas' | 'America/St_Vincent' | 'America/Swift_Current' | 'America/Tegucigalpa' | 'America/Thule' | 'America/Thunder_Bay' | 'America/Tijuana' | 'America/Toronto' | 'America/Tortola' | 'America/Vancouver' | 'America/Whitehorse' | 'America/Winnipeg' | 'America/Yakutat' | 'America/Yellowknife' | 'Antarctica/Casey' | 'Antarctica/Davis' | 'Antarctica/DumontDUrville' | 'Antarctica/Macquarie' | 'Antarctica/Mawson' | 'Antarctica/Palmer' | 'Antarctica/Rothera' | 'Antarctica/Syowa' | 'Antarctica/Troll' | 'Antarctica/Vostok' | 'Arctic/Longyearbyen' | 'Asia/Almaty' | 'Asia/Amman' | 'Asia/Anadyr' | 'Asia/Aqtau' | 'Asia/Aqtobe' | 'Asia/Ashgabat' | 'Asia/Atyrau' | 'Asia/Baghdad' | 'Asia/Baku' | 'Asia/Bangkok' | 'Asia/Barnaul' | 'Asia/Beirut' | 'Asia/Bishkek' | 'Asia/Brunei' | 'Asia/Chita' | 'Asia/Choibalsan' | 'Asia/Colombo' | 'Asia/Damascus' | 'Asia/Dhaka' | 'Asia/Dili' | 'Asia/Dubai' | 'Asia/Dushanbe' | 'Asia/Famagusta' | 'Asia/Gaza' | 'Asia/Hebron' | 'Asia/Ho_Chi_Minh' | 'Asia/Hong_Kong' | 'Asia/Hovd' | 'Asia/Irkutsk' | 'Asia/Jakarta' | 'Asia/Jayapura' | 'Asia/Jerusalem' | 'Asia/Kabul' | 'Asia/Kamchatka' | 'Asia/Karachi' | 'Asia/Kathmandu' | 'Asia/Khandyga' | 'Asia/Kolkata' | 'Asia/Krasnoyarsk' | 'Asia/Kuala_Lumpur' | 'Asia/Kuching' | 'Asia/Macau' | 'Asia/Magadan' | 'Asia/Makassar' | 'Asia/Manila' | 'Asia/Nicosia' | 'Asia/Novokuznetsk' | 'Asia/Novosibirsk' | 'Asia/Omsk' | 'Asia/Oral' | 'Asia/Phnom_Penh' | 'Asia/Pontianak' | 'Asia/Pyongyang' | 'Asia/Qatar' | 'Asia/Qostanay' | 'Asia/Qyzylorda' | 'Asia/Riyadh' | 'Asia/Sakhalin' | 'Asia/Samarkand' | 'Asia/Seoul' | 'Asia/Shanghai' | 'Asia/Singapore' | 'Asia/Srednekolymsk' | 'Asia/Taipei' | 'Asia/Tashkent' | 'Asia/Tbilisi' | 'Asia/Tehran' | 'Asia/Thimphu' | 'Asia/Tokyo' | 'Asia/Tomsk' | 'Asia/Ulaanbaatar' | 'Asia/Urumqi' | 'Asia/Ust-Nera' | 'Asia/Vladivostok' | 'Asia/Yakutsk' | 'Asia/Yangon' | 'Asia/Yekaterinburg' | 'Asia/Yerevan' | 'Atlantic/Azores' | 'Atlantic/Bermuda' | 'Atlantic/Canary' | 'Atlantic/Cape_Verde' | 'Atlantic/Faroe' | 'Atlantic/Madeira' | 'Atlantic/Reykjavik' | 'Atlantic/South_Georgia' | 'Atlantic/St_Helena' | 'Atlantic/Stanley' | 'Australia/Adelaide' | 'Australia/Brisbane' | 'Australia/Broken_Hill' | 'Australia/Currie' | 'Australia/Darwin' | 'Australia/Eucla' | 'Australia/Hobart' | 'Australia/Lindeman' | 'Australia/Lord_Howe' | 'Australia/Melbourne' | 'Australia/Perth' | 'Australia/Sydney' | 'Europe/Amsterdam' | 'Europe/Andorra' | 'Europe/Astrakhan' | 'Europe/Athens' | 'Europe/Belgrade' | 'Europe/Berlin' | 'Europe/Bratislava' | 'Europe/Brussels' | 'Europe/Bucharest' | 'Europe/Budapest' | 'Europe/Busingen' | 'Europe/Chisinau' | 'Europe/Copenhagen' | 'Europe/Dublin' | 'Europe/Gibraltar' | 'Europe/Guernsey' | 'Europe/Helsinki' | 'Europe/Isle_of_Man' | 'Europe/Istanbul' | 'Europe/Jersey' | 'Europe/Kaliningrad' | 'Europe/Kiev' | 'Europe/Kirov' | 'Europe/Lisbon' | 'Europe/Ljubljana' | 'Europe/London' | 'Europe/Luxembourg' | 'Europe/Madrid' | 'Europe/Malta' | 'Europe/Mariehamn' | 'Europe/Minsk' | 'Europe/Monaco' | 'Europe/Moscow' | 'Europe/Oslo' | 'Europe/Paris' | 'Europe/Podgorica' | 'Europe/Prague' | 'Europe/Riga' | 'Europe/Rome' | 'Europe/Samara' | 'Europe/San_Marino' | 'Europe/Sarajevo' | 'Europe/Saratov' | 'Europe/Simferopol' | 'Europe/Skopje' | 'Europe/Sofia' | 'Europe/Stockholm' | 'Europe/Tallinn' | 'Europe/Tirane' | 'Europe/Ulyanovsk' | 'Europe/Uzhgorod' | 'Europe/Vaduz' | 'Europe/Vatican' | 'Europe/Vienna' | 'Europe/Vilnius' | 'Europe/Volgograd' | 'Europe/Warsaw' | 'Europe/Zagreb' | 'Europe/Zaporozhye' | 'Europe/Zurich' | 'Indian/Antananarivo' | 'Indian/Chagos' | 'Indian/Christmas' | 'Indian/Cocos' | 'Indian/Comoro' | 'Indian/Kerguelen' | 'Indian/Mahe' | 'Indian/Maldives' | 'Indian/Mauritius' | 'Indian/Mayotte' | 'Indian/Reunion' | 'Pacific/Apia' | 'Pacific/Auckland' | 'Pacific/Bougainville' | 'Pacific/Chatham' | 'Pacific/Chuuk' | 'Pacific/Easter' | 'Pacific/Efate' | 'Pacific/Enderbury' | 'Pacific/Fakaofo' | 'Pacific/Fiji' | 'Pacific/Funafuti' | 'Pacific/Galapagos' | 'Pacific/Gambier' | 'Pacific/Guadalcanal' | 'Pacific/Guam' | 'Pacific/Honolulu' | 'Pacific/Kiritimati' | 'Pacific/Kosrae' | 'Pacific/Kwajalein' | 'Pacific/Majuro' | 'Pacific/Marquesas' | 'Pacific/Nauru' | 'Pacific/Niue' | 'Pacific/Norfolk' | 'Pacific/Noumea' | 'Pacific/Pago_Pago' | 'Pacific/Palau' | 'Pacific/Pitcairn' | 'Pacific/Pohnpei' | 'Pacific/Port_Moresby' | 'Pacific/Rarotonga' | 'Pacific/Tahiti' | 'Pacific/Tarawa' | 'Pacific/Tongatapu' | 'Pacific/Wake' | 'Pacific/Wallis' | 'UTC' | 'W-SU' | 'WET' | 'Zulu' | (string & {});
|
|
2
|
-
|
|
3
|
-
export { TimeZone as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=TimeZone.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
type TranslationValue = string | number | boolean | Date | null | undefined;
|
|
4
|
-
type TranslationValues = Record<string, TranslationValue>;
|
|
5
|
-
type RichTranslationValues = Record<string, TranslationValue | ((chunks: ReactNode) => ReactNode)>;
|
|
6
|
-
|
|
7
|
-
export { RichTranslationValues, TranslationValue, TranslationValues as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=TranslationValues.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Formats as Formats$1 } from 'intl-messageformat';
|
|
2
|
-
import Formats from './Formats.mjs';
|
|
3
|
-
import TimeZone from './TimeZone.mjs';
|
|
4
|
-
import './DateTimeFormatOptions.mjs';
|
|
5
|
-
import '@formatjs/ecma402-abstract/types/number';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* `intl-messageformat` uses separate keys for `date` and `time`, but there's
|
|
9
|
-
* only one native API: `Intl.DateTimeFormat`. Additionally you might want to
|
|
10
|
-
* include both a time and a date in a value, therefore the separation doesn't
|
|
11
|
-
* seem so useful. We offer a single `dateTime` namespace instead, but we have
|
|
12
|
-
* to convert the format before `intl-messageformat` can be used.
|
|
13
|
-
*/
|
|
14
|
-
declare function convertFormatsToIntlMessageFormat(formats: Partial<Formats>, timeZone?: TimeZone): Partial<Formats$1>;
|
|
15
|
-
|
|
16
|
-
export { convertFormatsToIntlMessageFormat as default };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function i(t,r){return t&&Object.keys(t).reduce((e,o)=>(e[o]={timeZone:r,...t[o]},e),{})}function m(t,r){const e=r?{...t,dateTime:i(t.dateTime,r)}:t;return{...e,date:e?.dateTime,time:e?.dateTime}}export{m as default};
|
|
2
|
-
//# sourceMappingURL=convertFormatsToIntlMessageFormat.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/convertFormatsToIntlMessageFormat.tsx"],"sourcesContent":["import {Formats as IntlFormats} from 'intl-messageformat';\nimport DateTimeFormatOptions from './DateTimeFormatOptions';\nimport Formats from './Formats';\nimport TimeZone from './TimeZone';\n\nfunction setTimeZoneInFormats(\n formats: Record<string, DateTimeFormatOptions> | undefined,\n timeZone: TimeZone\n) {\n if (!formats) return formats;\n\n // The only way to set a time zone with `intl-messageformat` is to merge it into the formats\n // https://github.com/formatjs/formatjs/blob/8256c5271505cf2606e48e3c97ecdd16ede4f1b5/packages/intl/src/message.ts#L15\n return Object.keys(formats).reduce(\n (acc: Record<string, DateTimeFormatOptions>, key) => {\n acc[key] = {\n timeZone,\n ...formats[key]\n };\n return acc;\n },\n {}\n );\n}\n\n/**\n * `intl-messageformat` uses separate keys for `date` and `time`, but there's\n * only one native API: `Intl.DateTimeFormat`. Additionally you might want to\n * include both a time and a date in a value, therefore the separation doesn't\n * seem so useful. We offer a single `dateTime` namespace instead, but we have\n * to convert the format before `intl-messageformat` can be used.\n */\nexport default function convertFormatsToIntlMessageFormat(\n formats: Partial<Formats>,\n timeZone?: TimeZone\n): Partial<IntlFormats> {\n const formatsWithTimeZone = timeZone\n ? {...formats, dateTime: setTimeZoneInFormats(formats.dateTime, timeZone)}\n : formats;\n\n return {\n ...formatsWithTimeZone,\n date: formatsWithTimeZone?.dateTime,\n time: formatsWithTimeZone?.dateTime\n };\n}\n"],"mappings":"AAKA,SAASA,EACPC,EACAC,EACA,CACA,OAAKD,GAIE,OAAO,KAAKA,CAAO,EAAE,OAC1B,CAACE,EAA4CC,KAC3CD,EAAIC,CAAG,EAAI,CACT,SAAAF,EACA,GAAGD,EAAQG,CAAG,CAChB,EACOD,GAET,CAAC,CACH,CACF,CASe,SAARE,EACLJ,EACAC,EACsB,CACtB,MAAMI,EAAsBJ,EACxB,CAAC,GAAGD,EAAS,SAAUD,EAAqBC,EAAQ,SAAUC,CAAQ,CAAC,EACvED,EAEJ,MAAO,CACL,GAAGK,EACH,KAAMA,GAAqB,SAC3B,KAAMA,GAAqB,QAC7B,CACF","names":["setTimeZoneInFormats","formats","timeZone","acc","key","convertFormatsToIntlMessageFormat","formatsWithTimeZone"]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import IntlMessageFormat from 'intl-messageformat';
|
|
2
|
-
import { ReactElement, ReactNodeArray } from 'react';
|
|
3
|
-
import AbstractIntlMessages from './AbstractIntlMessages.mjs';
|
|
4
|
-
import Formats from './Formats.mjs';
|
|
5
|
-
import { InitializedIntlConfig } from './IntlConfig.mjs';
|
|
6
|
-
import IntlError from './IntlError.mjs';
|
|
7
|
-
import TranslationValues, { RichTranslationValues } from './TranslationValues.mjs';
|
|
8
|
-
import MessageKeys from './utils/MessageKeys.mjs';
|
|
9
|
-
import NestedKeyOf from './utils/NestedKeyOf.mjs';
|
|
10
|
-
import NestedValueOf from './utils/NestedValueOf.mjs';
|
|
11
|
-
import './DateTimeFormatOptions.mjs';
|
|
12
|
-
import './TimeZone.mjs';
|
|
13
|
-
import '@formatjs/ecma402-abstract/types/number';
|
|
14
|
-
|
|
15
|
-
declare function getMessagesOrError<Messages extends AbstractIntlMessages>({ messages, namespace, onError }: {
|
|
16
|
-
messages: Messages;
|
|
17
|
-
namespace?: string;
|
|
18
|
-
onError?(error: IntlError): void;
|
|
19
|
-
}): AbstractIntlMessages | IntlError;
|
|
20
|
-
type CreateBaseTranslatorProps<Messages> = InitializedIntlConfig & {
|
|
21
|
-
cachedFormatsByLocale?: Record<string, Record<string, IntlMessageFormat>>;
|
|
22
|
-
defaultTranslationValues?: RichTranslationValues;
|
|
23
|
-
namespace?: string;
|
|
24
|
-
messagesOrError: Messages | IntlError;
|
|
25
|
-
};
|
|
26
|
-
declare function createBaseTranslator<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>({ cachedFormatsByLocale, defaultTranslationValues, formats: globalFormats, getMessageFallback, locale, messagesOrError, namespace, onError, timeZone }: CreateBaseTranslatorProps<Messages>): {
|
|
27
|
-
<TargetKey extends MessageKeys<NestedValueOf<Messages, NestedKey>, NestedKeyOf<NestedValueOf<Messages, NestedKey>>>>(key: TargetKey, values?: TranslationValues, formats?: Partial<Formats>): string;
|
|
28
|
-
rich: (key: string, values?: RichTranslationValues, formats?: Partial<Formats>) => string | ReactElement | ReactNodeArray;
|
|
29
|
-
raw(key: string): any;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export { CreateBaseTranslatorProps, createBaseTranslator as default, getMessagesOrError };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import y from"intl-messageformat";import{cloneElement as R,isValidElement as v}from"react";import I,{IntlErrorCode as u}from"./IntlError";import w from"./convertFormatsToIntlMessageFormat";import{defaultGetMessageFallback as O,defaultOnError as _}from"./defaults";function A(t,i,f){if(!t)throw new Error(process.env.NODE_ENV!=="production"?`No messages available at \`${f}\`.`:void 0);let n=t;return i.split(".").forEach(s=>{const a=n[s];if(s==null||a==null)throw new Error(process.env.NODE_ENV!=="production"?`Could not resolve \`${i}\` in ${f?`\`${f}\``:"messages"}.`:void 0);n=a}),n}function $(t){if(Object.keys(t).length===0)return;const i={};return Object.keys(t).forEach(f=>{let n=0;const s=t[f];let a;typeof s=="function"?a=o=>{const E=s(o);return v(E)?R(E,{key:f+n++}):E}:a=s,i[f]=a}),i}function tr({messages:t,namespace:i,onError:f=_}){try{if(!t)throw new Error(process.env.NODE_ENV!=="production"?"No messages were configured on the provider.":void 0);const n=i?A(t,i):t;if(!n)throw new Error(process.env.NODE_ENV!=="production"?`No messages for namespace \`${i}\` found.`:void 0);return n}catch(n){const s=new I(u.MISSING_MESSAGE,n.message);return f(s),s}}function b({cachedFormatsByLocale:t,defaultTranslationValues:i,formats:f,getMessageFallback:n=O,locale:s,messagesOrError:a,namespace:o,onError:E,timeZone:T}){function c(r,l,d){const g=new I(l,d);return E(g),n({error:g,key:r,namespace:o})}function S(r,l,d){if(a instanceof I)return n({error:a,key:r,namespace:o});const g=a;let m;try{m=A(g,r,o)}catch(e){return c(r,u.MISSING_MESSAGE,e.message)}function V(e){return e.filter(N=>N!=null).join(".")}const h=V([o,r,String(m)]);let p;if(t?.[s]?.[h])p=t?.[s][h];else{if(typeof m=="object"){let e,N;return Array.isArray(m)?(e=u.INVALID_MESSAGE,process.env.NODE_ENV!=="production"&&(N=`Message at \`${V([o,r])}\` resolved to an array, but only strings are supported. See https://next-intl-docs.vercel.app/docs/usage/messages#arrays-of-messages`)):(e=u.INSUFFICIENT_PATH,process.env.NODE_ENV!=="production"&&(N=`Message at \`${V([o,r])}\` 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`)),c(r,e,N)}try{p=new y(m,s,w({...f,...d},T))}catch(e){return c(r,u.INVALID_MESSAGE,e.message)}t&&(t[s]||(t[s]={}),t[s][h]=p)}try{const e=p.format($({...i,...l}));if(e==null)throw new Error(process.env.NODE_ENV!=="production"?`Unable to format \`${r}\` in ${o?`namespace \`${o}\``:"messages"}`:void 0);return v(e)||Array.isArray(e)||typeof e=="string"?e:String(e)}catch(e){return c(r,u.FORMATTING_ERROR,e.message)}}function M(r,l,d){const g=S(r,l,d);return typeof g!="string"?c(r,u.INVALID_MESSAGE,process.env.NODE_ENV!=="production"?`The message \`${r}\` in ${o?`namespace \`${o}\``:"messages"} didn't resolve to a string. If you want to format rich text, use \`t.rich\` instead.`:void 0):g}return M.rich=S,M.raw=r=>{if(a instanceof I)return n({error:a,key:r,namespace:o});const l=a;try{return A(l,r,o)}catch(d){return c(r,u.MISSING_MESSAGE,d.message)}},M}export{b as default,tr as getMessagesOrError};
|
|
2
|
-
//# sourceMappingURL=createBaseTranslator.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/createBaseTranslator.tsx"],"sourcesContent":["// eslint-disable-next-line import/no-named-as-default -- False positive\nimport IntlMessageFormat from 'intl-messageformat';\nimport {\n cloneElement,\n isValidElement,\n ReactElement,\n ReactNode,\n ReactNodeArray\n} from 'react';\nimport AbstractIntlMessages from './AbstractIntlMessages';\nimport Formats from './Formats';\nimport {InitializedIntlConfig} from './IntlConfig';\nimport IntlError, {IntlErrorCode} from './IntlError';\nimport TranslationValues, {RichTranslationValues} from './TranslationValues';\nimport convertFormatsToIntlMessageFormat from './convertFormatsToIntlMessageFormat';\nimport {defaultGetMessageFallback, defaultOnError} from './defaults';\nimport MessageKeys from './utils/MessageKeys';\nimport NestedKeyOf from './utils/NestedKeyOf';\nimport NestedValueOf from './utils/NestedValueOf';\n\nfunction resolvePath(\n messages: AbstractIntlMessages | undefined,\n key: string,\n namespace?: string\n) {\n if (!messages) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `No messages available at \\`${namespace}\\`.`\n : undefined\n );\n }\n\n let message = messages;\n\n key.split('.').forEach((part) => {\n const next = (message as any)[part];\n\n if (part == null || next == null) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `Could not resolve \\`${key}\\` in ${\n namespace ? `\\`${namespace}\\`` : 'messages'\n }.`\n : undefined\n );\n }\n\n message = next;\n });\n\n return message;\n}\n\nfunction prepareTranslationValues(values: RichTranslationValues) {\n if (Object.keys(values).length === 0) return undefined;\n\n // Workaround for https://github.com/formatjs/formatjs/issues/1467\n const transformedValues: RichTranslationValues = {};\n Object.keys(values).forEach((key) => {\n let index = 0;\n const value = values[key];\n\n let transformed;\n if (typeof value === 'function') {\n transformed = (chunks: ReactNode) => {\n const result = value(chunks);\n\n return isValidElement(result)\n ? cloneElement(result, {key: key + index++})\n : result;\n };\n } else {\n transformed = value;\n }\n\n transformedValues[key] = transformed;\n });\n\n return transformedValues;\n}\n\nexport function getMessagesOrError<Messages extends AbstractIntlMessages>({\n messages,\n namespace,\n onError = defaultOnError\n}: {\n messages: Messages;\n namespace?: string;\n onError?(error: IntlError): void;\n}) {\n try {\n if (!messages) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `No messages were configured on the provider.`\n : undefined\n );\n }\n\n const retrievedMessages = namespace\n ? resolvePath(messages, namespace)\n : messages;\n\n if (!retrievedMessages) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `No messages for namespace \\`${namespace}\\` found.`\n : undefined\n );\n }\n\n return retrievedMessages;\n } catch (error) {\n const intlError = new IntlError(\n IntlErrorCode.MISSING_MESSAGE,\n (error as Error).message\n );\n onError(intlError);\n return intlError;\n }\n}\n\nexport type CreateBaseTranslatorProps<Messages> = InitializedIntlConfig & {\n cachedFormatsByLocale?: Record<string, Record<string, IntlMessageFormat>>;\n defaultTranslationValues?: RichTranslationValues;\n namespace?: string;\n messagesOrError: Messages | IntlError;\n};\n\nexport default function createBaseTranslator<\n Messages extends AbstractIntlMessages,\n NestedKey extends NestedKeyOf<Messages>\n>({\n cachedFormatsByLocale,\n defaultTranslationValues,\n formats: globalFormats,\n getMessageFallback = defaultGetMessageFallback,\n locale,\n messagesOrError,\n namespace,\n onError,\n timeZone\n}: CreateBaseTranslatorProps<Messages>) {\n function getFallbackFromErrorAndNotify(\n key: string,\n code: IntlErrorCode,\n message?: string\n ) {\n const error = new IntlError(code, message);\n onError(error);\n return getMessageFallback({error, key, namespace});\n }\n\n function translateBaseFn(\n /** Use a dot to indicate a level of nesting (e.g. `namespace.nestedLabel`). */\n key: string,\n /** Key value pairs for values to interpolate into the message. */\n values?: RichTranslationValues,\n /** Provide custom formats for numbers, dates and times. */\n formats?: Partial<Formats>\n ): string | ReactElement | ReactNodeArray {\n if (messagesOrError instanceof IntlError) {\n // We have already warned about this during render\n return getMessageFallback({\n error: messagesOrError,\n key,\n namespace\n });\n }\n const messages = messagesOrError;\n\n let message;\n try {\n message = resolvePath(messages, key, namespace);\n } catch (error) {\n return getFallbackFromErrorAndNotify(\n key,\n IntlErrorCode.MISSING_MESSAGE,\n (error as Error).message\n );\n }\n\n function joinPath(parts: Array<string | undefined>) {\n return parts.filter((part) => part != null).join('.');\n }\n\n const cacheKey = joinPath([namespace, key, String(message)]);\n\n let messageFormat;\n if (cachedFormatsByLocale?.[locale]?.[cacheKey]) {\n messageFormat = cachedFormatsByLocale?.[locale][cacheKey];\n } else {\n if (typeof message === 'object') {\n let code, errorMessage;\n if (Array.isArray(message)) {\n code = IntlErrorCode.INVALID_MESSAGE;\n if (process.env.NODE_ENV !== 'production') {\n errorMessage = `Message at \\`${joinPath([\n namespace,\n key\n ])}\\` resolved to an array, but only strings are supported. See https://next-intl-docs.vercel.app/docs/usage/messages#arrays-of-messages`;\n }\n } else {\n code = IntlErrorCode.INSUFFICIENT_PATH;\n if (process.env.NODE_ENV !== 'production') {\n errorMessage = `Message at \\`${joinPath([\n namespace,\n key\n ])}\\` 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`;\n }\n }\n\n return getFallbackFromErrorAndNotify(key, code, errorMessage);\n }\n\n try {\n messageFormat = new IntlMessageFormat(\n message,\n locale,\n convertFormatsToIntlMessageFormat(\n {...globalFormats, ...formats},\n timeZone\n )\n );\n } catch (error) {\n return getFallbackFromErrorAndNotify(\n key,\n IntlErrorCode.INVALID_MESSAGE,\n (error as Error).message\n );\n }\n\n if (cachedFormatsByLocale) {\n if (!cachedFormatsByLocale[locale]) {\n cachedFormatsByLocale[locale] = {};\n }\n cachedFormatsByLocale[locale][cacheKey] = messageFormat;\n }\n }\n\n try {\n const formattedMessage = messageFormat.format(\n // @ts-ignore `intl-messageformat` expects a different format\n // for rich text elements since a recent minor update. This\n // needs to be evaluated in detail, possibly also in regards\n // to be able to format to parts.\n prepareTranslationValues({...defaultTranslationValues, ...values})\n );\n\n if (formattedMessage == null) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `Unable to format \\`${key}\\` in ${\n namespace ? `namespace \\`${namespace}\\`` : 'messages'\n }`\n : undefined\n );\n }\n\n // Limit the function signature to return strings or React elements\n return isValidElement(formattedMessage) ||\n // Arrays of React elements\n Array.isArray(formattedMessage) ||\n typeof formattedMessage === 'string'\n ? formattedMessage\n : String(formattedMessage);\n } catch (error) {\n return getFallbackFromErrorAndNotify(\n key,\n IntlErrorCode.FORMATTING_ERROR,\n (error as Error).message\n );\n }\n }\n\n function translateFn<\n TargetKey extends MessageKeys<\n NestedValueOf<Messages, NestedKey>,\n NestedKeyOf<NestedValueOf<Messages, NestedKey>>\n >\n >(\n /** Use a dot to indicate a level of nesting (e.g. `namespace.nestedLabel`). */\n key: TargetKey,\n /** Key value pairs for values to interpolate into the message. */\n values?: TranslationValues,\n /** Provide custom formats for numbers, dates and times. */\n formats?: Partial<Formats>\n ): string {\n const result = translateBaseFn(key, values, formats);\n\n if (typeof result !== 'string') {\n return getFallbackFromErrorAndNotify(\n key,\n IntlErrorCode.INVALID_MESSAGE,\n process.env.NODE_ENV !== 'production'\n ? `The message \\`${key}\\` in ${\n namespace ? `namespace \\`${namespace}\\`` : 'messages'\n } didn't resolve to a string. If you want to format rich text, use \\`t.rich\\` instead.`\n : undefined\n );\n }\n\n return result;\n }\n\n translateFn.rich = translateBaseFn;\n\n translateFn.raw = (\n /** Use a dot to indicate a level of nesting (e.g. `namespace.nestedLabel`). */\n key: string\n ): any => {\n if (messagesOrError instanceof IntlError) {\n // We have already warned about this during render\n return getMessageFallback({\n error: messagesOrError,\n key,\n namespace\n });\n }\n const messages = messagesOrError;\n\n try {\n return resolvePath(messages, key, namespace);\n } catch (error) {\n return getFallbackFromErrorAndNotify(\n key,\n IntlErrorCode.MISSING_MESSAGE,\n (error as Error).message\n );\n }\n };\n\n return translateFn;\n}\n"],"mappings":"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","names":["IntlMessageFormat","cloneElement","isValidElement","IntlError","IntlErrorCode","convertFormatsToIntlMessageFormat","defaultGetMessageFallback","defaultOnError","resolvePath","messages","key","namespace","message","part","next","prepareTranslationValues","values","transformedValues","index","value","transformed","chunks","result","getMessagesOrError","onError","retrievedMessages","error","intlError","createBaseTranslator","cachedFormatsByLocale","defaultTranslationValues","globalFormats","getMessageFallback","locale","messagesOrError","timeZone","getFallbackFromErrorAndNotify","code","translateBaseFn","formats","joinPath","parts","cacheKey","messageFormat","errorMessage","formattedMessage","translateFn"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import DateTimeFormatOptions from './DateTimeFormatOptions.mjs';
|
|
2
|
-
import Formats from './Formats.mjs';
|
|
3
|
-
import IntlError from './IntlError.mjs';
|
|
4
|
-
import { NumberFormatOptions } from '@formatjs/ecma402-abstract/types/number';
|
|
5
|
-
import TimeZone from './TimeZone.mjs';
|
|
6
|
-
|
|
7
|
-
type Props = {
|
|
8
|
-
locale: string;
|
|
9
|
-
timeZone?: TimeZone;
|
|
10
|
-
onError?(error: IntlError): void;
|
|
11
|
-
formats?: Partial<Formats>;
|
|
12
|
-
now?: Date;
|
|
13
|
-
};
|
|
14
|
-
declare function createFormatter({ formats, locale, now: globalNow, onError, timeZone }: Props): {
|
|
15
|
-
dateTime: (value: Date | number, formatOrOptions?: string | DateTimeFormatOptions) => string;
|
|
16
|
-
number: (value: number | bigint, formatOrOptions?: string | NumberFormatOptions) => string;
|
|
17
|
-
relativeTime: (date: number | Date, now?: number | Date) => string;
|
|
18
|
-
list: (value: Iterable<string>, formatOrOptions?: string | Intl.ListFormatOptions) => string;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export { createFormatter as default };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import l,{IntlErrorCode as p}from"./IntlError";import{defaultOnError as M}from"./defaults";const d=60,g=d*60,u=g*24,F=u*7,O=u*(365/12),h=u*365;function N(n){const i=Math.abs(n);let a,o;return i<d?(o="second",a=Math.round(n)):i<g?(o="minute",a=Math.round(n/d)):i<u?(o="hour",a=Math.round(n/g)):i<F?(o="day",a=Math.round(n/u)):i<O?(o="week",a=Math.round(n/F)):i<h?(o="month",a=Math.round(n/O)):(o="year",a=Math.round(n/h)),{value:a,unit:o}}function v({formats:n,locale:i,now:a,onError:o=M,timeZone:T}){function b(r,e){let t;if(typeof e=="string"){const s=e;if(t=r?.[s],!t){const m=new l(p.MISSING_FORMAT,process.env.NODE_ENV!=="production"?`Format \`${s}\` is not available. You can configure it on the provider or provide custom options.`:void 0);throw o(m),m}}else t=e;return t}function c(r,e,t,s){let m;try{m=b(t,e)}catch{return String(r)}try{return s(m)}catch(f){return o(new l(p.FORMATTING_ERROR,f.message)),String(r)}}function D(r,e){return c(r,e,n?.dateTime,t=>(T&&!t?.timeZone&&(t={...t,timeZone:T}),new Intl.DateTimeFormat(i,t).format(r)))}function E(r,e){return c(r,e,n?.number,t=>new Intl.NumberFormat(i,t).format(r))}function R(r,e){try{if(!e)if(a)e=a;else throw new Error(process.env.NODE_ENV!=="production"?"The `now` parameter wasn't provided and there was no global fallback configured on the provider.":void 0);const t=r instanceof Date?r:new Date(r),s=e instanceof Date?e:new Date(e),m=(t.getTime()-s.getTime())/1e3,{unit:f,value:w}=N(m);return new Intl.RelativeTimeFormat(i,{numeric:"auto"}).format(w,f)}catch(t){return o(new l(p.FORMATTING_ERROR,t.message)),String(r)}}function I(r,e){return c(r,e,n?.list,t=>new Intl.ListFormat(i,t).format(r))}return{dateTime:D,number:E,relativeTime:R,list:I}}export{v as default};
|
|
2
|
-
//# sourceMappingURL=createFormatter.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/createFormatter.tsx"],"sourcesContent":["import DateTimeFormatOptions from './DateTimeFormatOptions';\nimport Formats from './Formats';\nimport IntlError, {IntlErrorCode} from './IntlError';\nimport NumberFormatOptions from './NumberFormatOptions';\nimport TimeZone from './TimeZone';\nimport {defaultOnError} from './defaults';\n\nconst MINUTE = 60;\nconst HOUR = MINUTE * 60;\nconst DAY = HOUR * 24;\nconst WEEK = DAY * 7;\nconst MONTH = DAY * (365 / 12); // Approximation\nconst YEAR = DAY * 365;\n\nfunction getRelativeTimeFormatConfig(seconds: number) {\n const absValue = Math.abs(seconds);\n let value, unit: Intl.RelativeTimeFormatUnit;\n\n // We have to round the resulting values, as `Intl.RelativeTimeFormat`\n // will include fractions like '2.1 hours ago'.\n\n if (absValue < MINUTE) {\n unit = 'second';\n value = Math.round(seconds);\n } else if (absValue < HOUR) {\n unit = 'minute';\n value = Math.round(seconds / MINUTE);\n } else if (absValue < DAY) {\n unit = 'hour';\n value = Math.round(seconds / HOUR);\n } else if (absValue < WEEK) {\n unit = 'day';\n value = Math.round(seconds / DAY);\n } else if (absValue < MONTH) {\n unit = 'week';\n value = Math.round(seconds / WEEK);\n } else if (absValue < YEAR) {\n unit = 'month';\n value = Math.round(seconds / MONTH);\n } else {\n unit = 'year';\n value = Math.round(seconds / YEAR);\n }\n\n return {value, unit};\n}\n\ntype Props = {\n locale: string;\n timeZone?: TimeZone;\n onError?(error: IntlError): void;\n formats?: Partial<Formats>;\n now?: Date;\n};\n\nexport default function createFormatter({\n formats,\n locale,\n now: globalNow,\n onError = defaultOnError,\n timeZone\n}: Props) {\n function resolveFormatOrOptions<Options>(\n typeFormats: Record<string, Options> | undefined,\n formatOrOptions?: string | Options\n ) {\n let options;\n if (typeof formatOrOptions === 'string') {\n const formatName = formatOrOptions;\n options = typeFormats?.[formatName];\n\n if (!options) {\n const error = new IntlError(\n IntlErrorCode.MISSING_FORMAT,\n process.env.NODE_ENV !== 'production'\n ? `Format \\`${formatName}\\` is not available. You can configure it on the provider or provide custom options.`\n : undefined\n );\n onError(error);\n throw error;\n }\n } else {\n options = formatOrOptions;\n }\n\n return options;\n }\n\n function getFormattedValue<Value, Options>(\n value: Value,\n formatOrOptions: string | Options | undefined,\n typeFormats: Record<string, Options> | undefined,\n formatter: (options?: Options) => string\n ) {\n let options;\n try {\n options = resolveFormatOrOptions(typeFormats, formatOrOptions);\n } catch (error) {\n return String(value);\n }\n\n try {\n return formatter(options);\n } catch (error) {\n onError(\n new IntlError(IntlErrorCode.FORMATTING_ERROR, (error as Error).message)\n );\n return String(value);\n }\n }\n\n function dateTime(\n /** If a number is supplied, this is interpreted as a UTC timestamp. */\n value: Date | number,\n /** If a time zone is supplied, the `value` is converted to that time zone.\n * Otherwise the user time zone will be used. */\n formatOrOptions?: string | DateTimeFormatOptions\n ) {\n return getFormattedValue(\n value,\n formatOrOptions,\n formats?.dateTime,\n (options) => {\n if (timeZone && !options?.timeZone) {\n options = {...options, timeZone};\n }\n\n return new Intl.DateTimeFormat(locale, options).format(value);\n }\n );\n }\n\n function number(\n value: number | bigint,\n formatOrOptions?: string | NumberFormatOptions\n ) {\n return getFormattedValue(\n value,\n formatOrOptions,\n formats?.number,\n (options) => new Intl.NumberFormat(locale, options).format(value)\n );\n }\n\n function relativeTime(\n /** The date time that needs to be formatted. */\n date: number | Date,\n /** The reference point in time to which `date` will be formatted in relation to. */\n now?: number | Date\n ) {\n try {\n if (!now) {\n if (globalNow) {\n now = globalNow;\n } else {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? `The \\`now\\` parameter wasn't provided and there was no global fallback configured on the provider.`\n : undefined\n );\n }\n }\n\n const dateDate = date instanceof Date ? date : new Date(date);\n const nowDate = now instanceof Date ? now : new Date(now);\n\n const seconds = (dateDate.getTime() - nowDate.getTime()) / 1000;\n const {unit, value} = getRelativeTimeFormatConfig(seconds);\n\n return new Intl.RelativeTimeFormat(locale, {\n numeric: 'auto'\n }).format(value, unit);\n } catch (error) {\n onError(\n new IntlError(IntlErrorCode.FORMATTING_ERROR, (error as Error).message)\n );\n return String(date);\n }\n }\n\n function list(\n value: Iterable<string>,\n formatOrOptions?: string | Intl.ListFormatOptions\n ) {\n return getFormattedValue(value, formatOrOptions, formats?.list, (options) =>\n new Intl.ListFormat(locale, options).format(value)\n );\n }\n\n return {dateTime, number, relativeTime, list};\n}\n"],"mappings":"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","names":["IntlError","IntlErrorCode","defaultOnError","MINUTE","HOUR","DAY","WEEK","MONTH","YEAR","getRelativeTimeFormatConfig","seconds","absValue","value","unit","createFormatter","formats","locale","globalNow","onError","timeZone","resolveFormatOrOptions","typeFormats","formatOrOptions","options","formatName","error","getFormattedValue","formatter","dateTime","number","relativeTime","date","now","dateDate","nowDate","list"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as _formatjs_ecma402_abstract_types_number from '@formatjs/ecma402-abstract/types/number';
|
|
2
|
-
import DateTimeFormatOptions from './DateTimeFormatOptions.mjs';
|
|
3
|
-
import createFormatter from './createFormatter.mjs';
|
|
4
|
-
import './TimeZone.mjs';
|
|
5
|
-
import './Formats.mjs';
|
|
6
|
-
import './IntlError.mjs';
|
|
7
|
-
|
|
8
|
-
/** @deprecated Switch to `createFormatter` */
|
|
9
|
-
declare function createIntl(...args: Parameters<typeof createFormatter>): {
|
|
10
|
-
formatDateTime: (value: number | Date, formatOrOptions?: string | DateTimeFormatOptions | undefined) => string;
|
|
11
|
-
formatNumber: (value: number | bigint, formatOrOptions?: string | _formatjs_ecma402_abstract_types_number.NumberFormatOptions | undefined) => string;
|
|
12
|
-
formatRelativeTime: (date: number | Date, now?: number | Date | undefined) => string;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export { createIntl as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/createIntl.tsx"],"sourcesContent":["import createFormatter from './createFormatter';\n\n/** @deprecated Switch to `createFormatter` */\nexport default function createIntl(\n ...args: Parameters<typeof createFormatter>\n) {\n const formatter = createFormatter(...args);\n return {\n formatDateTime: formatter.dateTime,\n formatNumber: formatter.number,\n formatRelativeTime: formatter.relativeTime\n };\n}\n"],"mappings":"AAAA,OAAOA,MAAqB,oBAGb,SAARC,KACFC,EACH,CACA,MAAMC,EAAYH,EAAgB,GAAGE,CAAI,EACzC,MAAO,CACL,eAAgBC,EAAU,SAC1B,aAAcA,EAAU,OACxB,mBAAoBA,EAAU,YAChC,CACF","names":["createFormatter","createIntl","args","formatter"]}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import Formats from './Formats.mjs';
|
|
2
|
-
import IntlConfig from './IntlConfig.mjs';
|
|
3
|
-
import TranslationValues from './TranslationValues.mjs';
|
|
4
|
-
import { CoreRichTranslationValues } from './createTranslatorImpl.mjs';
|
|
5
|
-
import MessageKeys from './utils/MessageKeys.mjs';
|
|
6
|
-
import NamespaceKeys from './utils/NamespaceKeys.mjs';
|
|
7
|
-
import NestedKeyOf from './utils/NestedKeyOf.mjs';
|
|
8
|
-
import NestedValueOf from './utils/NestedValueOf.mjs';
|
|
9
|
-
import './DateTimeFormatOptions.mjs';
|
|
10
|
-
import './TimeZone.mjs';
|
|
11
|
-
import '@formatjs/ecma402-abstract/types/number';
|
|
12
|
-
import './IntlError.mjs';
|
|
13
|
-
import './AbstractIntlMessages.mjs';
|
|
14
|
-
import 'react';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Translates messages from the given namespace by using the ICU syntax.
|
|
18
|
-
* See https://formatjs.io/docs/core-concepts/icu-syntax.
|
|
19
|
-
*
|
|
20
|
-
* If no namespace is provided, all available messages are returned.
|
|
21
|
-
* The namespace can also indicate nesting by using a dot
|
|
22
|
-
* (e.g. `namespace.Component`).
|
|
23
|
-
*/
|
|
24
|
-
declare function createTranslator<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>({ getMessageFallback, messages, namespace, onError, ...rest }: Omit<IntlConfig<IntlMessages>, 'defaultTranslationValues' | 'messages'> & {
|
|
25
|
-
messages: NonNullable<IntlConfig<IntlMessages>['messages']>;
|
|
26
|
-
namespace?: NestedKey;
|
|
27
|
-
}): {
|
|
28
|
-
<TargetKey extends MessageKeys<NestedValueOf<{
|
|
29
|
-
'!': IntlMessages;
|
|
30
|
-
}, [
|
|
31
|
-
NestedKey
|
|
32
|
-
] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
|
|
33
|
-
'!': IntlMessages;
|
|
34
|
-
}, [
|
|
35
|
-
NestedKey
|
|
36
|
-
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: TranslationValues, formats?: Partial<Formats>): string;
|
|
37
|
-
rich<TargetKey extends MessageKeys<NestedValueOf<{
|
|
38
|
-
'!': IntlMessages;
|
|
39
|
-
}, [
|
|
40
|
-
NestedKey
|
|
41
|
-
] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
|
|
42
|
-
'!': IntlMessages;
|
|
43
|
-
}, [
|
|
44
|
-
NestedKey
|
|
45
|
-
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: CoreRichTranslationValues, formats?: Partial<Formats>): string;
|
|
46
|
-
raw<TargetKey extends MessageKeys<NestedValueOf<{
|
|
47
|
-
'!': IntlMessages;
|
|
48
|
-
}, [
|
|
49
|
-
NestedKey
|
|
50
|
-
] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
|
|
51
|
-
'!': IntlMessages;
|
|
52
|
-
}, [
|
|
53
|
-
NestedKey
|
|
54
|
-
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey): any;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export { createTranslator as default };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import n from"./createTranslatorImpl";import{defaultGetMessageFallback as l,defaultOnError as d}from"./defaults";function o({getMessageFallback:s=l,messages:t,namespace:e,onError:a=d,...r}){return n({...r,onError:a,getMessageFallback:s,messages:{"!":t},namespace:e?`!.${e}`:"!"},"!")}export{o as default};
|
|
2
|
-
//# sourceMappingURL=createTranslator.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/createTranslator.tsx"],"sourcesContent":["import Formats from './Formats';\nimport IntlConfig from './IntlConfig';\nimport TranslationValues from './TranslationValues';\nimport createTranslatorImpl, {\n CoreRichTranslationValues\n} from './createTranslatorImpl';\nimport {defaultGetMessageFallback, defaultOnError} from './defaults';\nimport MessageKeys from './utils/MessageKeys';\nimport NamespaceKeys from './utils/NamespaceKeys';\nimport NestedKeyOf from './utils/NestedKeyOf';\nimport NestedValueOf from './utils/NestedValueOf';\n\n/**\n * Translates messages from the given namespace by using the ICU syntax.\n * See https://formatjs.io/docs/core-concepts/icu-syntax.\n *\n * If no namespace is provided, all available messages are returned.\n * The namespace can also indicate nesting by using a dot\n * (e.g. `namespace.Component`).\n */\nexport default function createTranslator<\n NestedKey extends NamespaceKeys<\n IntlMessages,\n NestedKeyOf<IntlMessages>\n > = never\n>({\n getMessageFallback = defaultGetMessageFallback,\n messages,\n namespace,\n onError = defaultOnError,\n ...rest\n}: Omit<IntlConfig<IntlMessages>, 'defaultTranslationValues' | 'messages'> & {\n messages: NonNullable<IntlConfig<IntlMessages>['messages']>;\n namespace?: NestedKey;\n}): // Explicitly defining the return type is necessary as TypeScript would get it wrong\n{\n // Default invocation\n <\n TargetKey extends MessageKeys<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >,\n NestedKeyOf<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >\n >\n >\n >(\n key: TargetKey,\n values?: TranslationValues,\n formats?: Partial<Formats>\n ): string;\n\n // `rich`\n rich<\n TargetKey extends MessageKeys<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >,\n NestedKeyOf<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >\n >\n >\n >(\n key: TargetKey,\n values?: CoreRichTranslationValues,\n formats?: Partial<Formats>\n ): string;\n\n // `raw`\n raw<\n TargetKey extends MessageKeys<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >,\n NestedKeyOf<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >\n >\n >\n >(\n key: TargetKey\n ): any;\n} {\n // We have to wrap the actual function so the type inference for the optional\n // namespace works correctly. See https://stackoverflow.com/a/71529575/343045\n // The prefix (\"!\") is arbitrary.\n return createTranslatorImpl<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >(\n {\n ...rest,\n onError,\n getMessageFallback,\n messages: {'!': messages},\n // @ts-ignore\n namespace: namespace ? `!.${namespace}` : '!'\n },\n '!'\n );\n}\n"],"mappings":"AAGA,OAAOA,MAEA,yBACP,OAAQ,6BAAAC,EAA2B,kBAAAC,MAAqB,aAczC,SAARC,EAKL,CACA,mBAAAC,EAAqBH,EACrB,SAAAI,EACA,UAAAC,EACA,QAAAC,EAAUL,EACV,GAAGM,CACL,EA8DE,CAIA,OAAOR,EAIL,CACE,GAAGQ,EACH,QAAAD,EACA,mBAAAH,EACA,SAAU,CAAC,IAAKC,CAAQ,EAExB,UAAWC,EAAY,KAAKA,CAAS,GAAK,GAC5C,EACA,GACF,CACF","names":["createTranslatorImpl","defaultGetMessageFallback","defaultOnError","createTranslator","getMessageFallback","messages","namespace","onError","rest"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import Formats from './Formats.mjs';
|
|
2
|
-
import TranslationValues, { TranslationValue } from './TranslationValues.mjs';
|
|
3
|
-
import MessageKeys from './utils/MessageKeys.mjs';
|
|
4
|
-
import NestedValueOf from './utils/NestedValueOf.mjs';
|
|
5
|
-
import AbstractIntlMessages from './AbstractIntlMessages.mjs';
|
|
6
|
-
import { InitializedIntlConfig } from './IntlConfig.mjs';
|
|
7
|
-
import NestedKeyOf from './utils/NestedKeyOf.mjs';
|
|
8
|
-
import './DateTimeFormatOptions.mjs';
|
|
9
|
-
import './TimeZone.mjs';
|
|
10
|
-
import '@formatjs/ecma402-abstract/types/number';
|
|
11
|
-
import 'react';
|
|
12
|
-
import './IntlError.mjs';
|
|
13
|
-
|
|
14
|
-
type CoreRichTranslationValues = Record<string, TranslationValue | ((chunks: string) => string)>;
|
|
15
|
-
type CreateTranslatorImplProps<Messages> = Omit<InitializedIntlConfig, 'messages'> & {
|
|
16
|
-
namespace: string;
|
|
17
|
-
messages: Messages;
|
|
18
|
-
};
|
|
19
|
-
declare function createTranslatorImpl<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>({ getMessageFallback, messages, namespace, onError, ...rest }: CreateTranslatorImplProps<Messages>, namespacePrefix: string): {
|
|
20
|
-
(key: MessageKeys<NestedValueOf<Messages, NestedKey>, NestedKeyOf<NestedValueOf<Messages, NestedKey>>>, values?: TranslationValues | undefined, formats?: Partial<Formats> | undefined): string;
|
|
21
|
-
rich(key: string, values: CoreRichTranslationValues, formats?: Partial<Formats> | undefined): string;
|
|
22
|
-
raw: (key: string) => any;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export { CoreRichTranslationValues, CreateTranslatorImplProps, createTranslatorImpl as default };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import u,{IntlErrorCode as d}from"./IntlError";import h,{getMessagesOrError as I}from"./createBaseTranslator";import T from"./resolveNamespace";function R({getMessageFallback:o,messages:s,namespace:r,onError:t,...g},i){s=s[i],r=T(r,i);const a=h({...g,onError:t,getMessageFallback:o,messagesOrError:I({messages:s,namespace:r,onError:t})}),f=a.rich;function n(...e){return a(...e)}return n.rich=(e,p,m)=>{const l=f(e,p,m);if(typeof l!="string"){const c=new u(d.FORMATTING_ERROR,process.env.NODE_ENV!=="production"?"`createTranslator` only accepts functions for rich text formatting that receive and return strings.\n\nE.g. t.rich('rich', {b: (chunks) => `<b>${chunks}</b>`})":void 0);return t(c),o({error:c,key:e,namespace:r})}return l},n.raw=a.raw,n}export{R as default};
|
|
2
|
-
//# sourceMappingURL=createTranslatorImpl.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/createTranslatorImpl.tsx"],"sourcesContent":["import AbstractIntlMessages from './AbstractIntlMessages';\nimport {InitializedIntlConfig} from './IntlConfig';\nimport IntlError, {IntlErrorCode} from './IntlError';\nimport {RichTranslationValues, TranslationValue} from './TranslationValues';\nimport createBaseTranslator, {getMessagesOrError} from './createBaseTranslator';\nimport resolveNamespace from './resolveNamespace';\nimport NestedKeyOf from './utils/NestedKeyOf';\n\nexport type CoreRichTranslationValues = Record<\n string,\n TranslationValue | ((chunks: string) => string)\n>;\n\nexport type CreateTranslatorImplProps<Messages> = Omit<\n InitializedIntlConfig,\n 'messages'\n> & {\n namespace: string;\n messages: Messages;\n};\n\nexport default function createTranslatorImpl<\n Messages extends AbstractIntlMessages,\n NestedKey extends NestedKeyOf<Messages>\n>(\n {\n getMessageFallback,\n messages,\n namespace,\n onError,\n ...rest\n }: CreateTranslatorImplProps<Messages>,\n namespacePrefix: string\n) {\n // The `namespacePrefix` is part of the type system.\n // See the comment in the function invocation.\n messages = messages[namespacePrefix] as Messages;\n namespace = resolveNamespace(namespace, namespacePrefix) as NestedKey;\n\n const translator = createBaseTranslator<Messages, NestedKey>({\n ...rest,\n onError,\n getMessageFallback,\n messagesOrError: getMessagesOrError({\n messages,\n namespace,\n onError\n }) as Messages | IntlError\n });\n\n const originalRich = translator.rich;\n\n function base(...args: Parameters<typeof translator>) {\n return translator(...args);\n }\n\n // Augment `t.rich` to return plain strings\n base.rich = (\n key: Parameters<typeof originalRich>[0],\n /** Key value pairs for values to interpolate into the message. */\n values: CoreRichTranslationValues,\n formats?: Parameters<typeof originalRich>[2]\n ): string => {\n // `chunks` is returned as a string when no React element\n // is used, therefore it's safe to cast this type.\n const result = originalRich(key, values as RichTranslationValues, formats);\n\n // When only string chunks are provided to the parser, only strings should be returned here.\n if (typeof result !== 'string') {\n const error = new IntlError(\n IntlErrorCode.FORMATTING_ERROR,\n process.env.NODE_ENV !== 'production'\n ? \"`createTranslator` only accepts functions for rich text formatting that receive and return strings.\\n\\nE.g. t.rich('rich', {b: (chunks) => `<b>${chunks}</b>`})\"\n : undefined\n );\n\n onError(error);\n return getMessageFallback({error, key, namespace});\n }\n\n return result;\n };\n\n base.raw = translator.raw;\n\n return base;\n}\n"],"mappings":"AAEA,OAAOA,GAAY,iBAAAC,MAAoB,cAEvC,OAAOC,GAAuB,sBAAAC,MAAyB,yBACvD,OAAOC,MAAsB,qBAgBd,SAARC,EAIL,CACE,mBAAAC,EACA,SAAAC,EACA,UAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EACAC,EACA,CAGAJ,EAAWA,EAASI,CAAe,EACnCH,EAAYJ,EAAiBI,EAAWG,CAAe,EAEvD,MAAMC,EAAaV,EAA0C,CAC3D,GAAGQ,EACH,QAAAD,EACA,mBAAAH,EACA,gBAAiBH,EAAmB,CAClC,SAAAI,EACA,UAAAC,EACA,QAAAC,CACF,CAAC,CACH,CAAC,EAEKI,EAAeD,EAAW,KAEhC,SAASE,KAAQC,EAAqC,CACpD,OAAOH,EAAW,GAAGG,CAAI,CAC3B,CAGA,OAAAD,EAAK,KAAO,CACVE,EAEAC,EACAC,IACW,CAGX,MAAMC,EAASN,EAAaG,EAAKC,EAAiCC,CAAO,EAGzE,GAAI,OAAOC,GAAW,SAAU,CAC9B,MAAMC,EAAQ,IAAIpB,EAChBC,EAAc,iBACd,QAAQ,IAAI,WAAa,aACrB,kKACA,MACN,EAEA,OAAAQ,EAAQW,CAAK,EACNd,EAAmB,CAAC,MAAAc,EAAO,IAAAJ,EAAK,UAAAR,CAAS,CAAC,CACnD,CAEA,OAAOW,CACT,EAEAL,EAAK,IAAMF,EAAW,IAEfE,CACT","names":["IntlError","IntlErrorCode","createBaseTranslator","getMessagesOrError","resolveNamespace","createTranslatorImpl","getMessageFallback","messages","namespace","onError","rest","namespacePrefix","translator","originalRich","base","args","key","values","formats","result","error"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import IntlError from './IntlError.mjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Contains defaults that are used for all entry points into the core.
|
|
5
|
-
* See also `InitializedIntlConfiguration`.
|
|
6
|
-
*/
|
|
7
|
-
declare function defaultGetMessageFallback(props: {
|
|
8
|
-
error: IntlError;
|
|
9
|
-
key: string;
|
|
10
|
-
namespace?: string;
|
|
11
|
-
}): string;
|
|
12
|
-
declare function defaultOnError(error: IntlError): void;
|
|
13
|
-
|
|
14
|
-
export { defaultGetMessageFallback, defaultOnError };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/defaults.tsx"],"sourcesContent":["import IntlError from './IntlError';\n\n/**\n * Contains defaults that are used for all entry points into the core.\n * See also `InitializedIntlConfiguration`.\n */\n\nexport function defaultGetMessageFallback(props: {\n error: IntlError;\n key: string;\n namespace?: string;\n}) {\n return [props.namespace, props.key].filter((part) => part != null).join('.');\n}\n\nexport function defaultOnError(error: IntlError) {\n console.error(error);\n}\n"],"mappings":"AAOO,SAASA,EAA0BC,EAIvC,CACD,MAAO,CAACA,EAAM,UAAWA,EAAM,GAAG,EAAE,OAAQC,GAASA,GAAQ,IAAI,EAAE,KAAK,GAAG,CAC7E,CAEO,SAASC,EAAeC,EAAkB,CAC/C,QAAQ,MAAMA,CAAK,CACrB","names":["defaultGetMessageFallback","props","part","defaultOnError","error"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export { default as AbstractIntlMessages } from './AbstractIntlMessages.mjs';
|
|
2
|
-
export { RichTranslationValues, default as TranslationValues } from './TranslationValues.mjs';
|
|
3
|
-
export { default as Formats } from './Formats.mjs';
|
|
4
|
-
export { default as DateTimeFormatOptions } from './DateTimeFormatOptions.mjs';
|
|
5
|
-
export { NumberFormatOptions } from '@formatjs/ecma402-abstract/types/number';
|
|
6
|
-
export { default as IntlError, IntlErrorCode } from './IntlError.mjs';
|
|
7
|
-
export { default as createTranslator } from './createTranslator.mjs';
|
|
8
|
-
export { default as createFormatter } from './createFormatter.mjs';
|
|
9
|
-
export { default as createIntl } from './createIntl.mjs';
|
|
10
|
-
import 'react';
|
|
11
|
-
import './TimeZone.mjs';
|
|
12
|
-
import './IntlConfig.mjs';
|
|
13
|
-
import './createTranslatorImpl.mjs';
|
|
14
|
-
import './utils/MessageKeys.mjs';
|
|
15
|
-
import './utils/NestedValueOf.mjs';
|
|
16
|
-
import './utils/NestedKeyOf.mjs';
|
|
17
|
-
import './utils/NamespaceKeys.mjs';
|
package/dist/src/core/index.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{default as e,IntlErrorCode as r}from"./IntlError";import{default as s}from"./createTranslator";import{default as m}from"./createFormatter";import{default as p}from"./createIntl";export{e as IntlError,r as IntlErrorCode,m as createFormatter,p as createIntl,s as createTranslator};
|
|
2
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/index.tsx"],"sourcesContent":["export type {default as AbstractIntlMessages} from './AbstractIntlMessages';\nexport type {\n default as TranslationValues,\n RichTranslationValues\n} from './TranslationValues';\nexport type {default as Formats} from './Formats';\nexport type {default as DateTimeFormatOptions} from './DateTimeFormatOptions';\nexport type {default as NumberFormatOptions} from './NumberFormatOptions';\nexport {default as IntlError, IntlErrorCode} from './IntlError';\nexport {default as createTranslator} from './createTranslator';\nexport {default as createFormatter} from './createFormatter';\n\n// TODO: Remove in next major version\nexport {default as createIntl} from './createIntl';\n"],"mappings":"AAQA,OAAmB,WAAXA,EAAsB,iBAAAC,MAAoB,cAClD,OAAmB,WAAXD,MAAkC,qBAC1C,OAAmB,WAAXA,MAAiC,oBAGzC,OAAmB,WAAXA,MAA4B","names":["default","IntlErrorCode"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* For the strictly typed messages to work we have to wrap the namespace into
|
|
3
|
-
* a mandatory prefix. See https://stackoverflow.com/a/71529575/343045
|
|
4
|
-
*/
|
|
5
|
-
declare function resolveNamespace(namespace: string, namespacePrefix: string): string | undefined;
|
|
6
|
-
|
|
7
|
-
export { resolveNamespace as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/resolveNamespace.tsx"],"sourcesContent":["/**\n * For the strictly typed messages to work we have to wrap the namespace into\n * a mandatory prefix. See https://stackoverflow.com/a/71529575/343045\n */\nexport default function resolveNamespace(\n namespace: string,\n namespacePrefix: string\n) {\n return namespace === namespacePrefix\n ? undefined\n : namespace.slice((namespacePrefix + '.').length);\n}\n"],"mappings":"AAIe,SAARA,EACLC,EACAC,EACA,CACA,OAAOD,IAAcC,EACjB,OACAD,EAAU,OAAOC,EAAkB,KAAK,MAAM,CACpD","names":["resolveNamespace","namespace","namespacePrefix"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=MessageKeys.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=NamespaceKeys.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=NestedKeyOf.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
type NestedValueOf<ObjectType, Property extends string> = Property extends `${infer Key}.${infer Rest}` ? Key extends keyof ObjectType ? NestedValueOf<ObjectType[Key], Rest> : never : Property extends keyof ObjectType ? ObjectType[Property] : never;
|
|
2
|
-
|
|
3
|
-
export { NestedValueOf as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=NestedValueOf.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import a,{IntlErrorCode as c}from"./IntlError";function i(n,t,e){Object.entries(n).forEach(([r,s])=>{if(r.includes(".")){let o=r;e&&(o+=` (at ${e})`),t.push(o)}s!=null&&typeof s=="object"&&i(s,t,[e,r].filter(o=>o!=null).join("."))})}function l(n,t){const e=[];i(n,e),e.length>0&&t(new a(c.INVALID_KEY,process.env.NODE_ENV!=="production"?`Namespace keys can not contain the character "." as this is used to express nesting. Please remove it or replace it with another character.
|
|
2
|
-
|
|
3
|
-
Invalid ${e.length===1?"key":"keys"}: ${e.join(", ")}
|
|
4
|
-
|
|
5
|
-
If you're migrating from a flat structure, you can convert your messages as follows:
|
|
6
|
-
|
|
7
|
-
import {set} from "lodash";
|
|
8
|
-
|
|
9
|
-
const input = {
|
|
10
|
-
"one.one": "1.1",
|
|
11
|
-
"one.two": "1.2",
|
|
12
|
-
"two.one.one": "2.1.1"
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const output = Object.entries(input).reduce(
|
|
16
|
-
(acc, [key, value]) => set(acc, key, value),
|
|
17
|
-
{}
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
// Output:
|
|
21
|
-
//
|
|
22
|
-
// {
|
|
23
|
-
// "one": {
|
|
24
|
-
// "one": "1.1",
|
|
25
|
-
// "two": "1.2"
|
|
26
|
-
// },
|
|
27
|
-
// "two": {
|
|
28
|
-
// "one": {
|
|
29
|
-
// "one": "2.1.1"
|
|
30
|
-
// }
|
|
31
|
-
// }
|
|
32
|
-
// }
|
|
33
|
-
`:void 0))}export{l as default};
|
|
34
|
-
//# sourceMappingURL=validateMessages.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/validateMessages.tsx"],"sourcesContent":["import AbstractIntlMessages from './AbstractIntlMessages';\nimport IntlError, {IntlErrorCode} from './IntlError';\n\nfunction validateMessagesSegment(\n messages: AbstractIntlMessages,\n invalidKeyLabels: Array<string>,\n parentPath?: string\n) {\n Object.entries(messages).forEach(([key, messageOrMessages]) => {\n if (key.includes('.')) {\n let keyLabel = key;\n if (parentPath) keyLabel += ` (at ${parentPath})`;\n invalidKeyLabels.push(keyLabel);\n }\n\n if (messageOrMessages != null && typeof messageOrMessages === 'object') {\n validateMessagesSegment(\n messageOrMessages,\n invalidKeyLabels,\n [parentPath, key].filter((part) => part != null).join('.')\n );\n }\n });\n}\n\nexport default function validateMessages(\n messages: AbstractIntlMessages,\n onError: (error: IntlError) => void\n) {\n const invalidKeyLabels: Array<string> = [];\n validateMessagesSegment(messages, invalidKeyLabels);\n\n if (invalidKeyLabels.length > 0) {\n onError(\n new IntlError(\n IntlErrorCode.INVALID_KEY,\n process.env.NODE_ENV !== 'production'\n ? `Namespace keys can not contain the character \".\" as this is used to express nesting. Please remove it or replace it with another character.\n\nInvalid ${\n invalidKeyLabels.length === 1 ? 'key' : 'keys'\n }: ${invalidKeyLabels.join(', ')}\n\nIf you're migrating from a flat structure, you can convert your messages as follows:\n\nimport {set} from \"lodash\";\n\nconst input = {\n \"one.one\": \"1.1\",\n \"one.two\": \"1.2\",\n \"two.one.one\": \"2.1.1\"\n};\n\nconst output = Object.entries(input).reduce(\n (acc, [key, value]) => set(acc, key, value),\n {}\n);\n\n// Output:\n//\n// {\n// \"one\": {\n// \"one\": \"1.1\",\n// \"two\": \"1.2\"\n// },\n// \"two\": {\n// \"one\": {\n// \"one\": \"2.1.1\"\n// }\n// }\n// }\n`\n : undefined\n )\n );\n }\n}\n"],"mappings":"AACA,OAAOA,GAAY,iBAAAC,MAAoB,cAEvC,SAASC,EACPC,EACAC,EACAC,EACA,CACA,OAAO,QAAQF,CAAQ,EAAE,QAAQ,CAAC,CAACG,EAAKC,CAAiB,IAAM,CAC7D,GAAID,EAAI,SAAS,GAAG,EAAG,CACrB,IAAIE,EAAWF,EACXD,IAAYG,GAAY,QAAQH,CAAU,KAC9CD,EAAiB,KAAKI,CAAQ,CAChC,CAEID,GAAqB,MAAQ,OAAOA,GAAsB,UAC5DL,EACEK,EACAH,EACA,CAACC,EAAYC,CAAG,EAAE,OAAQG,GAASA,GAAQ,IAAI,EAAE,KAAK,GAAG,CAC3D,CAEJ,CAAC,CACH,CAEe,SAARC,EACLP,EACAQ,EACA,CACA,MAAMP,EAAkC,CAAC,EACzCF,EAAwBC,EAAUC,CAAgB,EAE9CA,EAAiB,OAAS,GAC5BO,EACE,IAAIX,EACFC,EAAc,YACd,QAAQ,IAAI,WAAa,aACrB;AAAA;AAAA,UAGEG,EAAiB,SAAW,EAAI,MAAQ,MAC1C,KAAKA,EAAiB,KAAK,IAAI,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA+BhC,MACN,CACF,CAEJ","names":["IntlError","IntlErrorCode","validateMessagesSegment","messages","invalidKeyLabels","parentPath","key","messageOrMessages","keyLabel","part","validateMessages","onError"]}
|
package/dist/src/index.d.mts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export { default as AbstractIntlMessages } from './core/AbstractIntlMessages.mjs';
|
|
2
|
-
export { RichTranslationValues, default as TranslationValues } from './core/TranslationValues.mjs';
|
|
3
|
-
export { default as Formats } from './core/Formats.mjs';
|
|
4
|
-
export { default as DateTimeFormatOptions } from './core/DateTimeFormatOptions.mjs';
|
|
5
|
-
export { NumberFormatOptions } from '@formatjs/ecma402-abstract/types/number';
|
|
6
|
-
export { default as IntlError, IntlErrorCode } from './core/IntlError.mjs';
|
|
7
|
-
export { default as createTranslator } from './core/createTranslator.mjs';
|
|
8
|
-
export { default as createFormatter } from './core/createFormatter.mjs';
|
|
9
|
-
export { default as createIntl } from './core/createIntl.mjs';
|
|
10
|
-
export { default as IntlProvider } from './react/IntlProvider.mjs';
|
|
11
|
-
export { default as useTranslations } from './react/useTranslations.mjs';
|
|
12
|
-
export { default as useLocale } from './react/useLocale.mjs';
|
|
13
|
-
export { default as useNow } from './react/useNow.mjs';
|
|
14
|
-
export { default as useTimeZone } from './react/useTimeZone.mjs';
|
|
15
|
-
export { default as useMessages } from './react/useMessages.mjs';
|
|
16
|
-
export { default as useFormatter } from './react/useFormatter.mjs';
|
|
17
|
-
export { default as useIntl } from './react/useIntl.mjs';
|
|
18
|
-
import 'react';
|
|
19
|
-
import './core/TimeZone.mjs';
|
|
20
|
-
import './core/IntlConfig.mjs';
|
|
21
|
-
import './core/createTranslatorImpl.mjs';
|
|
22
|
-
import './core/utils/MessageKeys.mjs';
|
|
23
|
-
import './core/utils/NestedValueOf.mjs';
|
|
24
|
-
import './core/utils/NestedKeyOf.mjs';
|
|
25
|
-
import './core/utils/NamespaceKeys.mjs';
|
package/dist/src/index.mjs
DELETED
package/dist/src/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.tsx"],"sourcesContent":["export * from './core';\nexport * from './react';\n"],"mappings":"AAAA,WAAc,SACd,WAAc","names":[]}
|