gt-react 3.2.0 → 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 +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/addGTIdentifier.d.ts +2 -7
- package/dist/internal/addGTIdentifier.d.ts.map +1 -1
- package/dist/internal/addGTIdentifier.js +62 -117
- package/dist/internal/addGTIdentifier.js.map +1 -1
- package/dist/internal/calculateHash.js +12 -3
- package/dist/internal/calculateHash.js.map +1 -1
- package/dist/internal/flattenDictionary.d.ts +2 -0
- package/dist/internal/flattenDictionary.d.ts.map +1 -1
- package/dist/internal/flattenDictionary.js +12 -1
- package/dist/internal/flattenDictionary.js.map +1 -1
- package/dist/internal/writeChildrenAsObjects.d.ts +1 -5
- package/dist/internal/writeChildrenAsObjects.d.ts.map +1 -1
- package/dist/internal/writeChildrenAsObjects.js +28 -66
- package/dist/internal/writeChildrenAsObjects.js.map +1 -1
- package/dist/internal.d.ts +7 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +36 -3
- package/dist/internal.js.map +1 -1
- package/dist/plurals/getPluralBranch.d.ts.map +1 -0
- package/dist/{primitives/variables → plurals}/getPluralBranch.js +24 -18
- 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/InitGTProps.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 → 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 +4 -30
- package/scratchpad.js +21 -48
- package/dist/client/ClientProvider.d.ts +0 -19
- package/dist/client/ClientProvider.d.ts.map +0 -1
- package/dist/client/ClientProvider.js +0 -65
- package/dist/client/ClientProvider.js.map +0 -1
- package/dist/client/client-only/GTClientProvider.d.ts +0 -31
- package/dist/client/client-only/GTClientProvider.d.ts.map +0 -1
- package/dist/client/client-only/GTClientProvider.js +0 -204
- package/dist/client/client-only/GTClientProvider.js.map +0 -1
- package/dist/client/errors/createComponentError.d.ts +0 -2
- package/dist/client/errors/createComponentError.d.ts.map +0 -1
- package/dist/client/errors/createComponentError.js +0 -7
- package/dist/client/errors/createComponentError.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 -28
- package/dist/client/plural/ClientPlural.d.ts.map +0 -1
- package/dist/client/plural/ClientPlural.js +0 -50
- 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 -22
- 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/client-index.d.ts +0 -11
- package/dist/client-index.d.ts.map +0 -1
- package/dist/client-index.js +0 -140
- package/dist/client-index.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 -437
- 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 -75
- 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/dictionary/getDictionaryReference.d.ts +0 -8
- package/dist/dictionary/getDictionaryReference.d.ts.map +0 -1
- package/dist/dictionary/getDictionaryReference.js +0 -13
- package/dist/dictionary/getDictionaryReference.js.map +0 -1
- package/dist/dictionary/getEntryMetadata.d.ts +0 -5
- package/dist/dictionary/getEntryMetadata.d.ts.map +0 -1
- package/dist/dictionary/getEntryMetadata.js +0 -42
- package/dist/dictionary/getEntryMetadata.js.map +0 -1
- package/dist/dictionary/getEntryTranslationType.d.ts +0 -10
- package/dist/dictionary/getEntryTranslationType.d.ts.map +0 -1
- package/dist/dictionary/getEntryTranslationType.js +0 -45
- package/dist/dictionary/getEntryTranslationType.js.map +0 -1
- package/dist/internal/determineLocale.d.ts +0 -10
- package/dist/internal/determineLocale.d.ts.map +0 -1
- package/dist/internal/determineLocale.js +0 -45
- package/dist/internal/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.server.d.ts +0 -38
- package/dist/next.server.d.ts.map +0 -1
- package/dist/next.server.js +0 -71
- package/dist/next.server.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/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 -149
- 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 -22
- 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 -10
- package/dist/server/provider/GTProvider.d.ts.map +0 -1
- package/dist/server/provider/GTProvider.js +0 -228
- 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 -102
- 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.d.ts +0 -15
- package/dist/server/variables/Currency.d.ts.map +0 -1
- package/dist/server/variables/Currency.js +0 -41
- package/dist/server/variables/Currency.js.map +0 -1
- package/dist/server/variables/DateTime.d.ts +0 -13
- package/dist/server/variables/DateTime.d.ts.map +0 -1
- package/dist/server/variables/DateTime.js +0 -46
- package/dist/server/variables/DateTime.js.map +0 -1
- package/dist/server/variables/Num.d.ts +0 -14
- package/dist/server/variables/Num.d.ts.map +0 -1
- package/dist/server/variables/Num.js +0 -28
- package/dist/server/variables/Num.js.map +0 -1
- package/dist/server/variables/Var.d.ts.map +0 -1
- package/dist/server/variables/Var.js +0 -24
- package/dist/server/variables/Var.js.map +0 -1
- package/dist/server-index.d.ts +0 -11
- package/dist/server-index.d.ts.map +0 -1
- package/dist/server-index.js +0 -289
- package/dist/server-index.js.map +0 -1
- package/dist/types/GeneralTranslationInterface.d.ts +0 -128
- 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/InitGTProps.d.ts +0 -23
- package/dist/types/InitGTProps.d.ts.map +0 -1
- package/dist/types/InitGTProps.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/variables → plurals}/getPluralBranch.d.ts +0 -0
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
-
var Var = function (_a) {
|
|
16
|
-
var children = _a.children, _b = _a.name, name = _b === void 0 ? "value" : _b, defaultValue = _a.defaultValue, props = __rest(_a, ["children", "name", "defaultValue"]);
|
|
17
|
-
var generaltranslation = props["data-generaltranslation"];
|
|
18
|
-
if (typeof children !== 'undefined' && typeof defaultValue === 'undefined')
|
|
19
|
-
defaultValue = children;
|
|
20
|
-
return ((0, jsx_runtime_1.jsx)("span", { "data-generaltranslation": generaltranslation, "data-gt-variable-name": name, "data-gt-variable-type": "variable", "data-gt-unformatted-value": defaultValue, children: defaultValue }));
|
|
21
|
-
};
|
|
22
|
-
Var.gtTransformation = "variable-variable"; // keep this because Var is imported in other functions
|
|
23
|
-
exports.default = Var;
|
|
24
|
-
//# sourceMappingURL=Var.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Var.js","sourceRoot":"","sources":["../../../src/server/variables/Var.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,IAAM,GAAG,GAAG,UAAC,EAKZ;IALc,IAAA,QAAQ,cAAA,EAAE,YAAc,EAAd,IAAI,mBAAG,OAAO,KAAA,EAAE,YAAY,kBAAA,EAAK,KAAK,cAAlD,oCAAoD,CAAF;IAOnD,IAA2B,kBAAkB,GAAK,KAAK,2BAAV,CAAW;IAEhE,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,YAAY,KAAK,WAAW;QAAE,YAAY,GAAG,QAAQ,CAAC;IAEpG,OAAO,CACH,4DAC6B,kBAAkB,2BACpB,IAAI,2BACJ,UAAU,+BACN,YAAY,YAEtC,YAAY,GACV,CACV,CAAC;AAEN,CAAC,CAAC;AAEF,GAAG,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,CAAC,uDAAuD;AAEnG,kBAAe,GAAG,CAAC"}
|
package/dist/server-index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import GeneralTranslation from "./types/GeneralTranslationInterface";
|
|
2
|
-
import InitGTProps from "./types/InitGTProps";
|
|
3
|
-
import Variables from './types/Variables';
|
|
4
|
-
export declare function initGT({ apiKey, projectID, cacheURL, baseURL, remoteSource, automaticTranslation, approvedLocales, defaultLocale, getLocale, renderPrevious, renderMethod, // "replace", "hang", "subtle"
|
|
5
|
-
renderTimeout, dictionaryName, dictionary, translations, maxConcurrentRequests, batchInterval, getMetadata, ...metadata }?: InitGTProps): GeneralTranslation;
|
|
6
|
-
export declare function initVariables({ approvedLocales, defaultLocale, getLocale }?: {
|
|
7
|
-
approvedLocales?: string[];
|
|
8
|
-
defaultLocale?: string;
|
|
9
|
-
getLocale?: () => string;
|
|
10
|
-
}): Variables;
|
|
11
|
-
//# sourceMappingURL=server-index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server-index.d.ts","sourceRoot":"","sources":["../src/server-index.tsx"],"names":[],"mappings":"AASA,OAAO,kBAAkB,MAAM,qCAAqC,CAAC;AACrE,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,SAAS,MAAM,mBAAmB,CAAA;AAgCzC,wBAAgB,MAAM,CAAC,EAEnB,MAA8B,EAC9B,SAAoC,EACpC,QAAkC,EAClC,OAAgC,EAChC,YAA0C,EAC1C,oBAA0D,EAE1D,eAAe,EACf,aAAoE,EACpE,SAAoC,EAEpC,cAA8C,EAC9C,YAA0C,EAAE,8BAA8B;AAC1E,aAA4C,EAE5C,cAA8C,EAC9C,UAAsC,EACtC,YAAY,EAEZ,qBAA4D,EAC5D,aAA4C,EAE5C,WAAwC,EACxC,GAAG,QAAQ,EACd,GAAE,WAiBF,GAAG,kBAAkB,CAuIrB;AAED,wBAAgB,aAAa,CAAC,EAC1B,eAAe,EACf,aAAoE,EACpE,SAA0C,EAC7C,GAAE;IACC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC;CAI5B,GAAG,SAAS,CAqGZ"}
|
package/dist/server-index.js
DELETED
|
@@ -1,289 +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.initGT = initGT;
|
|
29
|
-
exports.initVariables = initVariables;
|
|
30
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
31
|
-
var client_1 = require("./client");
|
|
32
|
-
var createComponentError_1 = __importDefault(require("./client/errors/createComponentError"));
|
|
33
|
-
var ClientCurrency_1 = __importDefault(require("./client/variables/ClientCurrency"));
|
|
34
|
-
var ClientDateTime_1 = __importDefault(require("./client/variables/ClientDateTime"));
|
|
35
|
-
var ClientNum_1 = __importDefault(require("./client/variables/ClientNum"));
|
|
36
|
-
var ClientVar_1 = __importDefault(require("./client/variables/ClientVar"));
|
|
37
|
-
var getDefaultFromEnv_1 = __importDefault(require("./config/local/getDefaultFromEnv"));
|
|
38
|
-
var defaultGTProps_1 = __importDefault(require("./types/defaultGTProps"));
|
|
39
|
-
// ----- SINGLETONS ----- //
|
|
40
|
-
var I18NConfig = null;
|
|
41
|
-
var createTComponent = null;
|
|
42
|
-
var createTranslationFunction = null;
|
|
43
|
-
var createValueComponent = null;
|
|
44
|
-
var createPluralComponent = null;
|
|
45
|
-
var createTFunction = null;
|
|
46
|
-
var createGTProviderComponent = null;
|
|
47
|
-
var VarComponent = null;
|
|
48
|
-
var NumComponent = null;
|
|
49
|
-
var CurrencyComponent = null;
|
|
50
|
-
var DateTimeComponent = null;
|
|
51
|
-
// ----- HELPER FUNCTIONS ----- //
|
|
52
|
-
var isClient = function () { return typeof window !== 'undefined'; };
|
|
53
|
-
// ----- MAIN FUNCTIONS ----- //
|
|
54
|
-
function initGT(_a) {
|
|
55
|
-
if (_a === void 0) { _a = {
|
|
56
|
-
apiKey: defaultGTProps_1.default.apiKey,
|
|
57
|
-
projectID: defaultGTProps_1.default.projectID,
|
|
58
|
-
cacheURL: defaultGTProps_1.default.cacheURL,
|
|
59
|
-
baseURL: defaultGTProps_1.default.baseURL,
|
|
60
|
-
remoteSource: defaultGTProps_1.default.remoteSource,
|
|
61
|
-
automaticTranslation: defaultGTProps_1.default.automaticTranslation,
|
|
62
|
-
defaultLocale: defaultGTProps_1.default.defaultLocale,
|
|
63
|
-
getLocale: defaultGTProps_1.default.getLocale,
|
|
64
|
-
renderPrevious: defaultGTProps_1.default.renderPrevious,
|
|
65
|
-
renderMethod: defaultGTProps_1.default.renderMethod,
|
|
66
|
-
renderTimeout: defaultGTProps_1.default.renderTimeout,
|
|
67
|
-
dictionaryName: defaultGTProps_1.default.dictionaryName,
|
|
68
|
-
dictionary: defaultGTProps_1.default.dictionary,
|
|
69
|
-
maxConcurrentRequests: defaultGTProps_1.default.maxConcurrentRequests,
|
|
70
|
-
batchInterval: defaultGTProps_1.default.batchInterval,
|
|
71
|
-
getMetadata: defaultGTProps_1.default.getMetadata
|
|
72
|
-
}; }
|
|
73
|
-
var
|
|
74
|
-
// Cloud integration
|
|
75
|
-
_b = _a.apiKey,
|
|
76
|
-
// Cloud integration
|
|
77
|
-
apiKey = _b === void 0 ? defaultGTProps_1.default.apiKey : _b, _c = _a.projectID, projectID = _c === void 0 ? defaultGTProps_1.default.projectID : _c, _d = _a.cacheURL, cacheURL = _d === void 0 ? defaultGTProps_1.default.cacheURL : _d, _e = _a.baseURL, baseURL = _e === void 0 ? defaultGTProps_1.default.baseURL : _e, _f = _a.remoteSource, remoteSource = _f === void 0 ? defaultGTProps_1.default.remoteSource : _f, _g = _a.automaticTranslation, automaticTranslation = _g === void 0 ? defaultGTProps_1.default.automaticTranslation : _g,
|
|
78
|
-
// Locale info
|
|
79
|
-
approvedLocales = _a.approvedLocales, _h = _a.defaultLocale, defaultLocale = _h === void 0 ? (approvedLocales === null || approvedLocales === void 0 ? void 0 : approvedLocales[0]) || defaultGTProps_1.default.defaultLocale : _h, _j = _a.getLocale, getLocale = _j === void 0 ? function () { return 'en-US'; } : _j,
|
|
80
|
-
// Rendering
|
|
81
|
-
_k = _a.renderPrevious,
|
|
82
|
-
// Rendering
|
|
83
|
-
renderPrevious = _k === void 0 ? defaultGTProps_1.default.renderPrevious : _k, _l = _a.renderMethod, renderMethod = _l === void 0 ? defaultGTProps_1.default.renderMethod : _l, // "replace", "hang", "subtle"
|
|
84
|
-
_m = _a.renderTimeout, // "replace", "hang", "subtle"
|
|
85
|
-
renderTimeout = _m === void 0 ? defaultGTProps_1.default.renderTimeout : _m,
|
|
86
|
-
// Dictionaries
|
|
87
|
-
_o = _a.dictionaryName,
|
|
88
|
-
// Dictionaries
|
|
89
|
-
dictionaryName = _o === void 0 ? defaultGTProps_1.default.dictionaryName : _o, _p = _a.dictionary, dictionary = _p === void 0 ? defaultGTProps_1.default.dictionary : _p, translations = _a.translations,
|
|
90
|
-
// Batching config
|
|
91
|
-
_q = _a.maxConcurrentRequests,
|
|
92
|
-
// Batching config
|
|
93
|
-
maxConcurrentRequests = _q === void 0 ? defaultGTProps_1.default.maxConcurrentRequests : _q, _r = _a.batchInterval, batchInterval = _r === void 0 ? defaultGTProps_1.default.batchInterval : _r,
|
|
94
|
-
// Other metadata
|
|
95
|
-
_s = _a.getMetadata,
|
|
96
|
-
// Other metadata
|
|
97
|
-
getMetadata = _s === void 0 ? defaultGTProps_1.default.getMetadata : _s, metadata = __rest(_a, ["apiKey", "projectID", "cacheURL", "baseURL", "remoteSource", "automaticTranslation", "approvedLocales", "defaultLocale", "getLocale", "renderPrevious", "renderMethod", "renderTimeout", "dictionaryName", "dictionary", "translations", "maxConcurrentRequests", "batchInterval", "getMetadata"]);
|
|
98
|
-
var initI18NConfig = function () {
|
|
99
|
-
if (I18NConfig)
|
|
100
|
-
return I18NConfig;
|
|
101
|
-
I18NConfig = new (require('./config/I18NConfiguration').default)(__assign({ apiKey: apiKey, projectID: projectID, cacheURL: cacheURL, baseURL: baseURL, remoteSource: remoteSource, automaticTranslation: automaticTranslation, getLocale: getLocale, defaultLocale: defaultLocale, approvedLocales: approvedLocales, renderPrevious: renderPrevious, renderMethod: renderMethod, renderTimeout: renderTimeout, dictionary: dictionary, dictionaryName: (0, getDefaultFromEnv_1.default)('GT_DICTIONARY_NAME') || dictionaryName, // override from .env
|
|
102
|
-
translations: translations, maxConcurrentRequests: maxConcurrentRequests, batchInterval: batchInterval, getMetadata: getMetadata }, metadata));
|
|
103
|
-
};
|
|
104
|
-
var T = function (params) {
|
|
105
|
-
if (isClient()) {
|
|
106
|
-
return (0, createComponentError_1.default)('T')(params);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
initI18NConfig();
|
|
110
|
-
return (createTComponent || (createTComponent = require('./server/inline/createTComponent').default))(I18NConfig)(params);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
var translate = function () {
|
|
114
|
-
var params = [];
|
|
115
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
116
|
-
params[_i] = arguments[_i];
|
|
117
|
-
}
|
|
118
|
-
if (isClient()) {
|
|
119
|
-
throw new Error("translate(".concat(JSON.stringify(params === null || params === void 0 ? void 0 : params[0]), ") on the client-side can't access your API keys."));
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
initI18NConfig();
|
|
123
|
-
return (createTranslationFunction || (createTranslationFunction = require('./server/translate/createTranslateFunction').default))(I18NConfig).apply(void 0, params);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
var Value = function (params) {
|
|
127
|
-
if (isClient()) {
|
|
128
|
-
return (0, createComponentError_1.default)('Value')(params);
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
initI18NConfig();
|
|
132
|
-
return (createValueComponent || (createValueComponent = require('./server/value/createValueComponent').default))(T, I18NConfig.getLocale(), I18NConfig.getDefaultLocale())(params);
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
var Plural = function (params) {
|
|
136
|
-
if (isClient()) {
|
|
137
|
-
return (0, createComponentError_1.default)('Plural')(params);
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
initI18NConfig();
|
|
141
|
-
return (createPluralComponent || (createPluralComponent = require('./server/plural/createPluralComponent').default))(T, I18NConfig.getLocale(), I18NConfig.getDefaultLocale())(params);
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
var t = function () {
|
|
145
|
-
var params = [];
|
|
146
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
147
|
-
params[_i] = arguments[_i];
|
|
148
|
-
}
|
|
149
|
-
if (isClient()) {
|
|
150
|
-
throw new Error("t(\"".concat(params === null || params === void 0 ? void 0 : params[0], "\") on the client-side, which won't work because of how React handles hooks. Try t = getGT() or useGT() to get the t() function instead."));
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
initI18NConfig();
|
|
154
|
-
return (createTFunction || (createTFunction = require('./dictionary/createTFunction').default))(I18NConfig, T, translate).apply(void 0, params);
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
var getGT = function () {
|
|
158
|
-
var params = [];
|
|
159
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
160
|
-
params[_i] = arguments[_i];
|
|
161
|
-
}
|
|
162
|
-
if (isClient()) {
|
|
163
|
-
return client_1.useGT;
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
initI18NConfig();
|
|
167
|
-
return (params[0] ? (createTFunction || (createTFunction = require('./dictionary/createTFunction').default))(I18NConfig, T, translate, I18NConfig.getDictionaryEntry(params[0])) : t);
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
var GTProvider = function (params) {
|
|
171
|
-
if (isClient()) {
|
|
172
|
-
var children = params.children, props = __rest(params, ["children"]);
|
|
173
|
-
return ((0, jsx_runtime_1.jsx)(client_1.GTClientProvider, __assign({ projectID: projectID, dictionary: dictionary, dictionaryName: dictionaryName, approvedLocales: approvedLocales, defaultLocale: defaultLocale, remoteSource: remoteSource, cacheURL: cacheURL, translations: translations }, props, { children: children })));
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
initI18NConfig();
|
|
177
|
-
return (createGTProviderComponent || (createGTProviderComponent = require('./server/provider/createGTProviderComponent').default))(I18NConfig)(params);
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
var getDefaultLocale = function () {
|
|
181
|
-
if (isClient()) {
|
|
182
|
-
return (0, client_1.useDefaultLocale)();
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
initI18NConfig();
|
|
186
|
-
return I18NConfig.getDefaultLocale();
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
return {
|
|
190
|
-
T: T,
|
|
191
|
-
translate: translate,
|
|
192
|
-
Value: Value,
|
|
193
|
-
Plural: Plural,
|
|
194
|
-
t: t,
|
|
195
|
-
getGT: getGT,
|
|
196
|
-
GTProvider: GTProvider,
|
|
197
|
-
getLocale: function () {
|
|
198
|
-
if (isClient()) {
|
|
199
|
-
return (0, client_1.useLocale)();
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
initI18NConfig();
|
|
203
|
-
return I18NConfig.getLocale();
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
getDefaultLocale: getDefaultLocale
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
function initVariables(_a) {
|
|
210
|
-
var _b = _a === void 0 ? {
|
|
211
|
-
defaultLocale: defaultGTProps_1.default.defaultLocale,
|
|
212
|
-
getLocale: defaultGTProps_1.default.getLocale
|
|
213
|
-
} : _a, approvedLocales = _b.approvedLocales, _c = _b.defaultLocale, defaultLocale = _c === void 0 ? (approvedLocales === null || approvedLocales === void 0 ? void 0 : approvedLocales[0]) || defaultGTProps_1.default.defaultLocale : _c, _d = _b.getLocale, getLocale = _d === void 0 ? function () { return defaultLocale; } : _d;
|
|
214
|
-
var Var = function (params) {
|
|
215
|
-
if (params === void 0) { params = {}; }
|
|
216
|
-
var children = params.children, props = __rest(params, ["children"]);
|
|
217
|
-
if (isClient()) {
|
|
218
|
-
return ((0, jsx_runtime_1.jsx)(ClientVar_1.default, __assign({}, props, { children: children })));
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
var Var_1 = (VarComponent || (VarComponent = require('./server/variables/Var').default));
|
|
222
|
-
return ((0, jsx_runtime_1.jsx)(Var_1, __assign({}, props, { children: children })));
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
Var.gtTransformation = "variable-variable";
|
|
226
|
-
var Num = function (params) {
|
|
227
|
-
if (params === void 0) { params = {}; }
|
|
228
|
-
var children = params.children, props = __rest(params, ["children"]);
|
|
229
|
-
if (isClient()) {
|
|
230
|
-
return ((0, jsx_runtime_1.jsx)(ClientNum_1.default, __assign({}, props, { children: children })));
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
var locales = [getLocale(), defaultLocale];
|
|
234
|
-
var Num_1 = (NumComponent || (NumComponent = require('./server/variables/Num').default));
|
|
235
|
-
return ((0, jsx_runtime_1.jsx)(Num_1, __assign({ locales: locales }, props, { children: children })));
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
Num.gtTransformation = "variable-number";
|
|
239
|
-
var DateTime = function (params) {
|
|
240
|
-
if (params === void 0) { params = {}; }
|
|
241
|
-
var children = params.children, props = __rest(params, ["children"]);
|
|
242
|
-
if (isClient()) {
|
|
243
|
-
return ((0, jsx_runtime_1.jsx)(ClientDateTime_1.default, __assign({}, props, { children: children })));
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
var locales = [getLocale(), defaultLocale];
|
|
247
|
-
var DateTime_1 = (DateTimeComponent || (DateTimeComponent = require('./server/variables/DateTime').default));
|
|
248
|
-
return ((0, jsx_runtime_1.jsx)(DateTime_1, __assign({ locales: locales }, props, { children: children })));
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
DateTime.gtTransformation = "variable-datetime";
|
|
252
|
-
var Currency = function (params) {
|
|
253
|
-
if (params === void 0) { params = {}; }
|
|
254
|
-
var children = params.children, props = __rest(params, ["children"]);
|
|
255
|
-
if (isClient()) {
|
|
256
|
-
return ((0, jsx_runtime_1.jsx)(ClientCurrency_1.default, __assign({}, props, { children: children })));
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
var locales = [getLocale(), defaultLocale];
|
|
260
|
-
var Currency_1 = (CurrencyComponent || (CurrencyComponent = require('./server/variables/Currency').default));
|
|
261
|
-
return ((0, jsx_runtime_1.jsx)(Currency_1, __assign({ locales: locales }, props, { children: children })));
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
Currency.gtTransformation = "variable-currency";
|
|
265
|
-
var getDefaultLocale = function () {
|
|
266
|
-
if (isClient()) {
|
|
267
|
-
return (0, client_1.useDefaultLocale)();
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
return defaultLocale;
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
return {
|
|
274
|
-
Var: Var,
|
|
275
|
-
Num: Num,
|
|
276
|
-
Currency: Currency,
|
|
277
|
-
DateTime: DateTime,
|
|
278
|
-
getLocale: function () {
|
|
279
|
-
if (isClient()) {
|
|
280
|
-
return (0, client_1.useLocale)();
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
return getLocale();
|
|
284
|
-
}
|
|
285
|
-
},
|
|
286
|
-
getDefaultLocale: getDefaultLocale
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
//# sourceMappingURL=server-index.js.map
|
package/dist/server-index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server-index.js","sourceRoot":"","sources":["../src/server-index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,wBAkLC;AAED,sCAgHC;;AA9UD,mCAAgF;AAChF,8FAAwE;AACxE,qFAA+D;AAC/D,qFAA+D;AAC/D,2EAAqD;AACrD,2EAAqD;AACrD,uFAAiE;AACjE,0EAAoD;AAKpD,4BAA4B;AAE5B,IAAI,UAAU,GAAQ,IAAI,CAAC;AAE3B,IAAI,gBAAgB,GAAQ,IAAI,CAAC;AAEjC,IAAI,yBAAyB,GAAQ,IAAI,CAAC;AAE1C,IAAI,oBAAoB,GAAQ,IAAI,CAAC;AAErC,IAAI,qBAAqB,GAAQ,IAAI,CAAC;AAEtC,IAAI,eAAe,GAAQ,IAAI,CAAC;AAEhC,IAAI,yBAAyB,GAAQ,IAAI,CAAC;AAE1C,IAAI,YAAY,GAAQ,IAAI,CAAC;AAE7B,IAAI,YAAY,GAAQ,IAAI,CAAC;AAE7B,IAAI,iBAAiB,GAAQ,IAAI,CAAC;AAElC,IAAI,iBAAiB,GAAQ,IAAI,CAAC;AAElC,kCAAkC;AA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|
2
|
-
type GeneralTranslation = {
|
|
3
|
-
/**
|
|
4
|
-
* Server-side function which gets an entry from the default dictionary and wraps it in the `<T>` component.
|
|
5
|
-
*
|
|
6
|
-
* `id` - (string) - ID of the item in the dictionary.
|
|
7
|
-
*
|
|
8
|
-
* `options?` - ({ [key: string]: any }) - Variable values. See https://docs.generaltranslation.com for a full list.
|
|
9
|
-
*/
|
|
10
|
-
t: (id: string, options?: {
|
|
11
|
-
n?: number;
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
}) => any;
|
|
14
|
-
/**
|
|
15
|
-
* Server-side function which prepares a `t()` function by prepending an ID. Useful with large nested dictionaries. You can also import `t()` directly.
|
|
16
|
-
* Equivalent to `useGT()` on the client-side.
|
|
17
|
-
*
|
|
18
|
-
* `id` - (string) - ID to be prepended.
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
getGT: (id?: string) => (id: string, options?: {
|
|
22
|
-
n?: number;
|
|
23
|
-
[key: string]: any;
|
|
24
|
-
}) => any;
|
|
25
|
-
/**
|
|
26
|
-
* The `<GTProvider>` component. Used on the server, but all children must be client components (or able to run on the client). Provides translations and locale data to its children using React's context API. Children are able to use the `useGT`, `useLocale`, and `useDefaultLocale` hooks.
|
|
27
|
-
*
|
|
28
|
-
* If `id` or `dictionary` components are not provided, translations of all entries in the default `createGT` dictionary are provided.
|
|
29
|
-
*
|
|
30
|
-
* These translations can be accessed on the client using the `useGT` hook.
|
|
31
|
-
*
|
|
32
|
-
* `children?` - (any) - Children to which context is provided.
|
|
33
|
-
*
|
|
34
|
-
* `id?` - (string) - If provided, only the items in the initial dictionary which fall under that ID will be provided to the client, alongside any additional items in the `dictionary` prop. Any new translations created by this component will be assigned (`id + '.'`) as a prefix.
|
|
35
|
-
*
|
|
36
|
-
* `dictionary?` - (Record<string, any>) - Object representing a dictionary, where keys are strings and the values are strings or React children, which are translated and sent to the client. Advanced: dictionary entries can also be arbitrary promises which are resolved and provided the client.
|
|
37
|
-
*
|
|
38
|
-
* `...props` - ([key: string]: any) - Optional metadata which will override the global `gt-react` configuration. See https://docs.generaltranslation.com for a full list of possible props.
|
|
39
|
-
*/
|
|
40
|
-
GTProvider: ComponentType<{
|
|
41
|
-
children?: any;
|
|
42
|
-
id?: string;
|
|
43
|
-
[key: string]: any;
|
|
44
|
-
}>;
|
|
45
|
-
/**
|
|
46
|
-
* The `<T>` component. Translates its ReactNode children into the user's locale.
|
|
47
|
-
*
|
|
48
|
-
* `children?` - (any) - Children to translate.
|
|
49
|
-
*
|
|
50
|
-
* `id?` - (string) - Specifies an ID in the target dictionary for the created translation. Used to prevent storing unnecessary translations by overwriting previous translations with the same ID. Defaults to a hash of the component's children.
|
|
51
|
-
*
|
|
52
|
-
* `...props` - ([key: string]: any) - Optional metadata which will override the global `gt-react` configuration. See https://docs.generaltranslation.com for a full list of possible props.
|
|
53
|
-
*/
|
|
54
|
-
T: ComponentType<{
|
|
55
|
-
children?: any;
|
|
56
|
-
id?: string;
|
|
57
|
-
[key: string]: any;
|
|
58
|
-
}>;
|
|
59
|
-
/**
|
|
60
|
-
* Translates a string asynchronously, storing the result in the translation dictionary.
|
|
61
|
-
*
|
|
62
|
-
* `content` - (string) - Text content to translate into the user's language.
|
|
63
|
-
*
|
|
64
|
-
* `options?` - ({ [key: string]: any }) - Other parameters. See https://docs.generaltranslation.com for a full list.
|
|
65
|
-
*
|
|
66
|
-
* `options.targetLanguage?` - (string) - A BCP 47 language tag which represents the language to translate into. Defaults to the user's locale.
|
|
67
|
-
*
|
|
68
|
-
* `options.id?` - (string) - Specifies an ID in the target dictionary for the created translation. Used to prevent storing unnecessary translations by overwriting previous translations with the same ID. Defaults to `content`. (string)
|
|
69
|
-
*/
|
|
70
|
-
translate: (content: string, options?: {
|
|
71
|
-
targetLanguage?: string;
|
|
72
|
-
id?: string;
|
|
73
|
-
[key: string]: any;
|
|
74
|
-
}) => Promise<string>;
|
|
75
|
-
/**
|
|
76
|
-
* Type of <T> translation component which renders content around variables.
|
|
77
|
-
*
|
|
78
|
-
* `children?` - (any) - The default content to render if no conditions are met.
|
|
79
|
-
*
|
|
80
|
-
* `values?` - (Record<string, any>) - A set of values used for conditional rendering.
|
|
81
|
-
*/
|
|
82
|
-
Value: ComponentType<{
|
|
83
|
-
children?: any;
|
|
84
|
-
values: Record<string, any>;
|
|
85
|
-
}>;
|
|
86
|
-
/**
|
|
87
|
-
* Type of <T> translation component which renders content around numbers.
|
|
88
|
-
*
|
|
89
|
-
* `children?` - (any) - The default content to render if no plural conditions are met.
|
|
90
|
-
*
|
|
91
|
-
* `n` - (number) - The number to evaluate against defined branches or conditions.
|
|
92
|
-
*
|
|
93
|
-
* `zero?` - (ReactNode) - Content to render when the number is zero.
|
|
94
|
-
*
|
|
95
|
-
* `one?` - (ReactNode) - Content to render when the number is one.
|
|
96
|
-
*
|
|
97
|
-
* `two?` - (ReactNode) - Content to render when the number is two.
|
|
98
|
-
*
|
|
99
|
-
* `few?` - (ReactNode) - Content to render when the number is considered "few".
|
|
100
|
-
*
|
|
101
|
-
* `many?` - (ReactNode) - Content to render when the number is considered "many".
|
|
102
|
-
*
|
|
103
|
-
* `other?` - (ReactNode) - Content to render when the number does not match any other conditions.
|
|
104
|
-
*
|
|
105
|
-
**/
|
|
106
|
-
Plural: ComponentType<{
|
|
107
|
-
children?: any;
|
|
108
|
-
n: number;
|
|
109
|
-
zero?: ReactNode;
|
|
110
|
-
one?: ReactNode;
|
|
111
|
-
two?: ReactNode;
|
|
112
|
-
few?: ReactNode;
|
|
113
|
-
many?: ReactNode;
|
|
114
|
-
other?: ReactNode;
|
|
115
|
-
}>;
|
|
116
|
-
/**
|
|
117
|
-
* Server-side function which gets the user's current locale.
|
|
118
|
-
* Returns a BCP 47 language code representing the user's language, e.g. `en-US`.
|
|
119
|
-
**/
|
|
120
|
-
getLocale: () => string;
|
|
121
|
-
/**
|
|
122
|
-
* Server-side function which gets the application's default locale.
|
|
123
|
-
* Returns a BCP 47 language code representing a language, e.g. `en-US`.
|
|
124
|
-
**/
|
|
125
|
-
getDefaultLocale: () => string;
|
|
126
|
-
};
|
|
127
|
-
export default GeneralTranslation;
|
|
128
|
-
//# sourceMappingURL=GeneralTranslationInterface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GeneralTranslationInterface.d.ts","sourceRoot":"","sources":["../../src/types/GeneralTranslationInterface.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGxD,KAAK,kBAAkB,GAAG;IAEtB;;;;;;MAME;IACF,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QACtB,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACrB,KAAK,GAAG,CAAC;IAEV;;;;;;MAME;IACF,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAC3C,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACrB,KAAK,GAAG,CAAC;IAEV;;;;;;;;;;;;;;MAcE;IACF,UAAU,EAAE,aAAa,CAAC;QACtB,QAAQ,CAAC,EAAE,GAAG,CAAC;QACf,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACrB,CAAC,CAAC;IAEH;;;;;;;;MAQE;IACF,CAAC,EAAE,aAAa,CAAC;QACb,QAAQ,CAAC,EAAE,GAAG,CAAC;QACf,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACtB,CAAC,CAAC;IAEH;;;;;;;;;;MAUE;IACF,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QACnC,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACrB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAEtB;;;;;;OAMG;IACH,KAAK,EAAE,aAAa,CAAC;QACjB,QAAQ,CAAC,EAAE,GAAG,CAAC;QACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC/B,CAAC,CAAC;IAEH;;;;;;;;;;;;;;;;;;;QAmBI;IACJ,MAAM,EAAE,aAAa,CAAC;QAClB,QAAQ,CAAC,EAAE,GAAG,CAAC;QACf,CAAC,EAAE,MAAM,CAAC;QACV,IAAI,CAAC,EAAE,SAAS,CAAC;QACjB,GAAG,CAAC,EAAE,SAAS,CAAC;QAChB,GAAG,CAAC,EAAE,SAAS,CAAC;QAChB,GAAG,CAAC,EAAE,SAAS,CAAC;QAChB,IAAI,CAAC,EAAE,SAAS,CAAC;QACjB,KAAK,CAAC,EAAE,SAAS,CAAC;KACrB,CAAC,CAAC;IAEH;;;OAGG;IACH,SAAS,EAAE,MAAM,MAAM,CAAC;IAExB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,MAAM,CAAC;CAElC,CAAA;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GeneralTranslationInterface.js","sourceRoot":"","sources":["../../src/types/GeneralTranslationInterface.ts"],"names":[],"mappings":""}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
type InitGTProps = {
|
|
2
|
-
apiKey?: string;
|
|
3
|
-
projectID?: string;
|
|
4
|
-
baseURL?: string;
|
|
5
|
-
cacheURL?: string;
|
|
6
|
-
remoteSource?: boolean;
|
|
7
|
-
automaticTranslation?: boolean;
|
|
8
|
-
approvedLocales?: string[];
|
|
9
|
-
defaultLocale?: string;
|
|
10
|
-
getLocale?: () => string;
|
|
11
|
-
renderPrevious?: boolean;
|
|
12
|
-
renderMethod?: string;
|
|
13
|
-
renderTimeout?: number | null;
|
|
14
|
-
dictionaryName?: string;
|
|
15
|
-
dictionary?: Record<string, any>;
|
|
16
|
-
translations?: Record<string, () => Promise<Record<string, any>>>;
|
|
17
|
-
maxConcurrentRequests?: number;
|
|
18
|
-
batchInterval?: number;
|
|
19
|
-
getMetadata?: () => Record<string, any>;
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
};
|
|
22
|
-
export default InitGTProps;
|
|
23
|
-
//# sourceMappingURL=InitGTProps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InitGTProps.d.ts","sourceRoot":"","sources":["../../src/types/InitGTProps.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG;IAEf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC;IAEzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAElE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,WAAW,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB,CAAA;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InitGTProps.js","sourceRoot":"","sources":["../../src/types/InitGTProps.ts"],"names":[],"mappings":""}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
export type TargetVariable = {
|
|
3
|
-
variable: "variable" | "number" | "date" | "currency";
|
|
4
|
-
key: string;
|
|
5
|
-
};
|
|
6
|
-
export type TargetElement = {
|
|
7
|
-
type: string;
|
|
8
|
-
props?: {
|
|
9
|
-
children?: Target;
|
|
10
|
-
'data-generaltranslation': any;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export type TargetChild = TargetElement | string | number | boolean | TargetVariable;
|
|
14
|
-
export type Target = TargetChild | TargetChild[];
|
|
15
|
-
export type SourceChild = ReactNode;
|
|
16
|
-
export type Source = SourceChild | SourceChild[];
|
|
17
|
-
//# sourceMappingURL=SourceTargetTypes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SourceTargetTypes.d.ts","sourceRoot":"","sources":["../../src/types/SourceTargetTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,MAAM,cAAc,GAAG;IAAE,QAAQ,EAAE,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AACnG,MAAM,MAAM,aAAa,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE;QACJ,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,yBAAyB,EAAE,GAAG,CAAA;KACjC,CAAA;CACJ,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,cAAc,CAAC;AACrF,MAAM,MAAM,MAAM,GAAG,WAAW,GAAG,WAAW,EAAE,CAAC;AAEjD,MAAM,MAAM,WAAW,GAAG,SAAS,CAAC;AACpC,MAAM,MAAM,MAAM,GAAG,WAAW,GAAG,WAAW,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SourceTargetTypes.js","sourceRoot":"","sources":["../../src/types/SourceTargetTypes.ts"],"names":[],"mappings":""}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
2
|
-
type Variables = {
|
|
3
|
-
/**
|
|
4
|
-
* Component for rendering variables.
|
|
5
|
-
*
|
|
6
|
-
* `children?` - (any) - The content to render if provided. Overrides `defaultValue`.
|
|
7
|
-
*
|
|
8
|
-
* `name?` - (string) - The name of the variable, used for identifying the component.
|
|
9
|
-
*
|
|
10
|
-
* `defaultValue?` - (any) - The default value to display if `children` is not provided.
|
|
11
|
-
**/
|
|
12
|
-
Var: ComponentType<{
|
|
13
|
-
children?: any;
|
|
14
|
-
name?: string;
|
|
15
|
-
defaultValue?: any;
|
|
16
|
-
}>;
|
|
17
|
-
/**
|
|
18
|
-
* Component for rendering number variables.
|
|
19
|
-
*
|
|
20
|
-
* `children?` - (any) - The content to render if provided. Overrides `defaultValue`.
|
|
21
|
-
*
|
|
22
|
-
* `name?` - (string) - The name of the variable, used for identifying the component.
|
|
23
|
-
*
|
|
24
|
-
* `defaultValue?` - (any) - The default value to display if `children` is not provided. This can be a number or a string representation of a number.
|
|
25
|
-
*
|
|
26
|
-
* `options?` - (Intl.NumberFormatOptions) - Additional options for `Intl.NumberFormat` for formatting the number.
|
|
27
|
-
**/
|
|
28
|
-
Num: ComponentType<{
|
|
29
|
-
children?: any;
|
|
30
|
-
name?: string;
|
|
31
|
-
defaultValue?: any;
|
|
32
|
-
options?: Intl.NumberFormatOptions;
|
|
33
|
-
}>;
|
|
34
|
-
/**
|
|
35
|
-
* Component for rendering date variables.
|
|
36
|
-
*
|
|
37
|
-
* `children?` - (any) - The content to render if provided. Overrides `defaultValue`.
|
|
38
|
-
*
|
|
39
|
-
* `name?` - (string) - The name of the variable, used for identifying the component.
|
|
40
|
-
*
|
|
41
|
-
* `defaultValue?` - (any) - The default value to display if `children` is not provided. This can be a number (Unix timestamp), string, or Date object.
|
|
42
|
-
*
|
|
43
|
-
* `options?` - (Intl.DateTimeFormatOptions) - Additional options for `Intl.DateTimeFormat` for formatting the date.
|
|
44
|
-
**/
|
|
45
|
-
DateTime: ComponentType<{
|
|
46
|
-
children?: any;
|
|
47
|
-
name?: string;
|
|
48
|
-
defaultValue?: any;
|
|
49
|
-
options?: Intl.DateTimeFormatOptions;
|
|
50
|
-
}>;
|
|
51
|
-
/**
|
|
52
|
-
* Component for rendering currency variables.
|
|
53
|
-
*
|
|
54
|
-
* `children?` - (any) - The content to render if provided. Overrides `defaultValue`.
|
|
55
|
-
*
|
|
56
|
-
* `name?` - (string) - The name of the variable, used for identifying the component.
|
|
57
|
-
*
|
|
58
|
-
* `defaultValue?` - (any) - The default value to display if `children` is not provided. This should be a number or a string representation of a number.
|
|
59
|
-
*
|
|
60
|
-
* `currency?` - (string) - The currency code to use for formatting. Defaults to "USD".
|
|
61
|
-
*
|
|
62
|
-
* `options?` - (Intl.NumberFormatOptions) - Additional options for `Intl.NumberFormat` for formatting the currency.
|
|
63
|
-
**/
|
|
64
|
-
Currency: ComponentType<{
|
|
65
|
-
children?: any;
|
|
66
|
-
name?: string;
|
|
67
|
-
defaultValue?: any;
|
|
68
|
-
currency?: string;
|
|
69
|
-
options?: Intl.NumberFormatOptions;
|
|
70
|
-
}>;
|
|
71
|
-
/**
|
|
72
|
-
* Server-side function which gets the user's current locale.
|
|
73
|
-
* Returns a BCP 47 language code representing the user's language, e.g. `en-US`.
|
|
74
|
-
**/
|
|
75
|
-
getLocale: () => string;
|
|
76
|
-
/**
|
|
77
|
-
* Server-side function which gets the application's default locale.
|
|
78
|
-
* Returns a BCP 47 language code representing a language, e.g. `en-US`.
|
|
79
|
-
**/
|
|
80
|
-
getDefaultLocale: () => string;
|
|
81
|
-
};
|
|
82
|
-
export default Variables;
|
|
83
|
-
//# sourceMappingURL=Variables.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Variables.d.ts","sourceRoot":"","sources":["../../src/types/Variables.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAa,MAAM,OAAO,CAAA;AAEvD,KAAK,SAAS,GAAG;IAEb;;;;;;;;OAQG;IACH,GAAG,EAAE,aAAa,CAAC;QACf,QAAQ,CAAC,EAAE,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,GAAG,CAAC;KACtB,CAAC,CAAC;IAEH;;;;;;;;;;OAUG;IACH,GAAG,EAAE,aAAa,CAAC;QACf,QAAQ,CAAC,EAAE,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,GAAG,CAAC;QACnB,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;KACtC,CAAC,CAAC;IAEH;;;;;;;;;;OAUG;IACH,QAAQ,EAAE,aAAa,CAAC;QACpB,QAAQ,CAAC,EAAE,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,GAAG,CAAC;QACnB,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;KACxC,CAAC,CAAC;IAEH;;;;;;;;;;;;OAYG;IACH,QAAQ,EAAE,aAAa,CAAC;QACpB,QAAQ,CAAC,EAAE,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,GAAG,CAAC;QACnB,QAAQ,C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