gt-react 3.1.98 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/dist/client.d.ts +5 -10
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +8 -18
- package/dist/client.js.map +1 -1
- package/dist/hooks/useBrowserLocale.d.ts.map +1 -0
- package/dist/{client/hooks → hooks}/useBrowserLocale.js +3 -3
- package/dist/hooks/useBrowserLocale.js.map +1 -0
- package/dist/hooks/useDefaultLocale.d.ts.map +1 -0
- package/dist/hooks/useDefaultLocale.js +15 -0
- package/dist/hooks/useDefaultLocale.js.map +1 -0
- package/dist/hooks/useGT.d.ts.map +1 -0
- package/dist/{client/hooks → hooks}/useGT.js +5 -8
- package/dist/hooks/useGT.js.map +1 -0
- package/dist/hooks/useLocale.d.ts +5 -0
- package/dist/hooks/useLocale.d.ts.map +1 -0
- package/dist/hooks/useLocale.js +15 -0
- package/dist/hooks/useLocale.js.map +1 -0
- package/dist/index.d.ts +9 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -11
- package/dist/index.js.map +1 -1
- package/dist/internal/addGTIdentifier.d.ts +6 -0
- package/dist/internal/addGTIdentifier.d.ts.map +1 -0
- package/dist/internal/addGTIdentifier.js +110 -0
- package/dist/internal/addGTIdentifier.js.map +1 -0
- package/dist/internal/calculateHash.d.ts.map +1 -0
- package/dist/{primitives → internal}/calculateHash.js +12 -3
- package/dist/internal/calculateHash.js.map +1 -0
- package/dist/{primitives/dictionary → internal}/flattenDictionary.d.ts +2 -0
- package/dist/internal/flattenDictionary.d.ts.map +1 -0
- package/dist/{primitives/dictionary → internal}/flattenDictionary.js +12 -1
- package/dist/internal/flattenDictionary.js.map +1 -0
- package/dist/internal/writeChildrenAsObjects.d.ts +7 -0
- package/dist/internal/writeChildrenAsObjects.d.ts.map +1 -0
- package/dist/internal/writeChildrenAsObjects.js +74 -0
- package/dist/internal/writeChildrenAsObjects.js.map +1 -0
- package/dist/internal.d.ts +12 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +50 -0
- package/dist/internal.js.map +1 -0
- package/dist/{primitives/variables → plurals}/getPluralBranch.d.ts +1 -6
- package/dist/plurals/getPluralBranch.d.ts.map +1 -0
- package/dist/{primitives/variables → plurals}/getPluralBranch.js +25 -36
- package/dist/plurals/getPluralBranch.js.map +1 -0
- package/dist/primitives/primitives.d.ts +13 -0
- package/dist/primitives/primitives.d.ts.map +1 -0
- package/dist/primitives/primitives.js +15 -0
- package/dist/primitives/primitives.js.map +1 -0
- package/dist/primitives/settings.d.ts +4 -0
- package/dist/primitives/settings.d.ts.map +1 -0
- package/dist/primitives/settings.js +7 -0
- package/dist/primitives/settings.js.map +1 -0
- package/dist/primitives/types.d.ts +53 -0
- package/dist/primitives/types.d.ts.map +1 -0
- package/dist/{types/Variables.js → primitives/types.js} +1 -1
- package/dist/primitives/types.js.map +1 -0
- package/dist/provider/GTContext.d.ts +7 -0
- package/dist/provider/GTContext.d.ts.map +1 -0
- package/dist/provider/GTContext.js +16 -0
- package/dist/provider/GTContext.js.map +1 -0
- package/dist/provider/GTProvider.d.ts +12 -0
- package/dist/provider/GTProvider.d.ts.map +1 -0
- package/dist/provider/GTProvider.js +156 -0
- package/dist/provider/GTProvider.js.map +1 -0
- package/dist/provider/helpers/extractEntryMetadata.d.ts +6 -0
- package/dist/provider/helpers/extractEntryMetadata.d.ts.map +1 -0
- package/dist/provider/helpers/extractEntryMetadata.js +15 -0
- package/dist/provider/helpers/extractEntryMetadata.js.map +1 -0
- package/dist/provider/helpers/getDictionaryEntry.d.ts +3 -0
- package/dist/provider/helpers/getDictionaryEntry.d.ts.map +1 -0
- package/dist/provider/helpers/getDictionaryEntry.js +24 -0
- package/dist/provider/helpers/getDictionaryEntry.js.map +1 -0
- package/dist/provider/helpers/getGTProp.d.ts +7 -0
- package/dist/provider/helpers/getGTProp.d.ts.map +1 -0
- package/dist/provider/helpers/getGTProp.js +10 -0
- package/dist/provider/helpers/getGTProp.js.map +1 -0
- package/dist/provider/helpers/isValidDictionaryEntry.d.ts +20 -0
- package/dist/provider/helpers/isValidDictionaryEntry.d.ts.map +1 -0
- package/dist/{types/CreateGTProps.js → provider/helpers/isValidDictionaryEntry.js} +1 -1
- package/dist/provider/helpers/isValidDictionaryEntry.js.map +1 -0
- package/dist/provider/helpers/isVariableObject.d.ts +3 -0
- package/dist/provider/helpers/isVariableObject.d.ts.map +1 -0
- package/dist/provider/helpers/isVariableObject.js +17 -0
- package/dist/provider/helpers/isVariableObject.js.map +1 -0
- package/dist/provider/rendering/renderDefaultChildren.d.ts +7 -0
- package/dist/provider/rendering/renderDefaultChildren.d.ts.map +1 -0
- package/dist/provider/rendering/renderDefaultChildren.js +48 -0
- package/dist/provider/rendering/renderDefaultChildren.js.map +1 -0
- package/dist/provider/rendering/renderTranslatedChildren.d.ts +15 -0
- package/dist/provider/rendering/renderTranslatedChildren.d.ts.map +1 -0
- package/dist/provider/rendering/renderTranslatedChildren.js +142 -0
- package/dist/provider/rendering/renderTranslatedChildren.js.map +1 -0
- package/dist/{client/variables/ClientCurrency.d.ts → variables/Currency.d.ts} +3 -3
- package/dist/variables/Currency.d.ts.map +1 -0
- package/dist/{client/variables/ClientCurrency.js → variables/Currency.js} +5 -5
- package/dist/variables/Currency.js.map +1 -0
- package/dist/{client/variables/ClientDateTime.d.ts → variables/DateTime.d.ts} +3 -3
- package/dist/variables/DateTime.d.ts.map +1 -0
- package/dist/{client/variables/ClientDateTime.js → variables/DateTime.js} +5 -5
- package/dist/variables/DateTime.js.map +1 -0
- package/dist/{client/variables/ClientNum.d.ts → variables/Num.d.ts} +3 -3
- package/dist/variables/Num.d.ts.map +1 -0
- package/dist/{client/variables/ClientNum.js → variables/Num.js} +5 -5
- package/dist/variables/Num.js.map +1 -0
- package/dist/{server/variables/Var → variables}/Var.d.ts +1 -2
- package/dist/variables/Var.d.ts.map +1 -0
- package/dist/variables/Var.js +12 -0
- package/dist/variables/Var.js.map +1 -0
- package/dist/variables/_defaultVariableNames.d.ts +8 -0
- package/dist/variables/_defaultVariableNames.d.ts.map +1 -0
- package/dist/{primitives/variables/defaultVariableNames.js → variables/_defaultVariableNames.js} +2 -2
- package/dist/variables/_defaultVariableNames.js.map +1 -0
- package/dist/{primitives/variables/getVariableProps.d.ts → variables/_getVariableProps.d.ts} +2 -2
- package/dist/variables/_getVariableProps.d.ts.map +1 -0
- package/dist/{primitives/variables/getVariableProps.js → variables/_getVariableProps.js} +3 -3
- package/dist/variables/_getVariableProps.js.map +1 -0
- package/package.json +13 -36
- package/scratchpad.js +23 -37
- package/dist/client/ClientProvider.d.ts +0 -19
- package/dist/client/ClientProvider.d.ts.map +0 -1
- package/dist/client/ClientProvider.js +0 -69
- package/dist/client/ClientProvider.js.map +0 -1
- package/dist/client/client-only/GTClientProvider.d.ts +0 -32
- package/dist/client/client-only/GTClientProvider.d.ts.map +0 -1
- package/dist/client/client-only/GTClientProvider.js +0 -219
- package/dist/client/client-only/GTClientProvider.js.map +0 -1
- package/dist/client/helpers/ClientResolver.d.ts +0 -13
- package/dist/client/helpers/ClientResolver.d.ts.map +0 -1
- package/dist/client/helpers/ClientResolver.js +0 -83
- package/dist/client/helpers/ClientResolver.js.map +0 -1
- package/dist/client/helpers/handleRender.d.ts +0 -2
- package/dist/client/helpers/handleRender.d.ts.map +0 -1
- package/dist/client/helpers/handleRender.js +0 -103
- package/dist/client/helpers/handleRender.js.map +0 -1
- package/dist/client/helpers/renderClientChildren.d.ts +0 -19
- package/dist/client/helpers/renderClientChildren.d.ts.map +0 -1
- package/dist/client/helpers/renderClientChildren.js +0 -199
- package/dist/client/helpers/renderClientChildren.js.map +0 -1
- package/dist/client/helpers/renderDefaultLanguage.d.ts +0 -10
- package/dist/client/helpers/renderDefaultLanguage.d.ts.map +0 -1
- package/dist/client/helpers/renderDefaultLanguage.js +0 -80
- package/dist/client/helpers/renderDefaultLanguage.js.map +0 -1
- package/dist/client/hooks/useBrowserLocale.d.ts.map +0 -1
- package/dist/client/hooks/useBrowserLocale.js.map +0 -1
- package/dist/client/hooks/useDefaultLocale.d.ts.map +0 -1
- package/dist/client/hooks/useDefaultLocale.js +0 -13
- package/dist/client/hooks/useDefaultLocale.js.map +0 -1
- package/dist/client/hooks/useGT.d.ts.map +0 -1
- package/dist/client/hooks/useGT.js.map +0 -1
- package/dist/client/hooks/useLocale.d.ts +0 -5
- package/dist/client/hooks/useLocale.d.ts.map +0 -1
- package/dist/client/hooks/useLocale.js +0 -13
- package/dist/client/hooks/useLocale.js.map +0 -1
- package/dist/client/plural/ClientPlural.d.ts +0 -31
- package/dist/client/plural/ClientPlural.d.ts.map +0 -1
- package/dist/client/plural/ClientPlural.js +0 -51
- package/dist/client/plural/ClientPlural.js.map +0 -1
- package/dist/client/value/ClientValue.d.ts +0 -15
- package/dist/client/value/ClientValue.d.ts.map +0 -1
- package/dist/client/value/ClientValue.js +0 -23
- package/dist/client/value/ClientValue.js.map +0 -1
- package/dist/client/value/RenderClientVariable.d.ts +0 -6
- package/dist/client/value/RenderClientVariable.d.ts.map +0 -1
- package/dist/client/value/RenderClientVariable.js +0 -93
- package/dist/client/value/RenderClientVariable.js.map +0 -1
- package/dist/client/variables/ClientCurrency.d.ts.map +0 -1
- package/dist/client/variables/ClientCurrency.js.map +0 -1
- package/dist/client/variables/ClientDateTime.d.ts.map +0 -1
- package/dist/client/variables/ClientDateTime.js.map +0 -1
- package/dist/client/variables/ClientNum.d.ts.map +0 -1
- package/dist/client/variables/ClientNum.js.map +0 -1
- package/dist/client/variables/ClientVar.d.ts +0 -21
- package/dist/client/variables/ClientVar.d.ts.map +0 -1
- package/dist/client/variables/ClientVar.js +0 -22
- package/dist/client/variables/ClientVar.js.map +0 -1
- package/dist/config/I18NConfiguration.d.ts +0 -140
- package/dist/config/I18NConfiguration.d.ts.map +0 -1
- package/dist/config/I18NConfiguration.js +0 -428
- package/dist/config/I18NConfiguration.js.map +0 -1
- package/dist/config/LocalDictionaryManager.d.ts +0 -31
- package/dist/config/LocalDictionaryManager.d.ts.map +0 -1
- package/dist/config/LocalDictionaryManager.js +0 -139
- package/dist/config/LocalDictionaryManager.js.map +0 -1
- package/dist/config/RemoteDictionaryManager.d.ts +0 -59
- package/dist/config/RemoteDictionaryManager.d.ts.map +0 -1
- package/dist/config/RemoteDictionaryManager.js +0 -181
- package/dist/config/RemoteDictionaryManager.js.map +0 -1
- package/dist/config/local/getDefaultFromEnv.d.ts +0 -12
- package/dist/config/local/getDefaultFromEnv.d.ts.map +0 -1
- package/dist/config/local/getDefaultFromEnv.js +0 -21
- package/dist/config/local/getDefaultFromEnv.js.map +0 -1
- package/dist/dictionary/cloneDictionary.d.ts +0 -2
- package/dist/dictionary/cloneDictionary.d.ts.map +0 -1
- package/dist/dictionary/cloneDictionary.js +0 -42
- package/dist/dictionary/cloneDictionary.js.map +0 -1
- package/dist/dictionary/createTFunction.d.ts +0 -6
- package/dist/dictionary/createTFunction.d.ts.map +0 -1
- package/dist/dictionary/createTFunction.js +0 -73
- package/dist/dictionary/createTFunction.js.map +0 -1
- package/dist/dictionary/getDictionaryEntry.d.ts +0 -2
- package/dist/dictionary/getDictionaryEntry.d.ts.map +0 -1
- package/dist/dictionary/getDictionaryEntry.js +0 -15
- package/dist/dictionary/getDictionaryEntry.js.map +0 -1
- package/dist/index/determineLocale.d.ts +0 -10
- package/dist/index/determineLocale.d.ts.map +0 -1
- package/dist/index/determineLocale.js +0 -45
- package/dist/index/determineLocale.js.map +0 -1
- package/dist/middleware/cookieSettings.d.ts +0 -2
- package/dist/middleware/cookieSettings.d.ts.map +0 -1
- package/dist/middleware/cookieSettings.js +0 -5
- package/dist/middleware/cookieSettings.js.map +0 -1
- package/dist/middleware/createNextMiddleware.d.ts +0 -10
- package/dist/middleware/createNextMiddleware.d.ts.map +0 -1
- package/dist/middleware/createNextMiddleware.js +0 -154
- package/dist/middleware/createNextMiddleware.js.map +0 -1
- package/dist/middleware.d.ts +0 -3
- package/dist/middleware.d.ts.map +0 -1
- package/dist/middleware.js +0 -9
- package/dist/middleware.js.map +0 -1
- package/dist/next/imports/imports.d.ts +0 -6
- package/dist/next/imports/imports.d.ts.map +0 -1
- package/dist/next/imports/imports.js +0 -84
- package/dist/next/imports/imports.js.map +0 -1
- package/dist/next/requestFunctions.d.ts +0 -21
- package/dist/next/requestFunctions.d.ts.map +0 -1
- package/dist/next/requestFunctions.js +0 -59
- package/dist/next/requestFunctions.js.map +0 -1
- package/dist/next.d.ts +0 -38
- package/dist/next.d.ts.map +0 -1
- package/dist/next.js +0 -71
- package/dist/next.js.map +0 -1
- package/dist/primitives/calculateHash.d.ts.map +0 -1
- package/dist/primitives/calculateHash.js.map +0 -1
- package/dist/primitives/dictionary/flattenDictionary.d.ts.map +0 -1
- package/dist/primitives/dictionary/flattenDictionary.js.map +0 -1
- package/dist/primitives/dictionary/getDictionaryReference.d.ts +0 -8
- package/dist/primitives/dictionary/getDictionaryReference.d.ts.map +0 -1
- package/dist/primitives/dictionary/getDictionaryReference.js +0 -13
- package/dist/primitives/dictionary/getDictionaryReference.js.map +0 -1
- package/dist/primitives/rendering/getEntryMetadata.d.ts +0 -5
- package/dist/primitives/rendering/getEntryMetadata.d.ts.map +0 -1
- package/dist/primitives/rendering/getEntryMetadata.js +0 -42
- package/dist/primitives/rendering/getEntryMetadata.js.map +0 -1
- package/dist/primitives/rendering/getEntryTranslationType.d.ts +0 -10
- package/dist/primitives/rendering/getEntryTranslationType.d.ts.map +0 -1
- package/dist/primitives/rendering/getEntryTranslationType.js +0 -45
- package/dist/primitives/rendering/getEntryTranslationType.js.map +0 -1
- package/dist/primitives/rendering/isValidReactNode.d.ts +0 -15
- package/dist/primitives/rendering/isValidReactNode.d.ts.map +0 -1
- package/dist/primitives/rendering/isValidReactNode.js +0 -27
- package/dist/primitives/rendering/isValidReactNode.js.map +0 -1
- package/dist/primitives/translation/addGTIdentifier.d.ts +0 -11
- package/dist/primitives/translation/addGTIdentifier.d.ts.map +0 -1
- package/dist/primitives/translation/addGTIdentifier.js +0 -171
- package/dist/primitives/translation/addGTIdentifier.js.map +0 -1
- package/dist/primitives/translation/writeChildrenAsObjects.d.ts +0 -11
- package/dist/primitives/translation/writeChildrenAsObjects.d.ts.map +0 -1
- package/dist/primitives/translation/writeChildrenAsObjects.js +0 -128
- package/dist/primitives/translation/writeChildrenAsObjects.js.map +0 -1
- package/dist/primitives/variables/createValues.d.ts +0 -6
- package/dist/primitives/variables/createValues.d.ts.map +0 -1
- package/dist/primitives/variables/createValues.js +0 -27
- package/dist/primitives/variables/createValues.js.map +0 -1
- package/dist/primitives/variables/defaultVariableNames.d.ts +0 -3
- package/dist/primitives/variables/defaultVariableNames.d.ts.map +0 -1
- package/dist/primitives/variables/defaultVariableNames.js.map +0 -1
- package/dist/primitives/variables/getPluralBranch.d.ts.map +0 -1
- package/dist/primitives/variables/getPluralBranch.js.map +0 -1
- package/dist/primitives/variables/getVariableProps.d.ts.map +0 -1
- package/dist/primitives/variables/getVariableProps.js.map +0 -1
- package/dist/primitives/variables/isTargetVariable.d.ts +0 -3
- package/dist/primitives/variables/isTargetVariable.d.ts.map +0 -1
- package/dist/primitives/variables/isTargetVariable.js +0 -12
- package/dist/primitives/variables/isTargetVariable.js.map +0 -1
- package/dist/server/inline/Resolver.d.ts +0 -5
- package/dist/server/inline/Resolver.d.ts.map +0 -1
- package/dist/server/inline/Resolver.js +0 -59
- package/dist/server/inline/Resolver.js.map +0 -1
- package/dist/server/inline/T.d.ts +0 -15
- package/dist/server/inline/T.d.ts.map +0 -1
- package/dist/server/inline/T.js +0 -165
- package/dist/server/inline/T.js.map +0 -1
- package/dist/server/inline/createTComponent.d.ts +0 -9
- package/dist/server/inline/createTComponent.d.ts.map +0 -1
- package/dist/server/inline/createTComponent.js +0 -41
- package/dist/server/inline/createTComponent.js.map +0 -1
- package/dist/server/inline/renderChildren.d.ts +0 -19
- package/dist/server/inline/renderChildren.d.ts.map +0 -1
- package/dist/server/inline/renderChildren.js +0 -223
- package/dist/server/inline/renderChildren.js.map +0 -1
- package/dist/server/plural/InnerPlural.d.ts +0 -24
- package/dist/server/plural/InnerPlural.d.ts.map +0 -1
- package/dist/server/plural/InnerPlural.js +0 -38
- package/dist/server/plural/InnerPlural.js.map +0 -1
- package/dist/server/plural/createPluralComponent.d.ts +0 -8
- package/dist/server/plural/createPluralComponent.d.ts.map +0 -1
- package/dist/server/plural/createPluralComponent.js +0 -41
- package/dist/server/plural/createPluralComponent.js.map +0 -1
- package/dist/server/provider/GTProvider.d.ts +0 -11
- package/dist/server/provider/GTProvider.d.ts.map +0 -1
- package/dist/server/provider/GTProvider.js +0 -224
- package/dist/server/provider/GTProvider.js.map +0 -1
- package/dist/server/provider/createGTProviderComponent.d.ts +0 -6
- package/dist/server/provider/createGTProviderComponent.d.ts.map +0 -1
- package/dist/server/provider/createGTProviderComponent.js +0 -41
- package/dist/server/provider/createGTProviderComponent.js.map +0 -1
- package/dist/server/translate/createTranslateFunction.d.ts +0 -7
- package/dist/server/translate/createTranslateFunction.d.ts.map +0 -1
- package/dist/server/translate/createTranslateFunction.js +0 -109
- package/dist/server/translate/createTranslateFunction.js.map +0 -1
- package/dist/server/value/InnerValue.d.ts +0 -9
- package/dist/server/value/InnerValue.d.ts.map +0 -1
- package/dist/server/value/InnerValue.js +0 -28
- package/dist/server/value/InnerValue.js.map +0 -1
- package/dist/server/value/createValueComponent.d.ts +0 -9
- package/dist/server/value/createValueComponent.d.ts.map +0 -1
- package/dist/server/value/createValueComponent.js +0 -40
- package/dist/server/value/createValueComponent.js.map +0 -1
- package/dist/server/value/renderVariable.d.ts +0 -9
- package/dist/server/value/renderVariable.d.ts.map +0 -1
- package/dist/server/value/renderVariable.js +0 -77
- package/dist/server/value/renderVariable.js.map +0 -1
- package/dist/server/variables/Currency/Currency.d.ts +0 -15
- package/dist/server/variables/Currency/Currency.d.ts.map +0 -1
- package/dist/server/variables/Currency/Currency.js +0 -41
- package/dist/server/variables/Currency/Currency.js.map +0 -1
- package/dist/server/variables/Currency/createCurrencyComponent.d.ts +0 -8
- package/dist/server/variables/Currency/createCurrencyComponent.d.ts.map +0 -1
- package/dist/server/variables/Currency/createCurrencyComponent.js +0 -40
- package/dist/server/variables/Currency/createCurrencyComponent.js.map +0 -1
- package/dist/server/variables/DateTime/DateTime.d.ts +0 -13
- package/dist/server/variables/DateTime/DateTime.d.ts.map +0 -1
- package/dist/server/variables/DateTime/DateTime.js +0 -46
- package/dist/server/variables/DateTime/DateTime.js.map +0 -1
- package/dist/server/variables/DateTime/createDateTimeComponent.d.ts +0 -8
- package/dist/server/variables/DateTime/createDateTimeComponent.d.ts.map +0 -1
- package/dist/server/variables/DateTime/createDateTimeComponent.js +0 -40
- package/dist/server/variables/DateTime/createDateTimeComponent.js.map +0 -1
- package/dist/server/variables/Num/Num.d.ts +0 -14
- package/dist/server/variables/Num/Num.d.ts.map +0 -1
- package/dist/server/variables/Num/Num.js +0 -28
- package/dist/server/variables/Num/Num.js.map +0 -1
- package/dist/server/variables/Num/createNumComponent.d.ts +0 -8
- package/dist/server/variables/Num/createNumComponent.d.ts.map +0 -1
- package/dist/server/variables/Num/createNumComponent.js +0 -41
- package/dist/server/variables/Num/createNumComponent.js.map +0 -1
- package/dist/server/variables/Var/Var.d.ts.map +0 -1
- package/dist/server/variables/Var/Var.js +0 -24
- package/dist/server/variables/Var/Var.js.map +0 -1
- package/dist/server/variables/Var/createVarComponent.d.ts +0 -7
- package/dist/server/variables/Var/createVarComponent.d.ts.map +0 -1
- package/dist/server/variables/Var/createVarComponent.js +0 -40
- package/dist/server/variables/Var/createVarComponent.js.map +0 -1
- package/dist/server.d.ts +0 -45
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -169
- package/dist/server.js.map +0 -1
- package/dist/types/CreateGTProps.d.ts +0 -23
- package/dist/types/CreateGTProps.d.ts.map +0 -1
- package/dist/types/CreateGTProps.js.map +0 -1
- package/dist/types/GeneralTranslationInterface.d.ts +0 -122
- package/dist/types/GeneralTranslationInterface.d.ts.map +0 -1
- package/dist/types/GeneralTranslationInterface.js +0 -3
- package/dist/types/GeneralTranslationInterface.js.map +0 -1
- package/dist/types/SourceTargetTypes.d.ts +0 -17
- package/dist/types/SourceTargetTypes.d.ts.map +0 -1
- package/dist/types/SourceTargetTypes.js +0 -3
- package/dist/types/SourceTargetTypes.js.map +0 -1
- package/dist/types/Variables.d.ts +0 -83
- package/dist/types/Variables.d.ts.map +0 -1
- package/dist/types/Variables.js.map +0 -1
- package/dist/types/defaultGTProps.d.ts +0 -20
- package/dist/types/defaultGTProps.d.ts.map +0 -1
- package/dist/types/defaultGTProps.js +0 -31
- package/dist/types/defaultGTProps.js.map +0 -1
- /package/dist/{client/hooks → hooks}/useBrowserLocale.d.ts +0 -0
- /package/dist/{client/hooks → hooks}/useDefaultLocale.d.ts +0 -0
- /package/dist/{client/hooks → hooks}/useGT.d.ts +0 -0
- /package/dist/{primitives → internal}/calculateHash.d.ts +0 -0
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration type for RemoteDictionaryManager.
|
|
3
|
-
*/
|
|
4
|
-
type RemoteDictionaryConfig = {
|
|
5
|
-
cacheURL: string;
|
|
6
|
-
projectID: string;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Manages remote dictionaries for translation purposes.
|
|
10
|
-
*/
|
|
11
|
-
export declare class RemoteDictionaryManager {
|
|
12
|
-
private config;
|
|
13
|
-
private dictionaryMap;
|
|
14
|
-
private fetchPromises;
|
|
15
|
-
private requestedTranslations;
|
|
16
|
-
/**
|
|
17
|
-
* Creates an instance of RemoteDictionaryManager.
|
|
18
|
-
*/
|
|
19
|
-
constructor();
|
|
20
|
-
/**
|
|
21
|
-
* Sets the configuration for the RemoteDictionaryManager.
|
|
22
|
-
* @param {Partial<RemoteDictionaryConfig>} newConfig - The new configuration to apply.
|
|
23
|
-
*/
|
|
24
|
-
setConfig(newConfig: Partial<RemoteDictionaryConfig>): void;
|
|
25
|
-
/**
|
|
26
|
-
* Fetches a dictionary from the remote cache.
|
|
27
|
-
* @param {string} reference - The dictionary reference.
|
|
28
|
-
* @returns {Promise<Record<string, any> | null>} The fetched dictionary or null if not found.
|
|
29
|
-
*/
|
|
30
|
-
private _fetchDictionary;
|
|
31
|
-
/**
|
|
32
|
-
* Retrieves a dictionary based on locale and dictionary name.
|
|
33
|
-
* @param {string} locale - The locale of the dictionary.
|
|
34
|
-
* @param {string} dictionaryName - The name of the dictionary.
|
|
35
|
-
* @returns {Promise<Record<string, any> | null>} The dictionary data or null if not found.
|
|
36
|
-
*/
|
|
37
|
-
getDictionary(locale: string, dictionaryName: string): Promise<Record<string, any> | null>;
|
|
38
|
-
/**
|
|
39
|
-
* Sets a new entry in the specified dictionary.
|
|
40
|
-
* @param {string} locale - The locale of the dictionary.
|
|
41
|
-
* @param {string} dictionaryName - The name of the dictionary.
|
|
42
|
-
* @param {string} key - The key for the new entry.
|
|
43
|
-
* @param {string} [id=key] - The id for the new entry, defaults to key if not provided.
|
|
44
|
-
* @param {any} translation - The translation value.
|
|
45
|
-
* @returns {boolean} True if the entry was set successfully, false otherwise.
|
|
46
|
-
*/
|
|
47
|
-
setDictionary(locale: string, dictionaryName: string, key: string, id: string | undefined, translation: any): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Marks a translation as requested for a given locale and dictionary
|
|
50
|
-
*/
|
|
51
|
-
setTranslationRequested(locale: string, dictionaryName: string): void;
|
|
52
|
-
/**
|
|
53
|
-
* Checks if a translation has been requested for a given locale and dictionary
|
|
54
|
-
*/
|
|
55
|
-
getTranslationRequested(locale: string, dictionaryName: string): boolean;
|
|
56
|
-
}
|
|
57
|
-
declare const remoteDictionaryManager: RemoteDictionaryManager;
|
|
58
|
-
export default remoteDictionaryManager;
|
|
59
|
-
//# sourceMappingURL=RemoteDictionaryManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteDictionaryManager.d.ts","sourceRoot":"","sources":["../../src/config/RemoteDictionaryManager.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,KAAK,sBAAsB,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAA;AAED;;GAEG;AACH,qBAAa,uBAAuB;IAChC,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,aAAa,CAAmC;IACxD,OAAO,CAAC,aAAa,CAAmD;IACxE,OAAO,CAAC,qBAAqB,CAAuB;IAEpD;;OAEG;;IAWH;;;OAGG;IACH,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,IAAI;IAI3D;;;;OAIG;YACW,gBAAgB;IAa9B;;;;;OAKG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAqBhG;;;;;;;;OAQG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,YAAM,EAAE,WAAW,EAAE,GAAG,GAAG,OAAO;IAQ/G;;OAEG;IACH,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAK9D;;OAEG;IACH,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO;CAK3E;AAED,QAAA,MAAM,uBAAuB,yBAAgC,CAAC;AAC9D,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
-
};
|
|
52
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.RemoteDictionaryManager = void 0;
|
|
54
|
-
var getDictionaryReference_1 = __importDefault(require("../primitives/dictionary/getDictionaryReference"));
|
|
55
|
-
/**
|
|
56
|
-
* Manages remote dictionaries for translation purposes.
|
|
57
|
-
*/
|
|
58
|
-
var RemoteDictionaryManager = /** @class */ (function () {
|
|
59
|
-
/**
|
|
60
|
-
* Creates an instance of RemoteDictionaryManager.
|
|
61
|
-
*/
|
|
62
|
-
function RemoteDictionaryManager() {
|
|
63
|
-
this.config = {
|
|
64
|
-
cacheURL: "https://cache.gtx.dev",
|
|
65
|
-
projectID: ""
|
|
66
|
-
};
|
|
67
|
-
this.dictionaryMap = new Map();
|
|
68
|
-
this.fetchPromises = new Map();
|
|
69
|
-
this.requestedTranslations = new Map();
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Sets the configuration for the RemoteDictionaryManager.
|
|
73
|
-
* @param {Partial<RemoteDictionaryConfig>} newConfig - The new configuration to apply.
|
|
74
|
-
*/
|
|
75
|
-
RemoteDictionaryManager.prototype.setConfig = function (newConfig) {
|
|
76
|
-
this.config = __assign(__assign({}, this.config), newConfig);
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* Fetches a dictionary from the remote cache.
|
|
80
|
-
* @param {string} reference - The dictionary reference.
|
|
81
|
-
* @returns {Promise<Record<string, any> | null>} The fetched dictionary or null if not found.
|
|
82
|
-
*/
|
|
83
|
-
RemoteDictionaryManager.prototype._fetchDictionary = function (reference) {
|
|
84
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
85
|
-
var response, result, error_1;
|
|
86
|
-
return __generator(this, function (_a) {
|
|
87
|
-
switch (_a.label) {
|
|
88
|
-
case 0:
|
|
89
|
-
_a.trys.push([0, 3, , 4]);
|
|
90
|
-
return [4 /*yield*/, fetch("".concat(this.config.cacheURL, "/").concat(this.config.projectID, "/").concat(reference))];
|
|
91
|
-
case 1:
|
|
92
|
-
response = _a.sent();
|
|
93
|
-
return [4 /*yield*/, response.json()];
|
|
94
|
-
case 2:
|
|
95
|
-
result = _a.sent();
|
|
96
|
-
if (Object.keys(result).length) {
|
|
97
|
-
return [2 /*return*/, result];
|
|
98
|
-
}
|
|
99
|
-
return [3 /*break*/, 4];
|
|
100
|
-
case 3:
|
|
101
|
-
error_1 = _a.sent();
|
|
102
|
-
console.error('Remote dictionary error:', error_1);
|
|
103
|
-
return [3 /*break*/, 4];
|
|
104
|
-
case 4: return [2 /*return*/, null];
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* Retrieves a dictionary based on locale and dictionary name.
|
|
111
|
-
* @param {string} locale - The locale of the dictionary.
|
|
112
|
-
* @param {string} dictionaryName - The name of the dictionary.
|
|
113
|
-
* @returns {Promise<Record<string, any> | null>} The dictionary data or null if not found.
|
|
114
|
-
*/
|
|
115
|
-
RemoteDictionaryManager.prototype.getDictionary = function (locale, dictionaryName) {
|
|
116
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
117
|
-
var reference, fetchPromise, retrievedDictionary;
|
|
118
|
-
return __generator(this, function (_a) {
|
|
119
|
-
switch (_a.label) {
|
|
120
|
-
case 0:
|
|
121
|
-
reference = (0, getDictionaryReference_1.default)(locale, dictionaryName);
|
|
122
|
-
if (this.dictionaryMap.has(reference)) {
|
|
123
|
-
return [2 /*return*/, this.dictionaryMap.get(reference) || null];
|
|
124
|
-
}
|
|
125
|
-
if (!this.fetchPromises.has(reference)) return [3 /*break*/, 2];
|
|
126
|
-
return [4 /*yield*/, this.fetchPromises.get(reference)];
|
|
127
|
-
case 1: return [2 /*return*/, (_a.sent()) || null];
|
|
128
|
-
case 2:
|
|
129
|
-
fetchPromise = this._fetchDictionary(reference);
|
|
130
|
-
this.fetchPromises.set(reference, fetchPromise);
|
|
131
|
-
return [4 /*yield*/, fetchPromise];
|
|
132
|
-
case 3:
|
|
133
|
-
retrievedDictionary = _a.sent();
|
|
134
|
-
this.fetchPromises.delete(reference);
|
|
135
|
-
if (retrievedDictionary) {
|
|
136
|
-
this.dictionaryMap.set(reference, retrievedDictionary);
|
|
137
|
-
}
|
|
138
|
-
return [2 /*return*/, retrievedDictionary];
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
/**
|
|
144
|
-
* Sets a new entry in the specified dictionary.
|
|
145
|
-
* @param {string} locale - The locale of the dictionary.
|
|
146
|
-
* @param {string} dictionaryName - The name of the dictionary.
|
|
147
|
-
* @param {string} key - The key for the new entry.
|
|
148
|
-
* @param {string} [id=key] - The id for the new entry, defaults to key if not provided.
|
|
149
|
-
* @param {any} translation - The translation value.
|
|
150
|
-
* @returns {boolean} True if the entry was set successfully, false otherwise.
|
|
151
|
-
*/
|
|
152
|
-
RemoteDictionaryManager.prototype.setDictionary = function (locale, dictionaryName, key, id, translation) {
|
|
153
|
-
var _a;
|
|
154
|
-
if (id === void 0) { id = key; }
|
|
155
|
-
if (!(locale && dictionaryName && key && id && translation))
|
|
156
|
-
return false;
|
|
157
|
-
var reference = (0, getDictionaryReference_1.default)(locale, dictionaryName);
|
|
158
|
-
var currentDictionary = this.dictionaryMap.get(reference) || {};
|
|
159
|
-
this.dictionaryMap.set(reference, __assign(__assign({}, currentDictionary), (_a = {}, _a[id] = { k: key, t: translation }, _a)));
|
|
160
|
-
return true;
|
|
161
|
-
};
|
|
162
|
-
/**
|
|
163
|
-
* Marks a translation as requested for a given locale and dictionary
|
|
164
|
-
*/
|
|
165
|
-
RemoteDictionaryManager.prototype.setTranslationRequested = function (locale, dictionaryName) {
|
|
166
|
-
var reference = (0, getDictionaryReference_1.default)(locale, dictionaryName);
|
|
167
|
-
this.requestedTranslations.set(reference, true);
|
|
168
|
-
};
|
|
169
|
-
/**
|
|
170
|
-
* Checks if a translation has been requested for a given locale and dictionary
|
|
171
|
-
*/
|
|
172
|
-
RemoteDictionaryManager.prototype.getTranslationRequested = function (locale, dictionaryName) {
|
|
173
|
-
var reference = (0, getDictionaryReference_1.default)(locale, dictionaryName);
|
|
174
|
-
return this.requestedTranslations.get(reference) ? true : false;
|
|
175
|
-
};
|
|
176
|
-
return RemoteDictionaryManager;
|
|
177
|
-
}());
|
|
178
|
-
exports.RemoteDictionaryManager = RemoteDictionaryManager;
|
|
179
|
-
var remoteDictionaryManager = new RemoteDictionaryManager();
|
|
180
|
-
exports.default = remoteDictionaryManager;
|
|
181
|
-
//# sourceMappingURL=RemoteDictionaryManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteDictionaryManager.js","sourceRoot":"","sources":["../../src/config/RemoteDictionaryManager.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Retrieves the value of an environment variable as a string.
|
|
3
|
-
*
|
|
4
|
-
* This function checks if the `process` object is defined and if the specified environment
|
|
5
|
-
* variable is set. If both conditions are met, it returns the value of the environment
|
|
6
|
-
* variable. If not, it returns an empty string.
|
|
7
|
-
*
|
|
8
|
-
* @param {string} VARIABLE - The name of the environment variable to retrieve.
|
|
9
|
-
* @returns {string} The value of the environment variable, or an empty string if the variable is not set.
|
|
10
|
-
*/
|
|
11
|
-
export default function getDefaultFromEnv(VARIABLE: string): string;
|
|
12
|
-
//# sourceMappingURL=getDefaultFromEnv.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getDefaultFromEnv.d.ts","sourceRoot":"","sources":["../../../src/config/local/getDefaultFromEnv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKlE"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = getDefaultFromEnv;
|
|
4
|
-
/**
|
|
5
|
-
* Retrieves the value of an environment variable as a string.
|
|
6
|
-
*
|
|
7
|
-
* This function checks if the `process` object is defined and if the specified environment
|
|
8
|
-
* variable is set. If both conditions are met, it returns the value of the environment
|
|
9
|
-
* variable. If not, it returns an empty string.
|
|
10
|
-
*
|
|
11
|
-
* @param {string} VARIABLE - The name of the environment variable to retrieve.
|
|
12
|
-
* @returns {string} The value of the environment variable, or an empty string if the variable is not set.
|
|
13
|
-
*/
|
|
14
|
-
function getDefaultFromEnv(VARIABLE) {
|
|
15
|
-
var _a;
|
|
16
|
-
if (typeof process !== 'undefined' && ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a[VARIABLE])) {
|
|
17
|
-
return process.env[VARIABLE];
|
|
18
|
-
}
|
|
19
|
-
return '';
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=getDefaultFromEnv.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getDefaultFromEnv.js","sourceRoot":"","sources":["../../../src/config/local/getDefaultFromEnv.ts"],"names":[],"mappings":";;AAUA,oCAKC;AAfD;;;;;;;;;GASG;AACH,SAAwB,iBAAiB,CAAC,QAAgB;;IACtD,IAAI,OAAO,OAAO,KAAK,WAAW,KAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,0CAAG,QAAQ,CAAC,CAAA,EAAE,CAAC;QAC7D,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAW,CAAC;IAC3C,CAAC;IACD,OAAO,EAAE,CAAC;AACd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cloneDictionary.d.ts","sourceRoot":"","sources":["../../src/dictionary/cloneDictionary.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,uBAgBtE"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = cloneDictionary;
|
|
7
|
-
var react_1 = __importDefault(require("react"));
|
|
8
|
-
var getEntryMetadata_1 = __importDefault(require("../primitives/rendering/getEntryMetadata"));
|
|
9
|
-
function cloneMetadata(metadata) {
|
|
10
|
-
if (react_1.default.isValidElement(metadata)) {
|
|
11
|
-
return react_1.default.cloneElement(metadata);
|
|
12
|
-
}
|
|
13
|
-
if (typeof metadata !== 'object' || metadata === null) {
|
|
14
|
-
return metadata;
|
|
15
|
-
}
|
|
16
|
-
var clonedObj = {};
|
|
17
|
-
for (var key in metadata) {
|
|
18
|
-
if (metadata.hasOwnProperty(key)) {
|
|
19
|
-
clonedObj[key] = cloneMetadata(metadata[key]);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return clonedObj;
|
|
23
|
-
}
|
|
24
|
-
function cloneDictionary(dictionary) {
|
|
25
|
-
var clonedDictionary = {};
|
|
26
|
-
for (var _i = 0, _a = Object.keys(dictionary); _i < _a.length; _i++) {
|
|
27
|
-
var id = _a[_i];
|
|
28
|
-
var _b = (0, getEntryMetadata_1.default)(dictionary[id]), entry = _b.entry, metadata = _b.metadata;
|
|
29
|
-
var clonedEntry = entry;
|
|
30
|
-
if (typeof entry !== 'function') {
|
|
31
|
-
clonedEntry = react_1.default.isValidElement(entry) ? react_1.default.cloneElement(entry) : structuredClone(entry);
|
|
32
|
-
}
|
|
33
|
-
if (metadata) {
|
|
34
|
-
var clonedMetadata = cloneMetadata(metadata);
|
|
35
|
-
clonedDictionary[id] = [clonedEntry, clonedMetadata];
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
clonedDictionary[id] = clonedEntry;
|
|
39
|
-
}
|
|
40
|
-
return clonedDictionary;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=cloneDictionary.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cloneDictionary.js","sourceRoot":"","sources":["../../src/dictionary/cloneDictionary.ts"],"names":[],"mappings":";;;;;AAoBA,kCAgBC;AApCD,gDAA0B;AAC1B,8FAAwE;AAExE,SAAS,aAAa,CAAC,QAA6B;IAChD,IAAI,eAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjC,OAAO,eAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACpD,OAAO,QAAQ,CAAC;IACpB,CAAC;IACD,IAAM,SAAS,GAAwB,EAAE,CAAC;IAC1C,KAAK,IAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QACzB,IAAI,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/B,SAAS,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAClD,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAGD,SAAwB,eAAe,CAAC,UAA+B;IACnE,IAAM,gBAAgB,GAAwB,EAAE,CAAC;IACjD,KAAiB,UAAuB,EAAvB,KAAA,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAvB,cAAuB,EAAvB,IAAuB,EAAE,CAAC;QAAtC,IAAM,EAAE,SAAA;QACH,IAAA,KAAsB,IAAA,0BAAgB,EAAC,UAAU,CAAC,EAAE,CAAC,CAAC,EAApD,KAAK,WAAA,EAAE,QAAQ,cAAqC,CAAC;QAC7D,IAAI,WAAW,GAAG,KAAK,CAAC;QACxB,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;YAC9B,WAAW,GAAG,eAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,eAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACnG,CAAC;QACD,IAAI,QAAQ,EAAE,CAAC;YACX,IAAI,cAAc,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;YAC7C,gBAAgB,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;YACrD,SAAS;QACb,CAAC;QACD,gBAAgB,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC;IACvC,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC5B,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import I18NConfiguration from "../config/I18NConfiguration";
|
|
2
|
-
export type tOptions = {
|
|
3
|
-
[key: string]: any;
|
|
4
|
-
};
|
|
5
|
-
export default function createTFunction(I18NConfig: I18NConfiguration, T: any, translate: any, dictionary?: Record<string, any>): (id: string, options?: tOptions, f?: Function) => JSX.Element | Promise<string>;
|
|
6
|
-
//# sourceMappingURL=createTFunction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createTFunction.d.ts","sourceRoot":"","sources":["../../src/dictionary/createTFunction.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAO5D,MAAM,MAAM,QAAQ,GAAG;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACrB,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,UAAU,EAAE,iBAAiB,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,sBAA6B,QAE5G,MAAM,YAAW,QAAQ,MAAW,QAAQ,KAAG,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAgErG"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.default = createTFunction;
|
|
29
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
30
|
-
var InnerValue_1 = __importDefault(require("../server/value/InnerValue"));
|
|
31
|
-
var InnerPlural_1 = __importDefault(require("../server/plural/InnerPlural"));
|
|
32
|
-
var getEntryMetadata_1 = __importDefault(require("../primitives/rendering/getEntryMetadata"));
|
|
33
|
-
var getEntryTranslationType_1 = __importDefault(require("../primitives/rendering/getEntryTranslationType"));
|
|
34
|
-
var getDictionaryEntry_1 = __importDefault(require("./getDictionaryEntry"));
|
|
35
|
-
function createTFunction(I18NConfig, T, translate, dictionary) {
|
|
36
|
-
if (dictionary === void 0) { dictionary = I18NConfig.getDictionary(); }
|
|
37
|
-
return function t(id, options, f) {
|
|
38
|
-
if (options === void 0) { options = {}; }
|
|
39
|
-
var raw = (0, getDictionaryEntry_1.default)(id, dictionary);
|
|
40
|
-
var _a = (0, getEntryMetadata_1.default)(raw), entry = _a.entry, metadata = _a.metadata;
|
|
41
|
-
if (Object.keys(entry).length === 0 && entry.constructor === Object) {
|
|
42
|
-
throw new Error("Dictionary contains an empty object. This usually happens when you try to use a client-side function as an entry in a server-side dictionary. Check your dictionary entry with id \"".concat(id, "\"."));
|
|
43
|
-
}
|
|
44
|
-
// Checks to see if options are valid
|
|
45
|
-
var _b = (0, getEntryTranslationType_1.default)(raw), translationType = _b.type, isFunction = _b.isFunction;
|
|
46
|
-
// Turn into an async function if the target is a string
|
|
47
|
-
if (translationType === "string")
|
|
48
|
-
return translate(entry, __assign({ id: id }, metadata));
|
|
49
|
-
// execute function with options
|
|
50
|
-
if (typeof f === 'function') {
|
|
51
|
-
entry = f(options);
|
|
52
|
-
}
|
|
53
|
-
else if (isFunction) {
|
|
54
|
-
entry = entry(options);
|
|
55
|
-
}
|
|
56
|
-
// If a plural or value is required
|
|
57
|
-
if (Object.keys(options).length) {
|
|
58
|
-
var locales = [I18NConfig.getLocale(), I18NConfig.getDefaultLocale()];
|
|
59
|
-
var _c = metadata || {}, ranges = _c.ranges, zero = _c.zero, one = _c.one, two = _c.two, few = _c.few, many = _c.many, other = _c.other, singular = _c.singular, dual = _c.dual, plural = _c.plural, tOptions = __rest(_c, ["ranges", "zero", "one", "two", "few", "many", "other", "singular", "dual", "plural"]);
|
|
60
|
-
if (translationType === "plural") {
|
|
61
|
-
if (!options || typeof options.n !== 'number') {
|
|
62
|
-
throw new Error("ID \"".concat(id, "\" requires an \"n\" option.\n\ne.g. t(\"").concat(id, "\", { n: 1 })"));
|
|
63
|
-
}
|
|
64
|
-
var innerProps = __assign({ ranges: ranges, zero: zero, one: one, two: two, few: few, many: many, other: other, singular: singular, dual: dual, plural: plural }, options);
|
|
65
|
-
return ((0, jsx_runtime_1.jsx)(T, __assign({ id: id }, tOptions, { children: (0, jsx_runtime_1.jsx)(InnerPlural_1.default, __assign({ n: options.n, locales: locales }, innerProps, { children: entry })) })));
|
|
66
|
-
}
|
|
67
|
-
return ((0, jsx_runtime_1.jsx)(T, __assign({ id: id }, tOptions, { children: (0, jsx_runtime_1.jsx)(InnerValue_1.default, { values: options, locales: locales, children: entry }) })));
|
|
68
|
-
}
|
|
69
|
-
// base case, just return T with an inner fragment (</>) for consistency
|
|
70
|
-
return ((0, jsx_runtime_1.jsx)(T, __assign({ id: id }, metadata, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: entry }) })));
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=createTFunction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createTFunction.js","sourceRoot":"","sources":["../../src/dictionary/createTFunction.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getDictionaryEntry.d.ts","sourceRoot":"","sources":["../../src/dictionary/getDictionaryEntry.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,CAQlG"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = getDictionaryEntry;
|
|
4
|
-
function getDictionaryEntry(id, dictionary) {
|
|
5
|
-
if (!id || typeof id !== 'string' || !dictionary || typeof dictionary !== 'object')
|
|
6
|
-
return null;
|
|
7
|
-
var current = dictionary;
|
|
8
|
-
var dictionaryPath = id.split(".");
|
|
9
|
-
for (var _i = 0, dictionaryPath_1 = dictionaryPath; _i < dictionaryPath_1.length; _i++) {
|
|
10
|
-
var key = dictionaryPath_1[_i];
|
|
11
|
-
current = current === null || current === void 0 ? void 0 : current[key];
|
|
12
|
-
}
|
|
13
|
-
return current;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=getDictionaryEntry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getDictionaryEntry.js","sourceRoot":"","sources":["../../src/dictionary/getDictionaryEntry.ts"],"names":[],"mappings":";;AAAA,qCAQC;AARD,SAAwB,kBAAkB,CAAC,EAAU,EAAE,UAA+B;IAClF,IAAI,CAAC,EAAE,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,CAAC,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAChG,IAAI,OAAO,GAAG,UAAU,CAAC;IACzB,IAAI,cAAc,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnC,KAAkB,UAAc,EAAd,iCAAc,EAAd,4BAAc,EAAd,IAAc,EAAE,CAAC;QAA9B,IAAM,GAAG,uBAAA;QACV,OAAO,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Determines the best matching locale from a list of possible locales.
|
|
3
|
-
*
|
|
4
|
-
* @param {string[]} [approvedLocales] - A list of locales that are approved.
|
|
5
|
-
* @param {string[] | string} [locales] - A list or a single string of possible locales.
|
|
6
|
-
* @param {string} [defaultLocale=''] - The default locale to return if no match is found.
|
|
7
|
-
* @returns {string} - The best matching locale or the default locale.
|
|
8
|
-
*/
|
|
9
|
-
export default function determineLocale(approvedLocales?: string[], locales?: string[] | string, defaultLocale?: string): string;
|
|
10
|
-
//# sourceMappingURL=determineLocale.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"determineLocale.d.ts","sourceRoot":"","sources":["../../src/index/determineLocale.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,aAAa,GAAE,MAAW,GAAG,MAAM,CA4BnI"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = determineLocale;
|
|
4
|
-
var generaltranslation_1 = require("generaltranslation");
|
|
5
|
-
/**
|
|
6
|
-
* Determines the best matching locale from a list of possible locales.
|
|
7
|
-
*
|
|
8
|
-
* @param {string[]} [approvedLocales] - A list of locales that are approved.
|
|
9
|
-
* @param {string[] | string} [locales] - A list or a single string of possible locales.
|
|
10
|
-
* @param {string} [defaultLocale=''] - The default locale to return if no match is found.
|
|
11
|
-
* @returns {string} - The best matching locale or the default locale.
|
|
12
|
-
*/
|
|
13
|
-
function determineLocale(approvedLocales, locales, defaultLocale) {
|
|
14
|
-
if (defaultLocale === void 0) { defaultLocale = ''; }
|
|
15
|
-
if (typeof locales === 'string')
|
|
16
|
-
locales = [locales];
|
|
17
|
-
if (!locales || !Array.isArray(locales))
|
|
18
|
-
return defaultLocale;
|
|
19
|
-
// if no approved locales, anything goes
|
|
20
|
-
if (!approvedLocales)
|
|
21
|
-
return locales[0];
|
|
22
|
-
// check for an exact match
|
|
23
|
-
for (var _i = 0, locales_1 = locales; _i < locales_1.length; _i++) {
|
|
24
|
-
var locale = locales_1[_i];
|
|
25
|
-
for (var _a = 0, approvedLocales_1 = approvedLocales; _a < approvedLocales_1.length; _a++) {
|
|
26
|
-
var approvedLocale = approvedLocales_1[_a];
|
|
27
|
-
if (locale === approvedLocale) {
|
|
28
|
-
return approvedLocale;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// check for a linguistic match
|
|
33
|
-
for (var _b = 0, locales_2 = locales; _b < locales_2.length; _b++) {
|
|
34
|
-
var locale = locales_2[_b];
|
|
35
|
-
for (var _c = 0, approvedLocales_2 = approvedLocales; _c < approvedLocales_2.length; _c++) {
|
|
36
|
-
var approvedLocale = approvedLocales_2[_c];
|
|
37
|
-
if ((0, generaltranslation_1.isSameLanguage)(locale, approvedLocale)) {
|
|
38
|
-
return approvedLocale;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
// default
|
|
43
|
-
return defaultLocale;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=determineLocale.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"determineLocale.js","sourceRoot":"","sources":["../../src/index/determineLocale.ts"],"names":[],"mappings":";;AAUA,kCA4BC;AAtCD,yDAAoD;AAEpD;;;;;;;GAOG;AACH,SAAwB,eAAe,CAAC,eAA0B,EAAE,OAA2B,EAAE,aAA0B;IAA1B,8BAAA,EAAA,kBAA0B;IAEvH,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC;IACrD,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO,aAAa,CAAC;IAE9D,wCAAwC;IACxC,IAAI,CAAC,eAAe;QAAE,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;IAExC,2BAA2B;IAC3B,KAAqB,UAAO,EAAP,mBAAO,EAAP,qBAAO,EAAP,IAAO,EAAE,CAAC;QAA1B,IAAM,MAAM,gBAAA;QACb,KAA6B,UAAe,EAAf,mCAAe,EAAf,6BAAe,EAAf,IAAe,EAAE,CAAC;YAA1C,IAAM,cAAc,wBAAA;YACrB,IAAI,MAAM,KAAK,cAAc,EAAE,CAAC;gBAC5B,OAAO,cAAc,CAAC;YAC1B,CAAC;QACL,CAAC;IACL,CAAC;IAED,+BAA+B;IAC/B,KAAqB,UAAO,EAAP,mBAAO,EAAP,qBAAO,EAAP,IAAO,EAAE,CAAC;QAA1B,IAAM,MAAM,gBAAA;QACb,KAA6B,UAAe,EAAf,mCAAe,EAAf,6BAAe,EAAf,IAAe,EAAE,CAAC;YAA1C,IAAM,cAAc,wBAAA;YACrB,IAAI,IAAA,mCAAc,EAAC,MAAM,EAAE,cAAc,CAAC,EAAE,CAAC;gBACzC,OAAO,cAAc,CAAC;YAC1B,CAAC;QACL,CAAC;IACL,CAAC;IAED,UAAU;IACV,OAAO,aAAa,CAAC;AACzB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cookieSettings.d.ts","sourceRoot":"","sources":["../../src/middleware/cookieSettings.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,8BAA8B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cookieSettings.js","sourceRoot":"","sources":["../../src/middleware/cookieSettings.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,2BAA2B,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Middleware to set a cookie based on the locale.
|
|
3
|
-
* @param {NextRequest} req - The incoming request object.
|
|
4
|
-
*/
|
|
5
|
-
export default function createNextMiddleware({ defaultLocale, approvedLocales, localeRouting }?: {
|
|
6
|
-
defaultLocale: string;
|
|
7
|
-
approvedLocales?: string[];
|
|
8
|
-
localeRouting: boolean;
|
|
9
|
-
}): (req: any) => any;
|
|
10
|
-
//# sourceMappingURL=createNextMiddleware.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createNextMiddleware.d.ts","sourceRoot":"","sources":["../../src/middleware/createNextMiddleware.ts"],"names":[],"mappings":"AAoDA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EACzC,aAAoB,EAAE,eAAe,EAAE,aAAoB,EAC9D,GAAE;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAChC,SAE7B,GAAG,SAkHnB"}
|