@generaltranslation/react-core 12.0.0-samsara.1 → 12.0.0-samsara.11
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/CHANGELOG.md +417 -0
- package/dist/compat/CompatStore.cjs +2 -0
- package/dist/compat/CompatStore.cjs.map +1 -0
- package/dist/compat/CompatStore.d.ts +26 -0
- package/dist/compat/CompatStore.d.ts.map +1 -0
- package/dist/compat/CompatStore.mjs +2 -0
- package/dist/compat/CompatStore.mjs.map +1 -0
- package/dist/compat/DictionaryContext.cjs +2 -0
- package/dist/compat/DictionaryContext.cjs.map +1 -0
- package/dist/compat/DictionaryContext.mjs +2 -0
- package/dist/compat/DictionaryContext.mjs.map +1 -0
- package/dist/compat/DictionaryProvider.cjs +2 -0
- package/dist/compat/DictionaryProvider.cjs.map +1 -0
- package/dist/compat/DictionaryProvider.d.ts +29 -0
- package/dist/compat/DictionaryProvider.d.ts.map +1 -0
- package/dist/compat/DictionaryProvider.mjs +2 -0
- package/dist/compat/DictionaryProvider.mjs.map +1 -0
- package/dist/compat/dictionaries.cjs +2 -0
- package/dist/compat/dictionaries.cjs.map +1 -0
- package/dist/compat/dictionaries.mjs +2 -0
- package/dist/compat/dictionaries.mjs.map +1 -0
- package/dist/compat/missing-dictionary.cjs +2 -0
- package/dist/compat/missing-dictionary.cjs.map +1 -0
- package/dist/compat/missing-dictionary.mjs +2 -0
- package/dist/compat/missing-dictionary.mjs.map +1 -0
- package/dist/compat/types.d.ts +15 -0
- package/dist/compat/types.d.ts.map +1 -0
- package/dist/compat/useTrackedDictionaryObjResolver.cjs +2 -0
- package/dist/compat/useTrackedDictionaryObjResolver.cjs.map +1 -0
- package/dist/compat/useTrackedDictionaryObjResolver.mjs +2 -0
- package/dist/compat/useTrackedDictionaryObjResolver.mjs.map +1 -0
- package/dist/compat/useTrackedDictionaryResolver.cjs +2 -0
- package/dist/compat/useTrackedDictionaryResolver.cjs.map +1 -0
- package/dist/compat/useTrackedDictionaryResolver.mjs +2 -0
- package/dist/compat/useTrackedDictionaryResolver.mjs.map +1 -0
- package/dist/compat/useTranslations.cjs +2 -0
- package/dist/compat/useTranslations.cjs.map +1 -0
- package/dist/compat/useTranslations.d.ts +7 -0
- package/dist/compat/useTranslations.d.ts.map +1 -0
- package/dist/compat/useTranslations.mjs +2 -0
- package/dist/compat/useTranslations.mjs.map +1 -0
- package/dist/compat.cjs +1 -0
- package/dist/compat.d.mts +1 -0
- package/dist/compat.d.ts +4 -0
- package/dist/compat.mjs +1 -0
- package/dist/components/branches/Branch.cjs +1 -1
- package/dist/components/branches/Branch.cjs.map +1 -1
- package/dist/components/branches/Branch.d.ts +25 -11
- package/dist/components/branches/Branch.d.ts.map +1 -1
- package/dist/components/branches/Branch.mjs +1 -1
- package/dist/components/branches/Branch.mjs.map +1 -1
- package/dist/components/branches/Plural.cjs +1 -1
- package/dist/components/branches/Plural.cjs.map +1 -1
- package/dist/components/branches/Plural.d.ts +1 -5
- package/dist/components/branches/Plural.d.ts.map +1 -1
- package/dist/components/branches/Plural.mjs +1 -1
- package/dist/components/branches/Plural.mjs.map +1 -1
- package/dist/components/branches/Plural.shared.cjs +1 -1
- package/dist/components/branches/Plural.shared.cjs.map +1 -1
- package/dist/components/branches/Plural.shared.d.ts +5 -8
- package/dist/components/branches/Plural.shared.d.ts.map +1 -1
- package/dist/components/branches/Plural.shared.mjs +1 -1
- package/dist/components/branches/Plural.shared.mjs.map +1 -1
- package/dist/components/helpers/InternalLocaleSelector.cjs +1 -1
- package/dist/components/helpers/InternalLocaleSelector.cjs.map +1 -1
- package/dist/components/helpers/InternalLocaleSelector.d.ts +1 -6
- package/dist/components/helpers/InternalLocaleSelector.d.ts.map +1 -1
- package/dist/components/helpers/InternalLocaleSelector.mjs +1 -1
- package/dist/components/helpers/InternalLocaleSelector.mjs.map +1 -1
- package/dist/components/translation/T.cjs +1 -1
- package/dist/components/translation/T.cjs.map +1 -1
- package/dist/components/translation/T.mjs +1 -1
- package/dist/components/translation/T.mjs.map +1 -1
- package/dist/components/translation/T.rsc.cjs +1 -1
- package/dist/components/translation/T.rsc.cjs.map +1 -1
- package/dist/components/translation/T.rsc.mjs +1 -1
- package/dist/components/translation/T.rsc.mjs.map +1 -1
- package/dist/components/translation/Tx.rsc.cjs +1 -1
- package/dist/components/translation/Tx.rsc.cjs.map +1 -1
- package/dist/components/translation/Tx.rsc.mjs +1 -1
- package/dist/components/translation/Tx.rsc.mjs.map +1 -1
- package/dist/components/variables/Currency.cjs +1 -1
- package/dist/components/variables/Currency.cjs.map +1 -1
- package/dist/components/variables/Currency.d.ts +1 -5
- package/dist/components/variables/Currency.d.ts.map +1 -1
- package/dist/components/variables/Currency.mjs +1 -1
- package/dist/components/variables/Currency.mjs.map +1 -1
- package/dist/components/variables/Currency.shared.cjs +1 -1
- package/dist/components/variables/Currency.shared.cjs.map +1 -1
- package/dist/components/variables/Currency.shared.d.ts +2 -5
- package/dist/components/variables/Currency.shared.d.ts.map +1 -1
- package/dist/components/variables/Currency.shared.mjs +1 -1
- package/dist/components/variables/Currency.shared.mjs.map +1 -1
- package/dist/components/variables/DateTime.cjs +1 -1
- package/dist/components/variables/DateTime.cjs.map +1 -1
- package/dist/components/variables/DateTime.d.ts +1 -5
- package/dist/components/variables/DateTime.d.ts.map +1 -1
- package/dist/components/variables/DateTime.mjs +1 -1
- package/dist/components/variables/DateTime.mjs.map +1 -1
- package/dist/components/variables/DateTime.shared.cjs +1 -1
- package/dist/components/variables/DateTime.shared.cjs.map +1 -1
- package/dist/components/variables/DateTime.shared.d.ts +1 -4
- package/dist/components/variables/DateTime.shared.d.ts.map +1 -1
- package/dist/components/variables/DateTime.shared.mjs +1 -1
- package/dist/components/variables/DateTime.shared.mjs.map +1 -1
- package/dist/components/variables/N.cjs +2 -0
- package/dist/components/variables/N.cjs.map +1 -0
- package/dist/components/variables/N.d.ts +16 -0
- package/dist/components/variables/N.d.ts.map +1 -0
- package/dist/components/variables/N.mjs +2 -0
- package/dist/components/variables/N.mjs.map +1 -0
- package/dist/components/variables/N.rsc.cjs +2 -0
- package/dist/components/variables/N.rsc.cjs.map +1 -0
- package/dist/components/variables/N.rsc.d.ts +13 -0
- package/dist/components/variables/N.rsc.d.ts.map +1 -0
- package/dist/components/variables/N.rsc.mjs +2 -0
- package/dist/components/variables/N.rsc.mjs.map +1 -0
- package/dist/components/variables/N.shared.d.ts +11 -0
- package/dist/components/variables/N.shared.d.ts.map +1 -0
- package/dist/components/variables/Num.cjs +1 -1
- package/dist/components/variables/Num.cjs.map +1 -1
- package/dist/components/variables/Num.d.ts +1 -5
- package/dist/components/variables/Num.d.ts.map +1 -1
- package/dist/components/variables/Num.mjs +1 -1
- package/dist/components/variables/Num.mjs.map +1 -1
- package/dist/components/variables/Num.shared.cjs +1 -1
- package/dist/components/variables/Num.shared.cjs.map +1 -1
- package/dist/components/variables/Num.shared.d.ts +1 -4
- package/dist/components/variables/Num.shared.d.ts.map +1 -1
- package/dist/components/variables/Num.shared.mjs +1 -1
- package/dist/components/variables/Num.shared.mjs.map +1 -1
- package/dist/components/variables/RelativeTime.cjs +1 -1
- package/dist/components/variables/RelativeTime.cjs.map +1 -1
- package/dist/components/variables/RelativeTime.d.ts +1 -5
- package/dist/components/variables/RelativeTime.d.ts.map +1 -1
- package/dist/components/variables/RelativeTime.mjs +1 -1
- package/dist/components/variables/RelativeTime.mjs.map +1 -1
- package/dist/components/variables/RelativeTime.shared.cjs +1 -1
- package/dist/components/variables/RelativeTime.shared.cjs.map +1 -1
- package/dist/components/variables/RelativeTime.shared.d.ts +0 -4
- package/dist/components/variables/RelativeTime.shared.d.ts.map +1 -1
- package/dist/components/variables/RelativeTime.shared.mjs +1 -1
- package/dist/components/variables/RelativeTime.shared.mjs.map +1 -1
- package/dist/components/variables/Var.cjs.map +1 -1
- package/dist/components/variables/Var.d.ts +1 -3
- package/dist/components/variables/Var.d.ts.map +1 -1
- package/dist/components/variables/Var.mjs.map +1 -1
- package/dist/components-rsc.cjs +1 -1
- package/dist/components-rsc.d.ts +6 -15
- package/dist/components-rsc.mjs +1 -1
- package/dist/components.cjs +1 -1
- package/dist/components.d.ts +2 -2
- package/dist/components.mjs +1 -1
- package/dist/condition-store/singleton-operations.cjs +1 -1
- package/dist/condition-store/singleton-operations.cjs.map +1 -1
- package/dist/condition-store/singleton-operations.d.ts +2 -2
- package/dist/condition-store/singleton-operations.d.ts.map +1 -1
- package/dist/condition-store/singleton-operations.mjs +1 -1
- package/dist/condition-store/singleton-operations.mjs.map +1 -1
- package/dist/context/InternalGTProvider.cjs +1 -1
- package/dist/context/InternalGTProvider.cjs.map +1 -1
- package/dist/context/InternalGTProvider.d.ts +6 -13
- package/dist/context/InternalGTProvider.d.ts.map +1 -1
- package/dist/context/InternalGTProvider.mjs +1 -1
- package/dist/context/InternalGTProvider.mjs.map +1 -1
- package/dist/context/context.cjs +1 -1
- package/dist/context/context.cjs.map +1 -1
- package/dist/context/context.mjs +1 -1
- package/dist/context/context.mjs.map +1 -1
- package/dist/functions/helpers/getTranslationsSnapshot.cjs +1 -1
- package/dist/functions/helpers/getTranslationsSnapshot.cjs.map +1 -1
- package/dist/functions/helpers/getTranslationsSnapshot.d.ts +9 -3
- package/dist/functions/helpers/getTranslationsSnapshot.d.ts.map +1 -1
- package/dist/functions/helpers/getTranslationsSnapshot.mjs +1 -1
- package/dist/functions/helpers/getTranslationsSnapshot.mjs.map +1 -1
- package/dist/functions/translation/m.cjs +2 -0
- package/dist/functions/translation/m.cjs.map +1 -0
- package/dist/functions/translation/m.d.ts +17 -0
- package/dist/functions/translation/m.d.ts.map +1 -0
- package/dist/functions/translation/m.mjs +2 -0
- package/dist/functions/translation/m.mjs.map +1 -0
- package/dist/functions/translation/spaOnly.cjs +2 -0
- package/dist/functions/translation/spaOnly.cjs.map +1 -0
- package/dist/functions/translation/spaOnly.mjs +2 -0
- package/dist/functions/translation/spaOnly.mjs.map +1 -0
- package/dist/functions/translation/t.cjs +1 -1
- package/dist/functions/translation/t.cjs.map +1 -1
- package/dist/functions/translation/t.d.ts +8 -26
- package/dist/functions/translation/t.d.ts.map +1 -1
- package/dist/functions/translation/t.mjs +1 -1
- package/dist/functions/translation/t.mjs.map +1 -1
- package/dist/hooks/external-store/useTrackedTranslationResolver.cjs +1 -1
- package/dist/hooks/external-store/useTrackedTranslationResolver.cjs.map +1 -1
- package/dist/hooks/external-store/useTrackedTranslationResolver.mjs +1 -1
- package/dist/hooks/external-store/useTrackedTranslationResolver.mjs.map +1 -1
- package/dist/hooks/external-store.cjs +1 -1
- package/dist/hooks/external-store.cjs.map +1 -1
- package/dist/hooks/external-store.mjs +1 -1
- package/dist/hooks/external-store.mjs.map +1 -1
- package/dist/hooks/i18n-config.cjs.map +1 -1
- package/dist/hooks/i18n-config.d.ts +1 -1
- package/dist/hooks/i18n-config.mjs.map +1 -1
- package/dist/hooks/useGT.cjs +1 -1
- package/dist/hooks/useGT.cjs.map +1 -1
- package/dist/hooks/useGT.d.ts +12 -3
- package/dist/hooks/useGT.d.ts.map +1 -1
- package/dist/hooks/useGT.mjs +1 -1
- package/dist/hooks/useGT.mjs.map +1 -1
- package/dist/hooks/useInternalLocaleSelector.cjs.map +1 -1
- package/dist/hooks/useInternalLocaleSelector.d.ts +1 -1
- package/dist/hooks/useInternalLocaleSelector.d.ts.map +1 -1
- package/dist/hooks/useInternalLocaleSelector.mjs.map +1 -1
- package/dist/hooks/useInternalRegionSelector.cjs +1 -1
- package/dist/hooks/useInternalRegionSelector.cjs.map +1 -1
- package/dist/hooks/useInternalRegionSelector.d.ts +3 -5
- package/dist/hooks/useInternalRegionSelector.d.ts.map +1 -1
- package/dist/hooks/useInternalRegionSelector.mjs +1 -1
- package/dist/hooks/useInternalRegionSelector.mjs.map +1 -1
- package/dist/hooks/useMessages.cjs +1 -1
- package/dist/hooks/useMessages.cjs.map +1 -1
- package/dist/hooks/useMessages.d.ts +11 -3
- package/dist/hooks/useMessages.d.ts.map +1 -1
- package/dist/hooks/useMessages.mjs +1 -1
- package/dist/hooks/useMessages.mjs.map +1 -1
- package/dist/hooks/utils/getFormatLocales.cjs +1 -1
- package/dist/hooks/utils/getFormatLocales.cjs.map +1 -1
- package/dist/hooks/utils/getFormatLocales.d.ts +5 -3
- package/dist/hooks/utils/getFormatLocales.d.ts.map +1 -1
- package/dist/hooks/utils/getFormatLocales.mjs +1 -1
- package/dist/hooks/utils/getFormatLocales.mjs.map +1 -1
- package/dist/hooks/utils/getShouldTranslate.cjs +1 -1
- package/dist/hooks/utils/getShouldTranslate.cjs.map +1 -1
- package/dist/hooks/utils/getShouldTranslate.mjs +1 -1
- package/dist/hooks/utils/getShouldTranslate.mjs.map +1 -1
- package/dist/hooks/utils/missing-translation.cjs +1 -1
- package/dist/hooks/utils/missing-translation.cjs.map +1 -1
- package/dist/hooks/utils/missing-translation.d.ts +3 -5
- package/dist/hooks/utils/missing-translation.d.ts.map +1 -1
- package/dist/hooks/utils/missing-translation.mjs +1 -1
- package/dist/hooks/utils/missing-translation.mjs.map +1 -1
- package/dist/hooks/utils.cjs +1 -1
- package/dist/hooks/utils.cjs.map +1 -1
- package/dist/hooks/utils.d.ts +2 -3
- package/dist/hooks/utils.d.ts.map +1 -1
- package/dist/hooks/utils.mjs +1 -1
- package/dist/hooks/utils.mjs.map +1 -1
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.d.ts +1 -2
- package/dist/hooks.mjs +1 -1
- package/dist/i18n-cache/ReactI18nCache.cjs.map +1 -1
- package/dist/i18n-cache/ReactI18nCache.d.ts +2 -3
- package/dist/i18n-cache/ReactI18nCache.d.ts.map +1 -1
- package/dist/i18n-cache/ReactI18nCache.mjs.map +1 -1
- package/dist/i18n-cache/singleton-operations.cjs.map +1 -1
- package/dist/i18n-cache/singleton-operations.d.ts.map +1 -1
- package/dist/i18n-cache/singleton-operations.mjs.map +1 -1
- package/dist/i18n-store/I18nStore.cjs +1 -1
- package/dist/i18n-store/I18nStore.cjs.map +1 -1
- package/dist/i18n-store/I18nStore.d.ts +4 -23
- package/dist/i18n-store/I18nStore.d.ts.map +1 -1
- package/dist/i18n-store/I18nStore.mjs +1 -1
- package/dist/i18n-store/I18nStore.mjs.map +1 -1
- package/dist/i18n-store/singleton-operations.cjs +1 -1
- package/dist/i18n-store/singleton-operations.cjs.map +1 -1
- package/dist/i18n-store/singleton-operations.d.ts.map +1 -1
- package/dist/i18n-store/singleton-operations.mjs +1 -1
- package/dist/i18n-store/singleton-operations.mjs.map +1 -1
- package/dist/i18n-store/storeTypes.d.ts +4 -11
- package/dist/i18n-store/storeTypes.d.ts.map +1 -1
- package/dist/i18n-store/useI18nStore.cjs +1 -1
- package/dist/i18n-store/useI18nStore.cjs.map +1 -1
- package/dist/i18n-store/useI18nStore.mjs +1 -1
- package/dist/i18n-store/useI18nStore.mjs.map +1 -1
- package/dist/i18n-store/utils/runtimeTranslationErrors.cjs +2 -0
- package/dist/i18n-store/utils/runtimeTranslationErrors.cjs.map +1 -0
- package/dist/i18n-store/utils/runtimeTranslationErrors.mjs +2 -0
- package/dist/i18n-store/utils/runtimeTranslationErrors.mjs.map +1 -0
- package/dist/i18n-store/utils/translations.cjs +1 -1
- package/dist/i18n-store/utils/translations.cjs.map +1 -1
- package/dist/i18n-store/utils/translations.mjs +1 -1
- package/dist/i18n-store/utils/translations.mjs.map +1 -1
- package/dist/pure.cjs +1 -1
- package/dist/pure.d.ts +6 -9
- package/dist/pure.mjs +1 -1
- package/dist/setup/i18nConfig.cjs +1 -1
- package/dist/setup/i18nConfig.cjs.map +1 -1
- package/dist/setup/i18nConfig.d.ts +1 -2
- package/dist/setup/i18nConfig.d.ts.map +1 -1
- package/dist/setup/i18nConfig.mjs +1 -1
- package/dist/setup/i18nConfig.mjs.map +1 -1
- package/dist/utils/internal/addGTIdentifier.cjs +1 -1
- package/dist/utils/internal/addGTIdentifier.cjs.map +1 -1
- package/dist/utils/internal/addGTIdentifier.mjs +1 -1
- package/dist/utils/internal/addGTIdentifier.mjs.map +1 -1
- package/dist/utils/internal/removeInjectedT.cjs +1 -1
- package/dist/utils/internal/removeInjectedT.cjs.map +1 -1
- package/dist/utils/internal/removeInjectedT.mjs +1 -1
- package/dist/utils/internal/removeInjectedT.mjs.map +1 -1
- package/dist/utils/internal/writeChildrenAsObjects.cjs +1 -1
- package/dist/utils/internal/writeChildrenAsObjects.cjs.map +1 -1
- package/dist/utils/internal/writeChildrenAsObjects.mjs +1 -1
- package/dist/utils/internal/writeChildrenAsObjects.mjs.map +1 -1
- package/dist/utils/plurals/fillCount.cjs +2 -0
- package/dist/utils/plurals/fillCount.cjs.map +1 -0
- package/dist/utils/plurals/fillCount.mjs +2 -0
- package/dist/utils/plurals/fillCount.mjs.map +1 -0
- package/dist/utils/plurals/getPluralBranch.cjs +1 -1
- package/dist/utils/plurals/getPluralBranch.cjs.map +1 -1
- package/dist/utils/plurals/getPluralBranch.d.ts +3 -6
- package/dist/utils/plurals/getPluralBranch.d.ts.map +1 -1
- package/dist/utils/plurals/getPluralBranch.mjs +1 -1
- package/dist/utils/plurals/getPluralBranch.mjs.map +1 -1
- package/dist/utils/rendering/createRenderPipeline.cjs.map +1 -1
- package/dist/utils/rendering/createRenderPipeline.d.ts.map +1 -1
- package/dist/utils/rendering/createRenderPipeline.mjs.map +1 -1
- package/dist/utils/rendering/createRenderVariable.cjs +1 -1
- package/dist/utils/rendering/createRenderVariable.cjs.map +1 -1
- package/dist/utils/rendering/createRenderVariable.d.ts.map +1 -1
- package/dist/utils/rendering/createRenderVariable.mjs +1 -1
- package/dist/utils/rendering/createRenderVariable.mjs.map +1 -1
- package/dist/utils/rendering/renderDefaultChildren.shared.cjs +1 -1
- package/dist/utils/rendering/renderDefaultChildren.shared.cjs.map +1 -1
- package/dist/utils/rendering/renderDefaultChildren.shared.mjs +1 -1
- package/dist/utils/rendering/renderDefaultChildren.shared.mjs.map +1 -1
- package/dist/utils/rendering/renderPipeline.rsc.cjs +1 -1
- package/dist/utils/rendering/renderPipeline.rsc.cjs.map +1 -1
- package/dist/utils/rendering/renderPipeline.rsc.d.ts.map +1 -1
- package/dist/utils/rendering/renderPipeline.rsc.mjs +1 -1
- package/dist/utils/rendering/renderPipeline.rsc.mjs.map +1 -1
- package/dist/utils/rendering/renderPreparedT.shared.cjs +1 -1
- package/dist/utils/rendering/renderPreparedT.shared.cjs.map +1 -1
- package/dist/utils/rendering/renderPreparedT.shared.d.ts +1 -1
- package/dist/utils/rendering/renderPreparedT.shared.mjs +1 -1
- package/dist/utils/rendering/renderPreparedT.shared.mjs.map +1 -1
- package/dist/utils/rendering/renderTranslatedChildren.shared.cjs +1 -1
- package/dist/utils/rendering/renderTranslatedChildren.shared.cjs.map +1 -1
- package/dist/utils/rendering/renderTranslatedChildren.shared.d.ts +2 -1
- package/dist/utils/rendering/renderTranslatedChildren.shared.d.ts.map +1 -1
- package/dist/utils/rendering/renderTranslatedChildren.shared.mjs +1 -1
- package/dist/utils/rendering/renderTranslatedChildren.shared.mjs.map +1 -1
- package/dist/utils/translation/prepareT.shared.cjs +1 -1
- package/dist/utils/translation/prepareT.shared.cjs.map +1 -1
- package/dist/utils/translation/prepareT.shared.d.ts +6 -6
- package/dist/utils/translation/prepareT.shared.d.ts.map +1 -1
- package/dist/utils/translation/prepareT.shared.mjs +1 -1
- package/dist/utils/translation/prepareT.shared.mjs.map +1 -1
- package/dist/utils/translation/resolveTagHash.cjs +1 -1
- package/dist/utils/translation/resolveTagHash.cjs.map +1 -1
- package/dist/utils/translation/resolveTagHash.mjs +1 -1
- package/dist/utils/translation/resolveTagHash.mjs.map +1 -1
- package/dist/utils/translation/usePrepareT.cjs +1 -1
- package/dist/utils/translation/usePrepareT.cjs.map +1 -1
- package/dist/utils/translation/usePrepareT.mjs +1 -1
- package/dist/utils/translation/usePrepareT.mjs.map +1 -1
- package/dist/utils/types.d.ts +8 -8
- package/dist/utils/types.d.ts.map +1 -1
- package/dist/utils/variables/_getVariableProps.cjs +1 -1
- package/dist/utils/variables/_getVariableProps.cjs.map +1 -1
- package/dist/utils/variables/_getVariableProps.mjs +1 -1
- package/dist/utils/variables/_getVariableProps.mjs.map +1 -1
- package/package.json +9 -9
- package/dist/hooks/external-store/useTrackedDictionaryObjResolver.cjs +0 -2
- package/dist/hooks/external-store/useTrackedDictionaryObjResolver.cjs.map +0 -1
- package/dist/hooks/external-store/useTrackedDictionaryObjResolver.mjs +0 -2
- package/dist/hooks/external-store/useTrackedDictionaryObjResolver.mjs.map +0 -1
- package/dist/hooks/external-store/useTrackedDictionaryResolver.cjs +0 -2
- package/dist/hooks/external-store/useTrackedDictionaryResolver.cjs.map +0 -1
- package/dist/hooks/external-store/useTrackedDictionaryResolver.mjs +0 -2
- package/dist/hooks/external-store/useTrackedDictionaryResolver.mjs.map +0 -1
- package/dist/hooks/external-store/useTrackedTranslationResolver.d.ts +0 -10
- package/dist/hooks/external-store/useTrackedTranslationResolver.d.ts.map +0 -1
- package/dist/hooks/useTranslations.cjs +0 -2
- package/dist/hooks/useTranslations.cjs.map +0 -1
- package/dist/hooks/useTranslations.d.ts +0 -10
- package/dist/hooks/useTranslations.d.ts.map +0 -1
- package/dist/hooks/useTranslations.mjs +0 -2
- package/dist/hooks/useTranslations.mjs.map +0 -1
- package/dist/i18n-store/utils/dictionaries.cjs +0 -2
- package/dist/i18n-store/utils/dictionaries.cjs.map +0 -1
- package/dist/i18n-store/utils/dictionaries.mjs +0 -2
- package/dist/i18n-store/utils/dictionaries.mjs.map +0 -1
- package/dist/setup/cookieNames.d.ts +0 -2
- package/dist/setup/cookieNames.mjs +0 -1
- package/dist/unstable/t.cjs +0 -2
- package/dist/unstable/t.cjs.map +0 -1
- package/dist/unstable/t.d.ts +0 -16
- package/dist/unstable/t.d.ts.map +0 -1
- package/dist/unstable/t.mjs +0 -2
- package/dist/unstable/t.mjs.map +0 -1
- package/dist/unstable/useGT.cjs +0 -2
- package/dist/unstable/useGT.cjs.map +0 -1
- package/dist/unstable/useGT.d.ts +0 -17
- package/dist/unstable/useGT.d.ts.map +0 -1
- package/dist/unstable/useGT.mjs +0 -2
- package/dist/unstable/useGT.mjs.map +0 -1
- package/dist/unstable/useMessages.cjs +0 -2
- package/dist/unstable/useMessages.cjs.map +0 -1
- package/dist/unstable/useMessages.d.ts +0 -16
- package/dist/unstable/useMessages.d.ts.map +0 -1
- package/dist/unstable/useMessages.mjs +0 -2
- package/dist/unstable/useMessages.mjs.map +0 -1
- package/dist/unstable.cjs +0 -1
- package/dist/unstable.d.mts +0 -1
- package/dist/unstable.d.ts +0 -5
- package/dist/unstable.mjs +0 -1
- package/dist/utils/rendering/renderPipeline.cjs +0 -2
- package/dist/utils/rendering/renderPipeline.cjs.map +0 -1
- package/dist/utils/rendering/renderPipeline.mjs +0 -2
- package/dist/utils/rendering/renderPipeline.mjs.map +0 -1
- package/dist/utils/variables/getVariableName.cjs +0 -2
- package/dist/utils/variables/getVariableName.cjs.map +0 -1
- package/dist/utils/variables/getVariableName.mjs +0 -2
- package/dist/utils/variables/getVariableName.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,388 @@
|
|
|
1
1
|
# @generaltranslation/react-core
|
|
2
2
|
|
|
3
|
+
## 12.0.0-samsara.11
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- c8e2b0b: **Breaking:** the tagged-template API is now the message API of the main entries, and the string functions it replaces are removed. `t`, `msg`, `tx`, and the functions that `useGT()`, `getGT()`, `useMessages()` and `getMessages()` return no longer take an ICU string. `<T>` and the other components, the dictionary API under `/compat`, gt-svelte and gt-vue are unchanged.
|
|
8
|
+
|
|
9
|
+
```diff
|
|
10
|
+
const t = useGT(); // or await getGT(), or the t that gt-react exports
|
|
11
|
+
- t('Hello, {name}!', { name });
|
|
12
|
+
+ t`Hello, ${{ name }}!`;
|
|
13
|
+
- t('Save', { $context: 'button', $maxChars: 10 });
|
|
14
|
+
+ t({ context: 'button', maxChars: 10 })`Save`;
|
|
15
|
+
- t('{count, plural, one {# item} other {# items}}', { count });
|
|
16
|
+
+ t`${plural({ count }, { one: part`${n} item`, other: part`${n} items` })}`;
|
|
17
|
+
|
|
18
|
+
- const greeting = msg('Hello, {name}!', { name });
|
|
19
|
+
+ const greeting = msg`Hello, ${{ name }}!`;
|
|
20
|
+
m(greeting); // m from useMessages() or getMessages()
|
|
21
|
+
|
|
22
|
+
- await tx('Hello, {name}!', { name, $context: 'greeting' });
|
|
23
|
+
+ await tx({ context: 'greeting' })`Hello, ${{ name }}!`;
|
|
24
|
+
- await tx(userText);
|
|
25
|
+
+ await tx`${dyn(userText)}`;
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
A tagged template is stored as a message tree, not as an ICU string, and its hash is not the hash of the string it replaces, so every migrated message is translated again. That includes `msg('Save')`, which reads the same as before. Run `gt translate` after migrating.
|
|
29
|
+
|
|
30
|
+
**The functions that keep their name**, on `gt-i18n`, `gt-react`, `gt-react-native`, `gt-next`, `gt-next/server`, `gt-tanstack-start` and `gt-node`, wherever each was exported:
|
|
31
|
+
- `t` and the function from `useGT()` or `getGT()`: `t('Hello, {name}!', { name })` → `` t`Hello, ${{ name }}!` ``. Template text is literal, so `{`, `#` and `'` need no escaping.
|
|
32
|
+
- Options: `$context`, `$maxChars` and `$requiresReview` → `t({ context, maxChars, requiresReview })` before the template. `$id`, `$format`, `$locale` and `$_hash` have no replacement.
|
|
33
|
+
- ICU `plural`, `selectordinal` and `select` arguments → `plural()`, `selectordinal()` and `select()`, with `` part`...` `` for a branch that holds values and `n` for the count. ICU number, date and time arguments → `number()`, `date()` and `time()`. The main entries now export these helpers.
|
|
34
|
+
- `useGT(messages)`, `useMessages(messages)` and `getGT(messages)` → `useGT()`, `useMessages()` and `getGT()`: they take no argument.
|
|
35
|
+
- `msg('Hello, {name}!', { name })` → `` msg`Hello, ${{ name }}!` ``, and `msg('Save', { $context: 'button' })` → `` msg({ context: 'button' })`Save` ``. `msg('Save')` still works. `msg(['Save', 'Cancel'])` → one `msg()` call for each message.
|
|
36
|
+
- `m(message, options)` from `useMessages()` or `getMessages()`, and `mFallback(message, options)` → `m(message, values)` and `mFallback(message, values)`: the second argument holds values only, and a string is rendered as literal text.
|
|
37
|
+
- `tx('Hello', { $context })` from `gt-next/server` or `gt-node` → `` await tx({ context })`Hello` ``. `tx(text)` for text known only at runtime → `` tx`${dyn(text)}` ``, with `dyn` from the same entry. `tx` has no `$locale` option: it translates into the request locale in gt-next, and into the `withGT()` locale in gt-node.
|
|
38
|
+
- `derive` is the tagged-template helper, as in `` t`Welcome ${derive(status)}!` ``: its argument is typed as a string literal or a union of them, and it returns a placeholder, not its argument. It is the only `derive`: `generaltranslation` no longer exports one.
|
|
39
|
+
- `<T context={derive(getFormality())}>` works with it: `<T>` and `<Tx>` read the placeholder as their context, and the CLI extracts one entry for each value, which it finds by following the argument through the code (a call to a function that returns string literals, a `const`, or a conditional of them). TypeScript also checks the argument against `derive`'s type, so a function annotated `: string` needs a narrower return type.
|
|
40
|
+
- `derive()` must be the whole context. `<T context={'tone: ' + derive(getFormality())}>`, a template literal around `derive()`, and `derive()` in one branch of a conditional → `<T context={derive(getTone())}>`, with `getTone()` returning the full text, as in ``return `tone: ${getFormality()}` as const``. The CLI and the compiler report the old forms as errors.
|
|
41
|
+
- `t` and the new `m` from `gt-react` are still exported only under the `browser` condition, for client-rendered (SPA) apps. `gt-next`, `gt-tanstack-start`, `gt-react-native` and `gt-node` export neither.
|
|
42
|
+
|
|
43
|
+
**Removed and moved exports:**
|
|
44
|
+
- `decodeMsg` and `decodeOptions` from `gt-i18n`, `gt-react`, `gt-react-native`, `gt-next`, `gt-tanstack-start` and `gt-node`, and `gtFallback` from all of them but `gt-node`: no replacement. `msg('Save')` returns its text, and any other message from `msg` is a plain object that `m()` or `mFallback()` renders.
|
|
45
|
+
- `declareVar` and `decodeVars` from the same entries and from `generaltranslation`: no replacement. A value in a tagged template is `${value}` or `${{ name }}`, and a `derive()` context has no values: every context is a string the CLI can read.
|
|
46
|
+
- `derive` from `generaltranslation` → `derive` from `gt-i18n`, `gt-react`, `gt-react-native`, `gt-next`, `gt-tanstack-start` or `gt-node`, in a tagged template or as a `<T>` context.
|
|
47
|
+
- The type `StringFormat` from `gt-next` → import it from `generaltranslation`.
|
|
48
|
+
- Types `GTTranslationOptions` and `RuntimeTranslationOptions` from `gt-i18n`, `gt-react`, `gt-react-native`, `gt-next` and `gt-node` → `GTOptions`. Types `GTFunctionType` and `MFunctionType` from `gt-i18n` and `gt-node` → `GT` and `M`.
|
|
49
|
+
- `gt-i18n` also drops the types `TemplateSyncResolutionFunction`, `SyncResolutionFunction`, `SyncResolutionFunctionWithFallback`, `RegisteredMessage` and `LookupOptionsFor`, with no replacement. `TranslationVariables` and `JsxTranslationOptions` → import them from `gt-i18n/internal`.
|
|
50
|
+
- The string `msg`, `decodeOptions` and the types `GTFunctionType`, `MFunctionType`, `GTTranslationOptions`, `EncodedTranslationOptions` and `RegisterableMessages` leave the `gt-i18n` root for `gt-i18n/internal/string`, which still serves gt-svelte, gt-vue and the dictionary API.
|
|
51
|
+
- `gt-i18n/internal`: `getGT()`, `getMessages()` and `tx` are the tagged ones, so `getGT()` → `getGT({ locale, enableI18n })`, and the same for `getMessages`. `getGTInternal`, `getMessagesInternal`, `txInternal`, `GtInternalRuntimeTranslateString` and `extractVariables` are removed. `interpolateMessage` → import it from `gt-i18n/internal/string`.
|
|
52
|
+
- `gt-react` no longer exports `GtInternalRuntimeTranslateString`, which the compiler no longer injects.
|
|
53
|
+
- `@generaltranslation/react-core`: `t` from `/pure`, and `useGT` and `useMessages` from `/hooks`, are the tagged ones. `/pure` adds `m`.
|
|
54
|
+
- `generaltranslation/internal` no longer exports `extractVars` and `condenseVars`.
|
|
55
|
+
|
|
56
|
+
**`gt` (CLI):** `gt translate`, `gt validate` and the other commands that read source extract `t`, `msg` and the functions from `useGT()` and `getGT()` as message trees when they are imported by name from a main entry. They no longer extract a string call such as `t('Hello')` or `msg('Hello, {name}!', { name })`, nor a `t` that is not imported, such as a global. A string call left in the code gets a warning that names it as one. `msg('Save')` is still extracted, as a message tree. In a `<T>` context, the CLI no longer reads `declareVar()`, and it reports a `derive()` it cannot resolve as an error: it used to upload the source text of the expression as the context. The CLI now warns when a main entry is loaded through `require()`, `import()`, a namespace import or a re-export that could carry one of these functions, since it follows only named imports. It no longer warns about `useGT()` in an async function or `getGT()` in a synchronous one. In a gt-svelte project, string calls in JavaScript and TypeScript modules are now extracted by the same rules as in `.svelte` files: an alias of `t` such as `const translate = t`, a `t` passed to a function in another file, and a literal `m('...')` call are no longer followed.
|
|
57
|
+
|
|
58
|
+
**`@generaltranslation/compiler`:**
|
|
59
|
+
- The `enableMacroTransform` and `stringTranslationMacro` options are removed, with no replacement: the compiler no longer rewrites `` t`...` `` into a string call, and no longer adds an import for a `t` that has none. Import `t` from `gt-react`.
|
|
60
|
+
- It no longer hashes string calls, passes the collected messages to `useGT()` and `getGT()`, or translates strings in dev hot reload. With `compileTimeHash`, it injects `$_hash` into the tagged templates of `t`, `msg`, `useGT()` and `getGT()` imported from a main entry.
|
|
61
|
+
- `autoderive` and `devHotReload` apply to JSX only: `autoderive` is a boolean and `devHotReload` is `{ jsx: true }`, in the plugin options and in `gt.config.json` (below).
|
|
62
|
+
- The `context` of a `<T>` is a string literal or one `derive()` call with one argument. The argument no longer has to be a call: `derive(tone)` and `derive(formal ? 'formal' : 'casual')` are accepted.
|
|
63
|
+
- gt-next's SWC plugin (`experimentalCompilerOptions.type: 'swc'`) handles `<T>` only. It leaves tagged templates as they are, and the runtime hashes them.
|
|
64
|
+
|
|
65
|
+
**`gt.config.json`:** `files.gt.parsingFlags.autoderive` takes `true` or `false`, and `files.gt.parsingFlags.devHotReload` takes `{ "jsx": true }` or `{ "jsx": false }`. The forms that only configured string messages are removed, and a config that uses one is invalid: the CLI and gt-next stop with a message such as `files.gt.parsingFlags.devHotReload.strings: Invalid key`, and the compiler warns and builds without the file.
|
|
66
|
+
- `"autoderive": { "jsx": true }` or `{ "jsx": true, "strings": true }` → `"autoderive": true`. `{ "strings": true }` alone → remove the flag.
|
|
67
|
+
- `"devHotReload": { "jsx": true, "strings": true }` → `"devHotReload": { "jsx": true }`.
|
|
68
|
+
- `"devHotReload": true` or `{ "strings": true }` → remove the flag. It only translated new string messages during development, which tagged templates now do at runtime without it.
|
|
69
|
+
- `resolveAutoderive` from `generaltranslation/config-schema` is removed: read `parsingFlags.autoderive`, a boolean.
|
|
70
|
+
|
|
71
|
+
**`@generaltranslation/react-core-linter`:** `static-string` now checks only `msg()`, whose argument must be a single string literal, as in `msg('Save')`. It no longer checks the string passed to the function from `useGT()` or `getGT()`, no longer validates ICU syntax, and has no autofix.
|
|
72
|
+
|
|
73
|
+
**If you used a `samsara` prerelease,** the experimental `/unstable` entries are removed. Everything they exported is on the main entry:
|
|
74
|
+
- `gt-i18n/unstable` → `gt-i18n`, and `gt-i18n/unstable/internal` → `gt-i18n/internal`, without its `tx`: build one with `createTx`.
|
|
75
|
+
- `gt-react/unstable` → `gt-react`. `t` and `m` are exported only under the `browser` condition; `gt-react/unstable` also exported them to Node and worker builds.
|
|
76
|
+
- `gt-react-native/unstable` → `gt-react-native`.
|
|
77
|
+
- `gt-next/unstable` → `gt-next`, and `gt-next/unstable/server` → `gt-next/server`.
|
|
78
|
+
- `gt-tanstack-start/unstable` → `gt-tanstack-start`.
|
|
79
|
+
- `gt-node/unstable` → `gt-node`.
|
|
80
|
+
- `@generaltranslation/react-core/unstable` → `t` and `m` from `@generaltranslation/react-core/pure`, and `useGT` and `useMessages` from `@generaltranslation/react-core/hooks`.
|
|
81
|
+
- `generaltranslation/internal`: `isUnstableGTImportSource` → `isGTMessageImportSource`, `isUnstableGTHelperName` → `isGTMessageHelperName`, `UNSTABLE_GT_HELPER_NAMES` → `GT_MESSAGE_HELPER_NAMES`, and the type `UnstableGTHelperName` → `GTMessageHelperName`.
|
|
82
|
+
- The lint rule `@generaltranslation/react-core-linter/unstable-static-branch` → `@generaltranslation/react-core-linter/static-branch`.
|
|
83
|
+
|
|
84
|
+
### Minor Changes
|
|
85
|
+
|
|
86
|
+
- 7d841de: `<N />` is the count of the `<Plural>` it is in, formatted as a number, as `#` is in ICU.
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
<Plural n={count} one='One file'>
|
|
90
|
+
<N /> files
|
|
91
|
+
</Plural>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Use it instead of `<Num>{count}</Num>` for the count. A translation can then show the count in any branch: English `one` only covers 1, so "One file" has none, but Russian uses `one` for 21 and 31 too and renders "21 файл". `<N />` takes no props. With no `<Plural>` to give it a count, it is an error in development and renders nothing in production.
|
|
95
|
+
|
|
96
|
+
It is stored as a variable of the new type `#`, which the runtime fills from the plural's `n` wherever a translation puts it.
|
|
97
|
+
|
|
98
|
+
### Patch Changes
|
|
99
|
+
|
|
100
|
+
- fcc6f14: The exported `t`, and the one `useGT()` and `getGT()` return, render the precomputed messages `@generaltranslation/compiler` now emits for static templates.
|
|
101
|
+
- e70da5f: The exported `t` renders a precomputed message in the default locale without a cache lookup, reads the locale and the enabled flag once per call, and in the browser matches the locale once per task. `initializeGTSPA()` waits for the locale's translations without copying them out of the cache.
|
|
102
|
+
- Updated dependencies [622199e]
|
|
103
|
+
- Updated dependencies [fcc6f14]
|
|
104
|
+
- Updated dependencies [3bedb87]
|
|
105
|
+
- Updated dependencies [7d841de]
|
|
106
|
+
- Updated dependencies [c8e2b0b]
|
|
107
|
+
- Updated dependencies [e70da5f]
|
|
108
|
+
- @generaltranslation/format@1.0.0-samsara.11
|
|
109
|
+
- gt-i18n@2.0.0-samsara.11
|
|
110
|
+
- generaltranslation@10.0.0-samsara.11
|
|
111
|
+
|
|
112
|
+
## 12.0.0-samsara.10
|
|
113
|
+
|
|
114
|
+
### Major Changes
|
|
115
|
+
|
|
116
|
+
- cdee423: `<Num>`, `<Currency>`, `<DateTime>`, `<RelativeTime>`, `<Plural>` and translated `<T>` content format in the locale they render in, alone. The default locale is no longer tried behind it when `Intl` has no data for that locale, which then formats in the browser's or the host's locale.
|
|
117
|
+
|
|
118
|
+
The `locales` prop reaches `Intl` as it is given: the active locale and the default locale are no longer added after it. To keep a fallback, list it: `<Num locales={[locale, defaultLocale]}>`.
|
|
119
|
+
|
|
120
|
+
- 5cb51b4: **Breaking:** `<Plural>` and `<Branch>` now choose a branch the way `plural()` and `select()` do, in React, Vue and Svelte.
|
|
121
|
+
- **ICU plural selection.** `<Plural>` picks an exact branch first, then the locale's plural category for `n`, then its children. `zero`, `one` and `two` are plural categories, no longer the numbers 0, 1 and 2: in English `zero` never matches, and in Japanese neither does `one`. For an exact number write `_0`, `_1` and so on, the JSX spelling of ICU's `=0`: `<Plural n={count} _0="No items" one="1 item">Many items</Plural>`. Stored content and translations use the ICU key, `=0`.
|
|
122
|
+
- **No aliases.** The `singular`, `plural` and `dual` branches are removed: write `one`, the children and `two`. `PluralType` from `generaltranslation` no longer includes them.
|
|
123
|
+
- **The children are the fallback, and `other` is not a prop.** The children of a `<Plural>` or a `<Branch>` are what `other` is in `plural()` and `select()`: the content for a value with no branch of its own. In Vue that is the default slot. `<Plural other="...">` no longer works, and `<Branch other="...">`, which used to match only the value `"other"`, no longer does: write the content as the children. `gt`, the compiler and the Vue and Svelte extractors report an `other` prop, slot or snippet as an error. Stored content and translations hold the children under the ICU key `other`, with the other branches. `gt` and the compiler also warn about a `<Plural>` prop that looks like an exact number but is not one, such as `_01` or `_1e3`.
|
|
124
|
+
- **Stricter props.** `<Plural>` requires children, takes `n` as a `number` or a `bigint`, and no longer has a `locales` prop, so in Vue a `locales` attribute is a branch like any other. `<Branch>` requires children unless its branches cover every value of `branch`, as in `<Branch branch={isAdmin} true="Admin" false="Member" />`. `_locale` and `_enableI18n` are no longer in the prop types of `<Plural>` and `<Branch>`. `gt-react` exports the `BranchProps` type beside `PluralProps`.
|
|
125
|
+
- **The translation picks the branch.** In a translated locale, the branch is chosen among the translation's branches, and the source branch of the same name fills in its variables and elements; when the source has no branch of that name, its children do. A source `_0` branch no longer renders untranslated in a locale whose translation has no `=0` branch. A translation with no branch for the value renders the source: that element in React and Vue, the whole `<T>` in Svelte.
|
|
126
|
+
- **Errors.** In React, an `n` that is not a number or a bigint, and a value with no branch and no children, throw in development. In production they log an error; a non-numeric `n` renders the children, and a missing branch renders nothing. Children that are empty, such as `{null}`, are a fallback that renders nothing. A `bigint` too large to have a plural category throws a `RangeError` unless an exact branch matches it, as in `plural()`. In Svelte, a branch passed as `undefined` counts as absent, as in React.
|
|
127
|
+
- **Synchronous `<Branch>` in gt-next.** In a Server Component, gt-next's `<Branch>` is now gt-react's component and no longer an async wrapper around it: choosing a branch never needed the request's locale.
|
|
128
|
+
|
|
129
|
+
A `<T>` with a `<Plural>` or a `<Branch>` has new source content, so its hash changes and it is translated again: the children are stored as the `other` branch, and the elements and unnamed variables after them are numbered from the component, not from its children. `gt`, the compiler, the gt-next SWC plugin and the Vue and Svelte extractors all read the new props, so update them together with the runtime packages.
|
|
130
|
+
|
|
131
|
+
The `static-jsx` lint rule's fix writes `{x && "Active"}` as `<Branch branch={!!x} true="Active">{null}</Branch>`, since a `false` value needs a fallback, and a `null` alternative of a ternary the same way. A string that JSX text would not read back as written, such as `"&"` or `"a < b"`, is written in braces.
|
|
132
|
+
|
|
133
|
+
- c0f8d3d: **Breaking:** a variable in the content of a `<T>` is found by its id, and has a name only when its author gave it one. A variable component without a `name` used to get a generated one, such as `_gt_cost_2`.
|
|
134
|
+
|
|
135
|
+
```diff
|
|
136
|
+
- { "i": 2, "k": "_gt_cost_2", "v": "c" } // <Currency>
|
|
137
|
+
+ { "i": 2, "v": "c" }
|
|
138
|
+
|
|
139
|
+
{ "i": 3, "k": "price", "v": "c" } // <Currency name="price">, unchanged
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
- `i` identifies a variable among its siblings, as it does an element. The runtimes match a translated variable to its value by `i`, so two variables with the same `name` no longer render the same value.
|
|
143
|
+
- `v`, the type, is always there, and is how a variable is told from an element. `Variable` in `@generaltranslation/format` is now `{ i: number; v: VariableType; k?: string }`.
|
|
144
|
+
- `k` is only a label for translators. An empty `name` counts as none, in every runtime and extractor.
|
|
145
|
+
- `hashSource` hashes a variable by its `v` and, when it has one, its `k`.
|
|
146
|
+
|
|
147
|
+
Every `<T>` that holds a `<Var>`, `<Num>`, `<Currency>`, `<DateTime>` or `<RelativeTime>` without a `name` gets a new hash. The runtimes, `gt`, the compiler, the Next.js SWC plugin and the Vue and Svelte extractors all write the new form, so upgrade them together, then run `gt translate` again. Translations stored under the old hashes are no longer found, and a translated variable needs its `i`: local translation files need their keys and variables updated or regenerated. A `<T>` whose variables all have a `name`, or that has no variables, keeps its hash.
|
|
148
|
+
|
|
149
|
+
gt-svelte's `_gtm` metadata no longer lists variable names.
|
|
150
|
+
|
|
151
|
+
- b078069: The variable components `<Num>`, `<Currency>`, `<DateTime>` and `<RelativeTime>` take the same values and format the same way as `number()`, `date()` and `time()` in a `` t`…` `` message. In gt-vue and gt-svelte the value is the `value` prop where gt-react takes children.
|
|
152
|
+
- `<Currency>` requires `currency`; it no longer defaults to `USD`: `<Currency>{price}</Currency>` → `<Currency currency="USD">{price}</Currency>`.
|
|
153
|
+
- `<Num>` and `<Currency>` take a `number` or a `bigint`, not a string: `<Num>1000</Num>` → `<Num>{1000}</Num>`, `<Num>{text}</Num>` → `<Num>{Number(text)}</Num>`. gt-vue no longer renders text that is not a number as it is.
|
|
154
|
+
- `<DateTime>` takes a `Date` or a timestamp, not a string: in gt-vue, `<DateTime value="2024-01-01" />` → `<DateTime :value="new Date('2024-01-01')" />`.
|
|
155
|
+
- `<DateTime>` without a style or a date or time field in `options` formats in the medium date style, like `date(value)`: `Mar 14, 2024`, not `3/14/2024`. For the old output, pass `options={{ year: 'numeric', month: 'numeric', day: 'numeric' }}`.
|
|
156
|
+
- `<DateTime>` keeps the direction marks of the formatted date, which it removed. The Arabic `14/3/2024` holds two right-to-left marks that keep its parts in order inside left-to-right text.
|
|
157
|
+
- `<RelativeTime>` takes the date as children, like `<DateTime>`, and no longer has the `date` prop: `<RelativeTime date={date} />` → `<RelativeTime>{date}</RelativeTime>`. A count still takes `value` and `unit`.
|
|
158
|
+
- The `currency` prop of `<Currency>` wins over `options.currency`.
|
|
159
|
+
- The `locales` prop is removed from `<Num>`, `<Currency>`, `<DateTime>`, `<RelativeTime>` and gt-react's `<Plural>`. They format in the current locale, then the default locale. To format in another locale, call a formatter: `<Num locales={['de']}>{n}</Num>` → `{formatNum(n, { locales: ['de'] })}` with `formatNum` from `generaltranslation`, wrapped in `<Var>` inside a `<T>`.
|
|
160
|
+
- `useFormatLocales()` takes no argument and returns the current locale, then the default locale: `useFormatLocales(['de'])` → `useFormatLocales()`. `getFormatLocales()` from `@generaltranslation/react-core/pure` no longer takes `localesProp`.
|
|
161
|
+
- The prop types `NumProps`, `CurrencyProps`, `DateTimeProps` and `RelativeTimeProps`, and the props of `<Var>`, no longer have the internal `_locale` and `_enableI18n`; the `Resolved…Props` types still do.
|
|
162
|
+
|
|
163
|
+
`formatNum()` and `formatCurrency()` from `generaltranslation` and `@generaltranslation/format` accept a `bigint`, and `formatDateTime()` accepts a timestamp, as do the `GTIntl` methods.
|
|
164
|
+
|
|
165
|
+
- ac272be: `t()` from `@generaltranslation/react-core/pure` and `gt-react` now reports every call outside a client-rendered (SPA) app, not only calls made before GT has a locale: in development it throws, and in production it logs the error and renders the source with its variables. Before, in production it logged a promise to fall back and then threw "Cannot read GT runtime context", and calls after `<GTProvider>` mounted were not reported. `t` from `/unstable` reports the same error. In a server-rendered app, use `useGT()` in components, `getGT()` in loaders and server functions, or `msg()` with `m()` from `useMessages()` or `getMessages()`.
|
|
166
|
+
- 99a2528: Tidy the `<T>` props and the `/unstable` type exports:
|
|
167
|
+
- `<T>` no longer declares or reads the internal props `_locale`, `_enableI18n`, and `_renderPreparedT`; it always renders in the locale from context. The RSC `T` and `Tx` from `@generaltranslation/react-core/components-rsc` still take them, and gt-next passes them there.
|
|
168
|
+
- `gt-i18n/unstable` and the framework `/unstable` entries export the type of a `` part`...` `` value as `Part` instead of `Fragment`, which collided with React's `Fragment`.
|
|
169
|
+
|
|
170
|
+
### Minor Changes
|
|
171
|
+
|
|
172
|
+
- 28a2e47: Add an experimental global `m` to `/unstable` entries, the `useMessages()` counterpart of `t`: ``m(msg`Hello, ${{ name }}!`)`` renders a message from `msg()` with the current locale, without calling a hook. `gt-i18n/unstable` exports an `m` bound to the condition store. `@generaltranslation/react-core/unstable` and `gt-react/unstable` export an `m` that, like `t`, works only in client-rendered (SPA) apps, including at module level. In server-rendered apps, it throws in development and logs an error and renders the source in production; use `useMessages()` or `getMessages()` instead. Server components and `gt-react-native/unstable` do not export it, for the same reasons as `t`.
|
|
173
|
+
|
|
174
|
+
### Patch Changes
|
|
175
|
+
|
|
176
|
+
- 550e8ca: A `<T>` whose props stay the same no longer prepares its children and subscribes to its translation again on every render. In a client-rendered app without a provider, the function `useGT()` returns keeps its identity between renders, so effects that depend on it no longer run after each one.
|
|
177
|
+
- Updated dependencies [2c3f4f6]
|
|
178
|
+
- Updated dependencies [2c3f4f6]
|
|
179
|
+
- Updated dependencies [cdee423]
|
|
180
|
+
- Updated dependencies [c30676f]
|
|
181
|
+
- Updated dependencies [5e95a50]
|
|
182
|
+
- Updated dependencies [cdee423]
|
|
183
|
+
- Updated dependencies [550e8ca]
|
|
184
|
+
- Updated dependencies [550e8ca]
|
|
185
|
+
- Updated dependencies [5cb51b4]
|
|
186
|
+
- Updated dependencies [c0f8d3d]
|
|
187
|
+
- Updated dependencies [b078069]
|
|
188
|
+
- Updated dependencies [7d49a34]
|
|
189
|
+
- Updated dependencies [99a2528]
|
|
190
|
+
- Updated dependencies [28a2e47]
|
|
191
|
+
- generaltranslation@10.0.0-samsara.10
|
|
192
|
+
- @generaltranslation/format@1.0.0-samsara.10
|
|
193
|
+
- gt-i18n@2.0.0-samsara.10
|
|
194
|
+
|
|
195
|
+
## 12.0.0-samsara.9
|
|
196
|
+
|
|
197
|
+
### Major Changes
|
|
198
|
+
|
|
199
|
+
- 016ace7: Remove the `devApiKey` option. One `apiKey` now covers both uses: in development it enables hot reload translation, and in production it lets server code translate at runtime. Pass your key as `apiKey` wherever you passed `devApiKey`, for example `initializeGT({ apiKey })` in gt-node.
|
|
200
|
+
|
|
201
|
+
gt-react ignores an `apiKey` that reaches production browser code and logs a warning, because anyone can read a key from a browser bundle. Translate at runtime on your server instead.
|
|
202
|
+
|
|
203
|
+
- cf7029c: Move the dictionary (key-based) API to `/compat` subpaths. `useTranslations()`, `getTranslations()`, `initializeGTDictionary()` and the `Dictionary*` types now come from `gt-react/compat`, `gt-react-native/compat`, `gt-next/compat` (its export conditions mirror `gt-next`), `gt-next/compat/server` (server-only `getTranslations()`, like `gt-next/server`) and `gt-tanstack-start/compat`. The old exports are removed without stubs, the root `GTProvider` no longer accepts `dictionaries`, `onMissingDictionaryEntry` or `onMissingDictionaryObj`, and `initializeGT()`/`initializeGTSPA()` no longer accept `dictionary` or `loadDictionary`.
|
|
204
|
+
|
|
205
|
+
Each `/compat` entry exports its own `GTProvider`, which takes everything the root `GTProvider` takes plus those dictionary props, so moving the provider changes only its import. `useTranslations()` reads dictionaries only from it and, under the root `GTProvider`, throws an error that names the `/compat` entry. `initializeGTDictionary()` takes `cacheExpiryTime` like `initializeGT()` and no longer inherits it. In gt-next, the App Router `GTProvider` from `gt-next/compat` also loads the request locale's dictionaries and streams them to client components, as `GTProvider` did; in the Pages Router, `withGTServerSideProps()` and `withGTStaticProps()` from `gt-next/compat` add `dictionaries` to page props for it. In gt-tanstack-start, `setupRouterGTIntegration({ router })` from `gt-tanstack-start/compat` also loads the request locale's dictionary before render and hydrates the browser from that snapshot. Dictionary dev hot reload keeps working.
|
|
206
|
+
|
|
207
|
+
Apps that only use the native APIs no longer ship any dictionary code. gt-next requires the `gt-next/internal/_dictionary` and `_load-dictionary` aliases only from `gt-next/compat` modules, and the gt-tanstack-start Vite plugin serves the dictionary from its own `internal/_compat-config` virtual module, so your dictionary file is bundled only when you import a `/compat` entry. The webpack rule that parses gt-next's ESM dist as `javascript/auto` now detects the dist through `internal/_load-translations.mjs`. The `dictionary` and `loadDictionaryPath` options of `withGTConfig()`, `gt.config.json` and the Vite plugin are unchanged. gt-next no longer treats a `[defaultLocale].json` or `[languageCode].json` file (for example `en.json`) as the dictionary; name the file `dictionary.json` or set the `dictionary` option.
|
|
208
|
+
|
|
209
|
+
`@generaltranslation/react-core` keeps the dictionary internals behind `@generaltranslation/react-core/compat`: `InternalGTProvider` no longer accepts `dictionaries` or `onMissingDictionary*`, `internalInitializeGTSRA()` no longer accepts `dictionary` or `loadDictionary`, and the unused legacy `Dictionary` types are removed. The gt-next `GTProvider` type no longer declares the unused `id` prop.
|
|
210
|
+
|
|
211
|
+
Migration:
|
|
212
|
+
|
|
213
|
+
| Before | After |
|
|
214
|
+
| ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
215
|
+
| `import { useTranslations } from 'gt-react'` | `import { useTranslations } from 'gt-react/compat'` |
|
|
216
|
+
| `import { GTProvider } from 'gt-react'` with `dictionaries`, `onMissingDictionaryEntry` or `onMissingDictionaryObj` | `import { GTProvider } from 'gt-react/compat'`, which takes the same props |
|
|
217
|
+
| `initializeGT({ …, dictionary, loadDictionary })`, `initializeGTSPA({ …, dictionary, loadDictionary })` (gt-react) | `initializeGT({ … })` / `initializeGTSPA({ … })`, then `initializeGTDictionary({ dictionary, loadDictionary, cacheExpiryTime })` from `gt-react/compat`. Pass the `cacheExpiryTime` the dictionaries used before: the one you pass to `initializeGT()`, or `null` where `initializeGT()` defaulted it to `null` (gt-react's browser `initializeGT()`); without it, loaded dictionaries expire after the default 60 seconds |
|
|
218
|
+
| `import { useTranslations } from 'gt-react-native'` | `import { useTranslations } from 'gt-react-native/compat'` |
|
|
219
|
+
| `<GTProvider dictionaries={…}>`, `initializeGT({ …, dictionary, loadDictionary })` (gt-react-native) | `GTProvider` and `initializeGTDictionary({ dictionary, loadDictionary, cacheExpiryTime })` from `gt-react-native/compat`, with the `cacheExpiryTime` you pass to `initializeGT()` |
|
|
220
|
+
| `import { useTranslations } from 'gt-next'` | `import { useTranslations } from 'gt-next/compat'` |
|
|
221
|
+
| `import { getTranslations } from 'gt-next/server'` | `import { getTranslations } from 'gt-next/compat/server'` |
|
|
222
|
+
| gt-next `GTProvider` streamed dictionaries to client components | import `GTProvider` from `gt-next/compat`. In the Pages Router, also import `withGTServerSideProps` / `withGTStaticProps` from `gt-next/compat`, which add `dictionaries` to page props |
|
|
223
|
+
| `import { useTranslations, getTranslations } from 'gt-tanstack-start'` | `import { useTranslations, getTranslations } from 'gt-tanstack-start/compat'`, and import `setupRouterGTIntegration` from `gt-tanstack-start/compat` instead of `gt-tanstack-start` |
|
|
224
|
+
|
|
225
|
+
- 943c094: `@generaltranslation/react-core/pure` no longer re-exports names that `gt-i18n`, `generaltranslation`, or `@generaltranslation/format` own. Import them from their owner:
|
|
226
|
+
- `msg`, `decodeMsg`, `decodeOptions`, `mFallback`, `gtFallback`, `getDefaultLocale`, `getLocaleProperties`, `getLocales`, `resolveCanonicalLocale`, `getVersionId`: import from `gt-i18n`.
|
|
227
|
+
- `derive`, `declareVar`, `decodeVars`: import from `generaltranslation` (or `gt-i18n`).
|
|
228
|
+
- `ReadonlyConditionStore`: import from `gt-i18n/internal`.
|
|
229
|
+
- `defaultLocaleCookieName`, `defaultRegionCookieName`, `defaultEnableI18nCookieName`, `defaultResetLocaleCookieName`: import from `gt-i18n/internal/cookies`.
|
|
230
|
+
- Types `GTTranslationOptions`, `GTFunctionType`, `MFunctionType`, `RuntimeTranslationOptions`: import from `gt-i18n`.
|
|
231
|
+
- Type `GTProp`: import from `@generaltranslation/format`.
|
|
232
|
+
|
|
233
|
+
`@generaltranslation/react-core/unstable` now exports only `t`, `useGT`, and `useMessages`. Import the message helpers (`msg`, `mFallback`, `derive`, `plural`, `select`, `selectordinal`, `part`, `number`, `n`, `date`) and their types from `gt-i18n/unstable`.
|
|
234
|
+
|
|
235
|
+
`gt-react`, `gt-react-native`, `gt-next`, and `gt-tanstack-start` still export the same user-facing names.
|
|
236
|
+
|
|
237
|
+
- 943c094: Each name is now exported from one entry:
|
|
238
|
+
- `@generaltranslation/react-core/components-rsc` no longer re-exports what `@generaltranslation/react-core/pure` exports: `t`, `getTranslationsSnapshot`, `getFormatLocales`, `createRenderPipeline`, `RenderPipeline`, `getReactI18nCache`, `setReactI18nCache`, `internalInitializeGTSRA`, `getReadonlyConditionStore`, `RelativeTimeFormatOptions` and `RenderVariable`. Import them from `@generaltranslation/react-core/pure`.
|
|
239
|
+
- `I18nStore` is no longer exported from `@generaltranslation/react-core/components`. Import it from `@generaltranslation/react-core/pure`.
|
|
240
|
+
|
|
241
|
+
- 13dae8a: Remove the remaining backward compatibility:
|
|
242
|
+
- `<T>` no longer reads `$context`, `$id`, `$maxChars`, `$requiresReview`, `$format`, or `$_hash`; use `context`, `id`, `maxChars`, `requiresReview`.
|
|
243
|
+
- `<LocaleSelector>` drops `customNames`; use `customMapping={{ [locale]: { name } }}`.
|
|
244
|
+
- gt-next: `parseLocale()` no longer detects the locale from request headers, cookies, or `Accept-Language` when Next.js provides none; it uses Next.js `defaultLocale` (or the GT default) and warns, like `withGTStaticProps`. Configure Next.js `i18n`.
|
|
245
|
+
- gt-next and gt-tanstack-start: `experimentalCompilerOptions.compileTimeHash: false` no longer switches the compiler off; use `experimentalCompilerOptions.type: 'none'`.
|
|
246
|
+
- gt-next: runtime translation requests no longer send `projectId`, `timeout`, `publish`, `fast`, or `sourceLocale` in request `metadata`.
|
|
247
|
+
- gt-react-native: locale detection drops the fallbacks for unsupported runtimes (Android < 24 and Internet Explorer's `navigator.userLanguage`).
|
|
248
|
+
|
|
249
|
+
### Patch Changes
|
|
250
|
+
|
|
251
|
+
- 96f428a: Remove duplicate and unused type exports.
|
|
252
|
+
- `import type { UseTranslationsFunction } from 'gt-react/compat'` (also `gt-react-native/compat` and `gt-tanstack-start/compat`): use `TFunctionType` from the same entry. From `gt-next/compat`, use `TFunctionType` from `gt-next/compat/server`; from `@generaltranslation/react-core/compat`, use `TFunctionType` from `gt-i18n/internal/compat`.
|
|
253
|
+
- `@generaltranslation/react-core/pure` no longer exports the `OnMissingTranslation` and `VariableProps` types.
|
|
254
|
+
- `@generaltranslation/react-core/components-rsc` no longer exports the `RenderDefaultChildrenArgs`, `RenderPreparedTParams` and `RenderTranslatedChildrenArgs` types.
|
|
255
|
+
- `I18nCacheConfig` from `gt-i18n/internal` no longer has `projectId`, `apiKey` and `runtimeUrl`; `I18nCache` never read them.
|
|
256
|
+
|
|
257
|
+
- cf7029c: Move the dictionary (compat) internals to their own internal subpaths, `gt-i18n/internal/compat` and `@generaltranslation/react-core/compat`, so CommonJS builds of the native entries no longer load the dictionary runtime. `gt-i18n/internal` and `@generaltranslation/react-core/{pure,hooks,components}` no longer export it. No public API change.
|
|
258
|
+
- 63b6748: `withGTConfig()` props, `createNextMiddleware()` options and `RenderMethod` now take their types from the `gt.config.json` schemas: the shared keys from `GTConfig`, and gt-next's routing keys (`pathConfig`, `pathRegex`, `prefixDefaultLocale` and the others) from gt-next's own schema, so they match what `gt.config.json` accepts. No behavior changes.
|
|
259
|
+
- 82999f0: Remove the internal `setup/cookieNames` pass-through and other internal re-exports.
|
|
260
|
+
- ea429a2: `@generaltranslation/react-core/pure` exports the `RenderMethod` type. `RegionSelectorProps` now derives its region options from `InternalRegionSelectorOptions`; the accepted props are unchanged.
|
|
261
|
+
- 2d7f9bd: Remove runtime checks that TypeScript already guarantees and duplicated locale resolution. gt-react's browser condition store now resolves the locale once on initialization and server updates, and gt-vue's `initializeGTSPA()` builds its locale matcher once instead of on every lookup. Translation hashes do not change.
|
|
262
|
+
|
|
263
|
+
Two observable changes:
|
|
264
|
+
- `generaltranslation`: runtime translation results from the General Translation API are no longer shape-checked on the client; their type comes from the generated API client. A successful result whose `translation` did not match its `dataFormat` used to become `{ success: false, error: 'Invalid translation returned', code: 500 }`; it is now returned as the service sent it. Failed requests, missing entries (`'No translation returned'`) and network errors behave as before.
|
|
265
|
+
- `gt-tanstack-start`: request locales are now resolved against the configuration that `initializeGT()` already loaded, instead of a copy rebuilt on every request. That configuration always includes `defaultLocale` among the supported locales, so with `defaultLocale: 'en'`, `locales: ['fr']` and `Accept-Language: en, fr`, the request locale is now `en` (previously `fr`), matching path-based locale detection.
|
|
266
|
+
|
|
267
|
+
- 44a3832: - gt-vue's `<Num>`, `<Currency>` and `<DateTime>` format through `generaltranslation`'s formatters, as gt-react's do. They reuse one `Intl` formatter per locale and options, where they built a new one on every render, and they print what gt-react prints: Latin digits and the Gregorian calendar, so `<Num :value="1234.5"/>` in `ar-EG` is `1,234.5`, not `١٬٢٣٤٫٥`. A `<DateTime>` without a `timeZone` is still in the host's.
|
|
268
|
+
- The region selector builds one `Intl.Collator` to sort its regions, not one per comparison.
|
|
269
|
+
- Updated dependencies [96f428a]
|
|
270
|
+
- Updated dependencies [96f428a]
|
|
271
|
+
- Updated dependencies [cf7029c]
|
|
272
|
+
- Updated dependencies [2d7f9bd]
|
|
273
|
+
- Updated dependencies [ba09ee2]
|
|
274
|
+
- Updated dependencies [ba09ee2]
|
|
275
|
+
- Updated dependencies [63b6748]
|
|
276
|
+
- Updated dependencies [ea429a2]
|
|
277
|
+
- Updated dependencies [82999f0]
|
|
278
|
+
- Updated dependencies [ba09ee2]
|
|
279
|
+
- Updated dependencies [ba09ee2]
|
|
280
|
+
- Updated dependencies [943c094]
|
|
281
|
+
- Updated dependencies [016ace7]
|
|
282
|
+
- Updated dependencies [ba09ee2]
|
|
283
|
+
- Updated dependencies [82999f0]
|
|
284
|
+
- Updated dependencies [96f428a]
|
|
285
|
+
- Updated dependencies [3832c15]
|
|
286
|
+
- Updated dependencies [2d7f9bd]
|
|
287
|
+
- Updated dependencies [943c094]
|
|
288
|
+
- Updated dependencies [cf7029c]
|
|
289
|
+
- Updated dependencies [82999f0]
|
|
290
|
+
- Updated dependencies [63b6748]
|
|
291
|
+
- Updated dependencies [13dae8a]
|
|
292
|
+
- Updated dependencies [2d7f9bd]
|
|
293
|
+
- Updated dependencies [943c094]
|
|
294
|
+
- Updated dependencies [a191c9a]
|
|
295
|
+
- Updated dependencies [2d7f9bd]
|
|
296
|
+
- Updated dependencies [1a5e9ae]
|
|
297
|
+
- Updated dependencies [e29f6f9]
|
|
298
|
+
- generaltranslation@10.0.0-samsara.9
|
|
299
|
+
- gt-i18n@2.0.0-samsara.9
|
|
300
|
+
- @generaltranslation/format@1.0.0-samsara.9
|
|
301
|
+
|
|
302
|
+
## 12.0.0-samsara.8
|
|
303
|
+
|
|
304
|
+
### Patch Changes
|
|
305
|
+
|
|
306
|
+
- generaltranslation@10.0.0-samsara.8
|
|
307
|
+
- @generaltranslation/format@1.0.0-samsara.8
|
|
308
|
+
- gt-i18n@2.0.0-samsara.8
|
|
309
|
+
|
|
310
|
+
## 12.0.0-samsara.7
|
|
311
|
+
|
|
312
|
+
### Patch Changes
|
|
313
|
+
|
|
314
|
+
- Updated dependencies [27c26cd]
|
|
315
|
+
- Updated dependencies [27c26cd]
|
|
316
|
+
- gt-i18n@2.0.0-samsara.7
|
|
317
|
+
- @generaltranslation/format@1.0.0-samsara.7
|
|
318
|
+
- generaltranslation@10.0.0-samsara.7
|
|
319
|
+
|
|
320
|
+
## 12.0.0-samsara.6
|
|
321
|
+
|
|
322
|
+
### Minor Changes
|
|
323
|
+
|
|
324
|
+
- f88a4dc: Rename the `message` field of translation lookups to `content`, to match `GLOSSARY.md`: it holds content in any data format, JSX and message trees included, not only string messages. No behavior changes.
|
|
325
|
+
- `gt-i18n/internal`: the variant of `TranslateListenerLookup` that carries the source is `{ locale, content, options }`; the `{ locale, hash }` variant is unchanged. The entries passed to a lookup's `prefetchEntries` are `{ content, options }`.
|
|
326
|
+
- `@generaltranslation/react-core`: `TranslateLookup` is `{ locale, content, options }`.
|
|
327
|
+
|
|
328
|
+
`RegisteredMessage.message` is unchanged: it is a string message.
|
|
329
|
+
|
|
330
|
+
### Patch Changes
|
|
331
|
+
|
|
332
|
+
- ada6894: Rename three names to match `GLOSSARY.md`. No behavior changes.
|
|
333
|
+
- The `Message` type in `gt-i18n/types`, a string message with its metadata as passed to `getGT()` and `useGT()`, is now `RegisteredMessage`. `Message` is left to mean a message tree and its formats.
|
|
334
|
+
- `hashMessage` in `gt-i18n/internal` is now `hashContent`: it hashes content in any data format, JSX included.
|
|
335
|
+
- `LocaleConfig.formatMessageTree()` takes the data for its variables as `values`, not `variables`, as `formatMessageTree` does everywhere else. This also applies to `LocaleConfig` in `generaltranslation` and `I18nConfig` in `gt-i18n`.
|
|
336
|
+
|
|
337
|
+
- 067e175: `gt-next` and `@generaltranslation/react-core` use `RegisteredMessage` from `gt-i18n/types` instead of declaring their own copies. The copy in `gt-next` had fallen behind, so the messages passed to its `useGT()` and `useMessages()` now also accept `$format`, `$locale` and `$requiresReview`.
|
|
338
|
+
- Updated dependencies [6440bd1]
|
|
339
|
+
- Updated dependencies [f88a4dc]
|
|
340
|
+
- Updated dependencies [8dde4bb]
|
|
341
|
+
- Updated dependencies [ada6894]
|
|
342
|
+
- @generaltranslation/format@1.0.0-samsara.6
|
|
343
|
+
- generaltranslation@10.0.0-samsara.6
|
|
344
|
+
- gt-i18n@2.0.0-samsara.6
|
|
345
|
+
|
|
346
|
+
## 12.0.0-samsara.5
|
|
347
|
+
|
|
348
|
+
### Patch Changes
|
|
349
|
+
|
|
350
|
+
- Updated dependencies [886232a]
|
|
351
|
+
- generaltranslation@10.0.0-samsara.5
|
|
352
|
+
- @generaltranslation/format@1.0.0-samsara.5
|
|
353
|
+
- gt-i18n@2.0.0-samsara.5
|
|
354
|
+
|
|
355
|
+
## 12.0.0-samsara.4
|
|
356
|
+
|
|
357
|
+
### Minor Changes
|
|
358
|
+
|
|
359
|
+
- 7ef8d91: In the `/unstable` entries, `number()`, `date()` and the new `time()` split their options. Message options (`style`, `unit`, date and time fields) are part of the message and must be one literal. `date()` and `time()` name their style `style`, as `number()` does: `date({ due }, { style: 'medium' })` and `time({ start }, { style: 'short' })`, not Intl's `dateStyle` and `timeStyle`. Formatting context, such as `currency` or `timeZone`, may be any value and never changes the message's hash, so `currency: order.currency` is translated once; a `Msg` carries it in `formats`, which is `{}` when there is none. A `timeZone` in `gt.config.json`, `initializeGT()` or `withGTConfig()` sets the default time zone of every date and time formatted without one, in a message or in `<DateTime>`; the `GT` class takes the same `timeZone`. A message without placeholders is one string tree, so its hash changes once.
|
|
360
|
+
|
|
361
|
+
### Patch Changes
|
|
362
|
+
|
|
363
|
+
- Updated dependencies [7ef8d91]
|
|
364
|
+
- Updated dependencies [7ef8d91]
|
|
365
|
+
- Updated dependencies [3c013b5]
|
|
366
|
+
- @generaltranslation/format@1.0.0-samsara.4
|
|
367
|
+
- generaltranslation@10.0.0-samsara.4
|
|
368
|
+
- gt-i18n@2.0.0-samsara.4
|
|
369
|
+
|
|
370
|
+
## 12.0.0-samsara.3
|
|
371
|
+
|
|
372
|
+
### Patch Changes
|
|
373
|
+
|
|
374
|
+
- Updated dependencies [cf23e00]
|
|
375
|
+
- generaltranslation@10.0.0-samsara.3
|
|
376
|
+
- gt-i18n@2.0.0-samsara.3
|
|
377
|
+
|
|
378
|
+
## 12.0.0-samsara.2
|
|
379
|
+
|
|
380
|
+
### Patch Changes
|
|
381
|
+
|
|
382
|
+
- generaltranslation@10.0.0-samsara.2
|
|
383
|
+
- @generaltranslation/format@1.0.0-samsara.3
|
|
384
|
+
- gt-i18n@2.0.0-samsara.2
|
|
385
|
+
|
|
3
386
|
## 12.0.0-samsara.1
|
|
4
387
|
|
|
5
388
|
### Minor Changes
|
|
@@ -49,6 +432,40 @@
|
|
|
49
432
|
- @generaltranslation/format@1.0.0-samsara.1
|
|
50
433
|
- gt-i18n@2.0.0-samsara.0
|
|
51
434
|
|
|
435
|
+
## 11.4.23
|
|
436
|
+
|
|
437
|
+
### Patch Changes
|
|
438
|
+
|
|
439
|
+
- Updated dependencies [[`25a88c9`](https://github.com/generaltranslation/gt/commit/25a88c9ffd6c8b6c68adc871e8b572ce590c0d9c)]:
|
|
440
|
+
- gt-i18n@1.0.44
|
|
441
|
+
|
|
442
|
+
## 11.4.22
|
|
443
|
+
|
|
444
|
+
### Patch Changes
|
|
445
|
+
|
|
446
|
+
- Updated dependencies [[`7aae545`](https://github.com/generaltranslation/gt/commit/7aae545bd9e65148b8cbf98a4df3ce750ab1cdbf)]:
|
|
447
|
+
- @generaltranslation/format@0.1.10
|
|
448
|
+
- generaltranslation@9.5.12
|
|
449
|
+
- gt-i18n@1.0.43
|
|
450
|
+
|
|
451
|
+
## 11.4.21
|
|
452
|
+
|
|
453
|
+
## 11.4.20
|
|
454
|
+
|
|
455
|
+
### Patch Changes
|
|
456
|
+
|
|
457
|
+
- Updated dependencies [[`b3c3647`](https://github.com/generaltranslation/gt/commit/b3c3647239a6c44c3549e722b7001b83624865f8)]:
|
|
458
|
+
- generaltranslation@9.5.11
|
|
459
|
+
- gt-i18n@1.0.42
|
|
460
|
+
|
|
461
|
+
## 11.4.19
|
|
462
|
+
|
|
463
|
+
### Patch Changes
|
|
464
|
+
|
|
465
|
+
- Updated dependencies [[`e1c64a3`](https://github.com/generaltranslation/gt/commit/e1c64a3c27c7a05ffeb81eb2d04ace795d0c3ab5)]:
|
|
466
|
+
- generaltranslation@9.5.10
|
|
467
|
+
- gt-i18n@1.0.41
|
|
468
|
+
|
|
52
469
|
## 11.4.18
|
|
53
470
|
|
|
54
471
|
### Patch Changes
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../i18n-store/utils/subscriptions.cjs`),t=require(`../i18n-store/utils/runtimeTranslationErrors.cjs`),n=require(`./dictionaries.cjs`);let r=require(`gt-i18n/internal/compat`);function i(){return(0,r.isDictionaryManagerInitialized)()||(0,r.initializeDictionaryManager)({cacheExpiryTime:null}),(0,r.getDictionaryManager)()}function a(){return(0,r.isDictionaryManagerInitialized)()?(0,r.getDictionaryManager)():void 0}var o=class{dictionaryEntryListeners=new Set;dictionaryObjectListeners=new Set;logRuntimeTranslationError=t.createRuntimeTranslationErrorLogger();updateDictionaries=e=>{Object.keys(e).length!==0&&i().updateDictionaries(e)};translateDictionaryEntry=e=>{a()?.lookupDictionaryWithFallback(e.locale,e.id).then(()=>{this.emitDictionaryEvent(e)}).catch(e=>this.logRuntimeTranslationError(e))};translateDictionaryObject=e=>{a()?.lookupDictionaryObjWithFallback(e.locale,e.id).then(()=>{this.emitDictionaryEvent(e)}).catch(e=>this.logRuntimeTranslationError(e))};subscribeToDictionaryEntryEvents=t=>e.subscribeToSet(this.dictionaryEntryListeners,t);subscribeToDictionaryObjectEvents=t=>e.subscribeToSet(this.dictionaryObjectListeners,t);getDictionaryEntrySnapshot=(e,t)=>n.lookupDictionaryEntry(t,e)??a()?.lookupDictionary(e.locale,e.id);getDictionaryObjectSnapshot=(e,t)=>n.lookupDictionaryObject(t,e)??a()?.lookupDictionaryObj(e.locale,e.id);emitDictionaryEvent(e){this.dictionaryEntryListeners.forEach(t=>t(e)),this.dictionaryObjectListeners.forEach(t=>{t(e)})}};exports.CompatStore=o;
|
|
2
|
+
//# sourceMappingURL=CompatStore.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompatStore.cjs","names":["createRuntimeTranslationErrorLogger","subscribeToSet","lookupDictionaryEntry","lookupDictionaryObject"],"sources":["../../src/compat/CompatStore.ts"],"sourcesContent":["import type { Locale } from 'gt-i18n/internal';\nimport {\n getDictionaryManager,\n initializeDictionaryManager,\n isDictionaryManagerInitialized,\n type Dictionary,\n} from 'gt-i18n/internal/compat';\nimport type { Unsubscribe } from '../i18n-store/storeTypes';\nimport { subscribeToSet } from '../i18n-store/utils/subscriptions';\nimport { createRuntimeTranslationErrorLogger } from '../i18n-store/utils/runtimeTranslationErrors';\nimport { lookupDictionaryEntry, lookupDictionaryObject } from './dictionaries';\nimport type {\n DictionaryEntrySnapshot,\n DictionaryLookup,\n DictionaryObjectSnapshot,\n DictionaryStoreListener,\n} from './types';\n\n/**\n * Runtimes that only receive dictionaries through provider snapshots (such as\n * the gt-next client) never initialize a DictionaryManager. Create one without\n * a loader; its entries cannot be refreshed, so they never expire.\n */\nfunction getOrCreateDictionaryManager() {\n if (!isDictionaryManagerInitialized()) {\n initializeDictionaryManager({ cacheExpiryTime: null });\n }\n return getDictionaryManager();\n}\n\n/**\n * Render-time reads and server-side translations must not create a manager:\n * an empty one would stop gt-next from seeding the bundled dictionary later.\n * Only updateDictionaries() (a client effect) creates one.\n */\nfunction getExistingDictionaryManager() {\n return isDictionaryManagerInitialized() ? getDictionaryManager() : undefined;\n}\n\n/**\n * Dictionary counterpart of I18nStore: syncs DictionaryManager updates with\n * renders and drives dictionary dev hot reload.\n */\nexport class CompatStore {\n // ----- Listener Sets ----- //\n\n private dictionaryEntryListeners = new Set<DictionaryStoreListener>();\n private dictionaryObjectListeners = new Set<DictionaryStoreListener>();\n private logRuntimeTranslationError = createRuntimeTranslationErrorLogger();\n\n // ========== Dictionary Updates ========== //\n\n updateDictionaries = (dictionaries: Record<Locale, Dictionary>): void => {\n if (Object.keys(dictionaries).length === 0) return;\n getOrCreateDictionaryManager().updateDictionaries(dictionaries);\n };\n\n // ========== runtime translation ========== //\n\n translateDictionaryEntry = (lookup: DictionaryLookup): void => {\n // Without a manager there is no source dictionary to translate from.\n getExistingDictionaryManager()\n ?.lookupDictionaryWithFallback(lookup.locale, lookup.id)\n .then(() => {\n this.emitDictionaryEvent(lookup);\n })\n .catch((error) => this.logRuntimeTranslationError(error));\n };\n\n translateDictionaryObject = (lookup: DictionaryLookup): void => {\n getExistingDictionaryManager()\n ?.lookupDictionaryObjWithFallback(lookup.locale, lookup.id)\n .then(() => {\n this.emitDictionaryEvent(lookup);\n })\n .catch((error) => this.logRuntimeTranslationError(error));\n };\n\n // ========== UseSyncExternalStore ========== //\n\n // ----- Subscriptions ----- //\n\n // Keep subscription methods as arrow fields so hooks can pass them by\n // reference without losing access to this store instance.\n subscribeToDictionaryEntryEvents = (\n listener: DictionaryStoreListener\n ): Unsubscribe => {\n return subscribeToSet(this.dictionaryEntryListeners, listener);\n };\n\n subscribeToDictionaryObjectEvents = (\n listener: DictionaryStoreListener\n ): Unsubscribe => {\n return subscribeToSet(this.dictionaryObjectListeners, listener);\n };\n\n // ----- Snapshots ----- //\n\n getDictionaryEntrySnapshot = (\n lookup: DictionaryLookup,\n dictionariesSnapshot: Record<Locale, Dictionary>\n ): DictionaryEntrySnapshot => {\n return (\n lookupDictionaryEntry(dictionariesSnapshot, lookup) ??\n getExistingDictionaryManager()?.lookupDictionary(lookup.locale, lookup.id)\n );\n };\n\n getDictionaryObjectSnapshot = (\n lookup: DictionaryLookup,\n dictionariesSnapshot: Record<Locale, Dictionary>\n ): DictionaryObjectSnapshot => {\n return (\n lookupDictionaryObject(dictionariesSnapshot, lookup) ??\n getExistingDictionaryManager()?.lookupDictionaryObj(\n lookup.locale,\n lookup.id\n )\n );\n };\n\n // ----- Listener Utilities ----- //\n\n private emitDictionaryEvent(event: DictionaryLookup): void {\n this.dictionaryEntryListeners.forEach((listener) => listener(event));\n this.dictionaryObjectListeners.forEach((listener) => {\n listener(event);\n });\n }\n}\n"],"mappings":"6OAuBA,SAAS,GAA+B,CAItC,OAHI,EAAA,EAAA,iCAAiC,GACnC,EAAA,EAAA,6BAA4B,CAAE,gBAAiB,KAAM,CAAC,EAExD,EAAA,EAAA,uBAA6B,CAQ/B,SAAS,GAA+B,CACtC,OAAA,EAAA,EAAA,iCAAuC,EAAA,EAAA,EAAA,uBAAyB,CAAG,IAAA,GAOrE,IAAa,EAAb,KAAyB,CAGvB,yBAAmC,IAAI,IACvC,0BAAoC,IAAI,IACxC,2BAAqCA,EAAAA,qCAAqC,CAI1E,mBAAsB,GAAmD,CACnE,OAAO,KAAK,EAAa,CAAC,SAAW,GACzC,GAA8B,CAAC,mBAAmB,EAAa,EAKjE,yBAA4B,GAAmC,CAE7D,GAA8B,EAC1B,6BAA6B,EAAO,OAAQ,EAAO,GAAG,CACvD,SAAW,CACV,KAAK,oBAAoB,EAAO,EAChC,CACD,MAAO,GAAU,KAAK,2BAA2B,EAAM,CAAC,EAG7D,0BAA6B,GAAmC,CAC9D,GAA8B,EAC1B,gCAAgC,EAAO,OAAQ,EAAO,GAAG,CAC1D,SAAW,CACV,KAAK,oBAAoB,EAAO,EAChC,CACD,MAAO,GAAU,KAAK,2BAA2B,EAAM,CAAC,EAS7D,iCACE,GAEOC,EAAAA,eAAe,KAAK,yBAA0B,EAAS,CAGhE,kCACE,GAEOA,EAAAA,eAAe,KAAK,0BAA2B,EAAS,CAKjE,4BACE,EACA,IAGEC,EAAAA,sBAAsB,EAAsB,EAAO,EACnD,GAA8B,EAAE,iBAAiB,EAAO,OAAQ,EAAO,GAAG,CAI9E,6BACE,EACA,IAGEC,EAAAA,uBAAuB,EAAsB,EAAO,EACpD,GAA8B,EAAE,oBAC9B,EAAO,OACP,EAAO,GACR,CAML,oBAA4B,EAA+B,CACzD,KAAK,yBAAyB,QAAS,GAAa,EAAS,EAAM,CAAC,CACpE,KAAK,0BAA0B,QAAS,GAAa,CACnD,EAAS,EAAM,EACf"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Unsubscribe } from "../i18n-store/storeTypes.js";
|
|
2
|
+
import { DictionaryEntrySnapshot, DictionaryLookup, DictionaryObjectSnapshot, DictionaryStoreListener } from "./types.js";
|
|
3
|
+
import { Locale } from "gt-i18n/internal";
|
|
4
|
+
import { Dictionary } from "gt-i18n/internal/compat";
|
|
5
|
+
|
|
6
|
+
//#region src/compat/CompatStore.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Dictionary counterpart of I18nStore: syncs DictionaryManager updates with
|
|
9
|
+
* renders and drives dictionary dev hot reload.
|
|
10
|
+
*/
|
|
11
|
+
declare class CompatStore {
|
|
12
|
+
private dictionaryEntryListeners;
|
|
13
|
+
private dictionaryObjectListeners;
|
|
14
|
+
private logRuntimeTranslationError;
|
|
15
|
+
updateDictionaries: (dictionaries: Record<Locale, Dictionary>) => void;
|
|
16
|
+
translateDictionaryEntry: (lookup: DictionaryLookup) => void;
|
|
17
|
+
translateDictionaryObject: (lookup: DictionaryLookup) => void;
|
|
18
|
+
subscribeToDictionaryEntryEvents: (listener: DictionaryStoreListener) => Unsubscribe;
|
|
19
|
+
subscribeToDictionaryObjectEvents: (listener: DictionaryStoreListener) => Unsubscribe;
|
|
20
|
+
getDictionaryEntrySnapshot: (lookup: DictionaryLookup, dictionariesSnapshot: Record<Locale, Dictionary>) => DictionaryEntrySnapshot;
|
|
21
|
+
getDictionaryObjectSnapshot: (lookup: DictionaryLookup, dictionariesSnapshot: Record<Locale, Dictionary>) => DictionaryObjectSnapshot;
|
|
22
|
+
private emitDictionaryEvent;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { CompatStore };
|
|
26
|
+
//# sourceMappingURL=CompatStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompatStore.d.ts","names":[],"sources":["../../src/compat/CompatStore.ts"],"mappings":";;;;;;;;AA2CA;;cAAa,WAAA;EAAA,QAGH,wBAAA;EAAA,QACA,yBAAA;EAAA,QACA,0BAAA;EAIR,kBAAA,GAAsB,YAAA,EAAc,MAAA,CAAO,MAAA,EAAQ,UAAA;EAOnD,wBAAA,GAA4B,MAAA,EAAQ,gBAAA;EAUpC,yBAAA,GAA6B,MAAA,EAAQ,gBAAA;EAerC,gCAAA,GACE,QAAA,EAAU,uBAAA,KACT,WAAA;EAIH,iCAAA,GACE,QAAA,EAAU,uBAAA,KACT,WAAA;EAMH,0BAAA,GACE,MAAA,EAAQ,gBAAA,EACR,oBAAA,EAAsB,MAAA,CAAO,MAAA,EAAQ,UAAA,MACpC,uBAAA;EAOH,2BAAA,GACE,MAAA,EAAQ,gBAAA,EACR,oBAAA,EAAsB,MAAA,CAAO,MAAA,EAAQ,UAAA,MACpC,wBAAA;EAAA,QAYK,mBAAA;AAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{subscribeToSet as e}from"../i18n-store/utils/subscriptions.mjs";import{createRuntimeTranslationErrorLogger as t}from"../i18n-store/utils/runtimeTranslationErrors.mjs";import{lookupDictionaryEntry as n,lookupDictionaryObject as r}from"./dictionaries.mjs";import{getDictionaryManager as i,initializeDictionaryManager as a,isDictionaryManagerInitialized as o}from"gt-i18n/internal/compat";function s(){return o()||a({cacheExpiryTime:null}),i()}function c(){return o()?i():void 0}var l=class{dictionaryEntryListeners=new Set;dictionaryObjectListeners=new Set;logRuntimeTranslationError=t();updateDictionaries=e=>{Object.keys(e).length!==0&&s().updateDictionaries(e)};translateDictionaryEntry=e=>{c()?.lookupDictionaryWithFallback(e.locale,e.id).then(()=>{this.emitDictionaryEvent(e)}).catch(e=>this.logRuntimeTranslationError(e))};translateDictionaryObject=e=>{c()?.lookupDictionaryObjWithFallback(e.locale,e.id).then(()=>{this.emitDictionaryEvent(e)}).catch(e=>this.logRuntimeTranslationError(e))};subscribeToDictionaryEntryEvents=t=>e(this.dictionaryEntryListeners,t);subscribeToDictionaryObjectEvents=t=>e(this.dictionaryObjectListeners,t);getDictionaryEntrySnapshot=(e,t)=>n(t,e)??c()?.lookupDictionary(e.locale,e.id);getDictionaryObjectSnapshot=(e,t)=>r(t,e)??c()?.lookupDictionaryObj(e.locale,e.id);emitDictionaryEvent(e){this.dictionaryEntryListeners.forEach(t=>t(e)),this.dictionaryObjectListeners.forEach(t=>{t(e)})}};export{l as CompatStore};
|
|
2
|
+
//# sourceMappingURL=CompatStore.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompatStore.mjs","names":[],"sources":["../../src/compat/CompatStore.ts"],"sourcesContent":["import type { Locale } from 'gt-i18n/internal';\nimport {\n getDictionaryManager,\n initializeDictionaryManager,\n isDictionaryManagerInitialized,\n type Dictionary,\n} from 'gt-i18n/internal/compat';\nimport type { Unsubscribe } from '../i18n-store/storeTypes';\nimport { subscribeToSet } from '../i18n-store/utils/subscriptions';\nimport { createRuntimeTranslationErrorLogger } from '../i18n-store/utils/runtimeTranslationErrors';\nimport { lookupDictionaryEntry, lookupDictionaryObject } from './dictionaries';\nimport type {\n DictionaryEntrySnapshot,\n DictionaryLookup,\n DictionaryObjectSnapshot,\n DictionaryStoreListener,\n} from './types';\n\n/**\n * Runtimes that only receive dictionaries through provider snapshots (such as\n * the gt-next client) never initialize a DictionaryManager. Create one without\n * a loader; its entries cannot be refreshed, so they never expire.\n */\nfunction getOrCreateDictionaryManager() {\n if (!isDictionaryManagerInitialized()) {\n initializeDictionaryManager({ cacheExpiryTime: null });\n }\n return getDictionaryManager();\n}\n\n/**\n * Render-time reads and server-side translations must not create a manager:\n * an empty one would stop gt-next from seeding the bundled dictionary later.\n * Only updateDictionaries() (a client effect) creates one.\n */\nfunction getExistingDictionaryManager() {\n return isDictionaryManagerInitialized() ? getDictionaryManager() : undefined;\n}\n\n/**\n * Dictionary counterpart of I18nStore: syncs DictionaryManager updates with\n * renders and drives dictionary dev hot reload.\n */\nexport class CompatStore {\n // ----- Listener Sets ----- //\n\n private dictionaryEntryListeners = new Set<DictionaryStoreListener>();\n private dictionaryObjectListeners = new Set<DictionaryStoreListener>();\n private logRuntimeTranslationError = createRuntimeTranslationErrorLogger();\n\n // ========== Dictionary Updates ========== //\n\n updateDictionaries = (dictionaries: Record<Locale, Dictionary>): void => {\n if (Object.keys(dictionaries).length === 0) return;\n getOrCreateDictionaryManager().updateDictionaries(dictionaries);\n };\n\n // ========== runtime translation ========== //\n\n translateDictionaryEntry = (lookup: DictionaryLookup): void => {\n // Without a manager there is no source dictionary to translate from.\n getExistingDictionaryManager()\n ?.lookupDictionaryWithFallback(lookup.locale, lookup.id)\n .then(() => {\n this.emitDictionaryEvent(lookup);\n })\n .catch((error) => this.logRuntimeTranslationError(error));\n };\n\n translateDictionaryObject = (lookup: DictionaryLookup): void => {\n getExistingDictionaryManager()\n ?.lookupDictionaryObjWithFallback(lookup.locale, lookup.id)\n .then(() => {\n this.emitDictionaryEvent(lookup);\n })\n .catch((error) => this.logRuntimeTranslationError(error));\n };\n\n // ========== UseSyncExternalStore ========== //\n\n // ----- Subscriptions ----- //\n\n // Keep subscription methods as arrow fields so hooks can pass them by\n // reference without losing access to this store instance.\n subscribeToDictionaryEntryEvents = (\n listener: DictionaryStoreListener\n ): Unsubscribe => {\n return subscribeToSet(this.dictionaryEntryListeners, listener);\n };\n\n subscribeToDictionaryObjectEvents = (\n listener: DictionaryStoreListener\n ): Unsubscribe => {\n return subscribeToSet(this.dictionaryObjectListeners, listener);\n };\n\n // ----- Snapshots ----- //\n\n getDictionaryEntrySnapshot = (\n lookup: DictionaryLookup,\n dictionariesSnapshot: Record<Locale, Dictionary>\n ): DictionaryEntrySnapshot => {\n return (\n lookupDictionaryEntry(dictionariesSnapshot, lookup) ??\n getExistingDictionaryManager()?.lookupDictionary(lookup.locale, lookup.id)\n );\n };\n\n getDictionaryObjectSnapshot = (\n lookup: DictionaryLookup,\n dictionariesSnapshot: Record<Locale, Dictionary>\n ): DictionaryObjectSnapshot => {\n return (\n lookupDictionaryObject(dictionariesSnapshot, lookup) ??\n getExistingDictionaryManager()?.lookupDictionaryObj(\n lookup.locale,\n lookup.id\n )\n );\n };\n\n // ----- Listener Utilities ----- //\n\n private emitDictionaryEvent(event: DictionaryLookup): void {\n this.dictionaryEntryListeners.forEach((listener) => listener(event));\n this.dictionaryObjectListeners.forEach((listener) => {\n listener(event);\n });\n }\n}\n"],"mappings":"yYAuBA,SAAS,GAA+B,CAItC,OAHK,GAAgC,EACnC,EAA4B,CAAE,gBAAiB,KAAM,CAAC,CAEjD,GAAsB,CAQ/B,SAAS,GAA+B,CACtC,OAAO,GAAgC,CAAG,GAAsB,CAAG,IAAA,GAOrE,IAAa,EAAb,KAAyB,CAGvB,yBAAmC,IAAI,IACvC,0BAAoC,IAAI,IACxC,2BAAqC,GAAqC,CAI1E,mBAAsB,GAAmD,CACnE,OAAO,KAAK,EAAa,CAAC,SAAW,GACzC,GAA8B,CAAC,mBAAmB,EAAa,EAKjE,yBAA4B,GAAmC,CAE7D,GAA8B,EAC1B,6BAA6B,EAAO,OAAQ,EAAO,GAAG,CACvD,SAAW,CACV,KAAK,oBAAoB,EAAO,EAChC,CACD,MAAO,GAAU,KAAK,2BAA2B,EAAM,CAAC,EAG7D,0BAA6B,GAAmC,CAC9D,GAA8B,EAC1B,gCAAgC,EAAO,OAAQ,EAAO,GAAG,CAC1D,SAAW,CACV,KAAK,oBAAoB,EAAO,EAChC,CACD,MAAO,GAAU,KAAK,2BAA2B,EAAM,CAAC,EAS7D,iCACE,GAEO,EAAe,KAAK,yBAA0B,EAAS,CAGhE,kCACE,GAEO,EAAe,KAAK,0BAA2B,EAAS,CAKjE,4BACE,EACA,IAGE,EAAsB,EAAsB,EAAO,EACnD,GAA8B,EAAE,iBAAiB,EAAO,OAAQ,EAAO,GAAG,CAI9E,6BACE,EACA,IAGE,EAAuB,EAAsB,EAAO,EACpD,GAA8B,EAAE,oBAC9B,EAAO,OACP,EAAO,GACR,CAML,oBAA4B,EAA+B,CACzD,KAAK,yBAAyB,QAAS,GAAa,EAAS,EAAM,CAAC,CACpE,KAAK,0BAA0B,QAAS,GAAa,CACnD,EAAS,EAAM,EACf"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`gt-i18n/internal`),t=require(`generaltranslation/diagnostics`),n=require(`react`);const r=(0,e.createGlobalSingleton)({namespace:`reactCore`,key:`dictionaryContext`,notInitialized:()=>(0,t.createDiagnosticMessage)({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Cannot read DictionaryContext before it has been initialized`})});function i(){return r.isInitialized()||r.set((0,n.createContext)(void 0)),r.get()}const a=(0,t.createDiagnosticMessage)({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`useTranslations() was called outside a GTProvider from a /compat entry`,why:`only the /compat GTProvider supplies the dictionaries useTranslations() reads`,fix:`Render GTProvider from your GT package's /compat entry, such as 'gt-react/compat', 'gt-next/compat' or 'gt-react-native/compat', instead of the one from the package root. In gt-tanstack-start, call setupRouterGTIntegration({ router }) from 'gt-tanstack-start/compat'`});function o(){let e=(0,n.useContext)(i());if(!e)throw Error(a);return e}exports.getDictionaryContext=i,exports.useDictionaryContext=o;
|
|
2
|
+
//# sourceMappingURL=DictionaryContext.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DictionaryContext.cjs","names":[],"sources":["../../src/compat/DictionaryContext.ts"],"sourcesContent":["import { createGlobalSingleton, type Locale } from 'gt-i18n/internal';\nimport type { Dictionary } from 'gt-i18n/internal/compat';\nimport { createDiagnosticMessage } from 'generaltranslation/diagnostics';\nimport { createContext, useContext, type Context } from 'react';\nimport type { CompatStore } from './CompatStore';\nimport type { OnMissingDictionaryEntry, OnMissingDictionaryObj } from './types';\n\ntype DictionaryContextType = {\n /**\n * Dictionaries streamed from the server, keyed by locale\n */\n dictionariesSnapshot: Record<Locale, Dictionary>;\n /**\n * CompatStore syncs DictionaryManager updates with renders\n */\n compatStore: CompatStore;\n /**\n * Custom override behavior on missing dictionary entries\n * Used for server triggering dictionary hmr b/c no access to useEffect\n */\n onMissingDictionaryEntry?: OnMissingDictionaryEntry;\n onMissingDictionaryObj?: OnMissingDictionaryObj;\n};\n\nconst dictionaryContextSingleton = createGlobalSingleton<\n Context<DictionaryContextType | undefined>\n>({\n namespace: 'reactCore',\n key: 'dictionaryContext',\n notInitialized: () =>\n createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened:\n 'Cannot read DictionaryContext before it has been initialized',\n }),\n});\n\nexport function getDictionaryContext(): Context<\n DictionaryContextType | undefined\n> {\n // Lazily create the React context once and share it across instances.\n if (!dictionaryContextSingleton.isInitialized()) {\n dictionaryContextSingleton.set(\n createContext<DictionaryContextType | undefined>(undefined)\n );\n }\n return dictionaryContextSingleton.get();\n}\n\nconst missingDictionaryProviderError = createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened:\n 'useTranslations() was called outside a GTProvider from a /compat entry',\n why: 'only the /compat GTProvider supplies the dictionaries useTranslations() reads',\n fix: \"Render GTProvider from your GT package's /compat entry, such as 'gt-react/compat', 'gt-next/compat' or 'gt-react-native/compat', instead of the one from the package root. In gt-tanstack-start, call setupRouterGTIntegration({ router }) from 'gt-tanstack-start/compat'\",\n});\n\nexport function useDictionaryContext(): DictionaryContextType {\n const context = useContext(getDictionaryContext());\n if (!context) throw new Error(missingDictionaryProviderError);\n return context;\n}\n"],"mappings":"8IAwBA,MAAM,GAAA,EAAA,EAAA,uBAEJ,CACA,UAAW,YACX,IAAK,oBACL,oBAAA,EAAA,EAAA,yBAC0B,CACtB,OAAQ,iCACR,SAAU,QACV,aACE,+DACH,CAAC,CACL,CAAC,CAEF,SAAgB,GAEd,CAOA,OALK,EAA2B,eAAe,EAC7C,EAA2B,KAAA,EAAA,EAAA,eACwB,IAAA,GAAU,CAC5D,CAEI,EAA2B,KAAK,CAGzC,MAAM,GAAA,EAAA,EAAA,yBAAyD,CAC7D,OAAQ,iCACR,SAAU,QACV,aACE,yEACF,IAAK,gFACL,IAAK,6QACN,CAAC,CAEF,SAAgB,GAA8C,CAC5D,IAAM,GAAA,EAAA,EAAA,YAAqB,GAAsB,CAAC,CAClD,GAAI,CAAC,EAAS,MAAU,MAAM,EAA+B,CAC7D,OAAO"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createGlobalSingleton as e}from"gt-i18n/internal";import{createDiagnosticMessage as t}from"generaltranslation/diagnostics";import{createContext as n,useContext as r}from"react";const i=e({namespace:`reactCore`,key:`dictionaryContext`,notInitialized:()=>t({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Cannot read DictionaryContext before it has been initialized`})});function a(){return i.isInitialized()||i.set(n(void 0)),i.get()}const o=t({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`useTranslations() was called outside a GTProvider from a /compat entry`,why:`only the /compat GTProvider supplies the dictionaries useTranslations() reads`,fix:`Render GTProvider from your GT package's /compat entry, such as 'gt-react/compat', 'gt-next/compat' or 'gt-react-native/compat', instead of the one from the package root. In gt-tanstack-start, call setupRouterGTIntegration({ router }) from 'gt-tanstack-start/compat'`});function s(){let e=r(a());if(!e)throw Error(o);return e}export{a as getDictionaryContext,s as useDictionaryContext};
|
|
2
|
+
//# sourceMappingURL=DictionaryContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DictionaryContext.mjs","names":[],"sources":["../../src/compat/DictionaryContext.ts"],"sourcesContent":["import { createGlobalSingleton, type Locale } from 'gt-i18n/internal';\nimport type { Dictionary } from 'gt-i18n/internal/compat';\nimport { createDiagnosticMessage } from 'generaltranslation/diagnostics';\nimport { createContext, useContext, type Context } from 'react';\nimport type { CompatStore } from './CompatStore';\nimport type { OnMissingDictionaryEntry, OnMissingDictionaryObj } from './types';\n\ntype DictionaryContextType = {\n /**\n * Dictionaries streamed from the server, keyed by locale\n */\n dictionariesSnapshot: Record<Locale, Dictionary>;\n /**\n * CompatStore syncs DictionaryManager updates with renders\n */\n compatStore: CompatStore;\n /**\n * Custom override behavior on missing dictionary entries\n * Used for server triggering dictionary hmr b/c no access to useEffect\n */\n onMissingDictionaryEntry?: OnMissingDictionaryEntry;\n onMissingDictionaryObj?: OnMissingDictionaryObj;\n};\n\nconst dictionaryContextSingleton = createGlobalSingleton<\n Context<DictionaryContextType | undefined>\n>({\n namespace: 'reactCore',\n key: 'dictionaryContext',\n notInitialized: () =>\n createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened:\n 'Cannot read DictionaryContext before it has been initialized',\n }),\n});\n\nexport function getDictionaryContext(): Context<\n DictionaryContextType | undefined\n> {\n // Lazily create the React context once and share it across instances.\n if (!dictionaryContextSingleton.isInitialized()) {\n dictionaryContextSingleton.set(\n createContext<DictionaryContextType | undefined>(undefined)\n );\n }\n return dictionaryContextSingleton.get();\n}\n\nconst missingDictionaryProviderError = createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened:\n 'useTranslations() was called outside a GTProvider from a /compat entry',\n why: 'only the /compat GTProvider supplies the dictionaries useTranslations() reads',\n fix: \"Render GTProvider from your GT package's /compat entry, such as 'gt-react/compat', 'gt-next/compat' or 'gt-react-native/compat', instead of the one from the package root. In gt-tanstack-start, call setupRouterGTIntegration({ router }) from 'gt-tanstack-start/compat'\",\n});\n\nexport function useDictionaryContext(): DictionaryContextType {\n const context = useContext(getDictionaryContext());\n if (!context) throw new Error(missingDictionaryProviderError);\n return context;\n}\n"],"mappings":"wLAwBA,MAAM,EAA6B,EAEjC,CACA,UAAW,YACX,IAAK,oBACL,mBACE,EAAwB,CACtB,OAAQ,iCACR,SAAU,QACV,aACE,+DACH,CAAC,CACL,CAAC,CAEF,SAAgB,GAEd,CAOA,OALK,EAA2B,eAAe,EAC7C,EAA2B,IACzB,EAAiD,IAAA,GAAU,CAC5D,CAEI,EAA2B,KAAK,CAGzC,MAAM,EAAiC,EAAwB,CAC7D,OAAQ,iCACR,SAAU,QACV,aACE,yEACF,IAAK,gFACL,IAAK,6QACN,CAAC,CAEF,SAAgB,GAA8C,CAC5D,IAAM,EAAU,EAAW,GAAsB,CAAC,CAClD,GAAI,CAAC,EAAS,MAAU,MAAM,EAA+B,CAC7D,OAAO"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./CompatStore.cjs`),t=require(`./DictionaryContext.cjs`);let n=require(`react/jsx-runtime`),r=require(`react`);const i=t.getDictionaryContext(),a={};function o({children:t,dictionaries:o=a,compatStore:s,onMissingDictionaryEntry:c,onMissingDictionaryObj:l}){let u=(0,r.useRef)(null);s==null&&u.current==null&&(u.current=new e.CompatStore);let d=s??u.current,f=(0,r.useMemo)(()=>({dictionariesSnapshot:o,compatStore:d,onMissingDictionaryEntry:c,onMissingDictionaryObj:l}),[o,d,c,l]);return(0,r.useEffect)(()=>{d.updateDictionaries(o)},[o,d]),(0,n.jsx)(i.Provider,{value:f,children:t})}exports.DictionaryProvider=o;
|
|
2
|
+
//# sourceMappingURL=DictionaryProvider.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DictionaryProvider.cjs","names":["getDictionaryContext","CompatStore"],"sources":["../../src/compat/DictionaryProvider.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, type ReactNode } from 'react';\nimport type { Dictionary } from 'gt-i18n/internal/compat';\nimport type { Locale } from 'gt-i18n/internal';\nimport { CompatStore } from './CompatStore';\nimport { getDictionaryContext } from './DictionaryContext';\nimport type { OnMissingDictionaryEntry, OnMissingDictionaryObj } from './types';\n\nexport type DictionaryProviderProps = {\n children?: ReactNode;\n // For streaming dictionaries from the server\n dictionaries?: Record<Locale, Dictionary>;\n // Defaults to a store owned by this provider\n compatStore?: CompatStore;\n // Custom override missing dictionary behavior for dev hot reload\n onMissingDictionaryEntry?: OnMissingDictionaryEntry;\n onMissingDictionaryObj?: OnMissingDictionaryObj;\n};\n\nconst DictionaryContext = getDictionaryContext();\nconst EMPTY_DICTIONARIES: Record<Locale, Dictionary> = {};\n\n/**\n * Shared dictionary provider logic for the key-based (compat) API. Not\n * user-facing: runtime packages wrap it with their own loading.\n */\nexport function DictionaryProvider({\n children,\n dictionaries = EMPTY_DICTIONARIES,\n compatStore: compatStoreProp,\n onMissingDictionaryEntry,\n onMissingDictionaryObj,\n}: DictionaryProviderProps) {\n const ownStoreRef = useRef<CompatStore | null>(null);\n if (compatStoreProp == null && ownStoreRef.current == null) {\n ownStoreRef.current = new CompatStore();\n }\n const compatStore = compatStoreProp ?? ownStoreRef.current!;\n\n const value = useMemo(\n () => ({\n dictionariesSnapshot: dictionaries,\n compatStore,\n onMissingDictionaryEntry,\n onMissingDictionaryObj,\n }),\n [\n dictionaries,\n compatStore,\n onMissingDictionaryEntry,\n onMissingDictionaryObj,\n ]\n );\n\n // Update the dictionary manager with data from the server, do not emit events\n useEffect(() => {\n compatStore.updateDictionaries(dictionaries);\n }, [dictionaries, compatStore]);\n\n return (\n <DictionaryContext.Provider value={value}>\n {children}\n </DictionaryContext.Provider>\n );\n}\n"],"mappings":"6KAkBA,MAAM,EAAoBA,EAAAA,sBAAsB,CAC1C,EAAiD,EAAE,CAMzD,SAAgB,EAAmB,CACjC,WACA,eAAe,EACf,YAAa,EACb,2BACA,0BAC0B,CAC1B,IAAM,GAAA,EAAA,EAAA,QAAyC,KAAK,CAChD,GAAmB,MAAQ,EAAY,SAAW,OACpD,EAAY,QAAU,IAAIC,EAAAA,aAE5B,IAAM,EAAc,GAAmB,EAAY,QAE7C,GAAA,EAAA,EAAA,cACG,CACL,qBAAsB,EACtB,cACA,2BACA,yBACD,EACD,CACE,EACA,EACA,EACA,EACD,CACF,CAOD,OAJA,EAAA,EAAA,eAAgB,CACd,EAAY,mBAAmB,EAAa,EAC3C,CAAC,EAAc,EAAY,CAAC,EAG7B,EAAA,EAAA,KAAC,EAAkB,SAAnB,CAAmC,QAChC,WAC0B,CAAA"}
|