gt-react 10.6.6-alpha.4 → 10.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/branches/Branch.d.ts +34 -0
- package/dist/branches/Branch.d.ts.map +1 -0
- package/dist/branches/plurals/Plural.d.ts +38 -0
- package/dist/branches/plurals/Plural.d.ts.map +1 -0
- package/dist/branches/plurals/getPluralBranch.d.ts +9 -0
- package/dist/branches/plurals/getPluralBranch.d.ts.map +1 -0
- package/dist/client.cjs.min.cjs +16 -17
- package/dist/client.d.ts +740 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.esm.min.mjs +16 -17
- package/dist/dictionaries/collectUntranslatedEntries.d.ts +17 -0
- package/dist/dictionaries/collectUntranslatedEntries.d.ts.map +1 -0
- package/dist/dictionaries/getDictionaryEntry.d.ts +4 -0
- package/dist/dictionaries/getDictionaryEntry.d.ts.map +1 -0
- package/dist/dictionaries/getEntryAndMetadata.d.ts +6 -0
- package/dist/dictionaries/getEntryAndMetadata.d.ts.map +1 -0
- package/dist/dictionaries/getSubtree.d.ts +18 -0
- package/dist/dictionaries/getSubtree.d.ts.map +1 -0
- package/dist/dictionaries/indexDict.d.ts +15 -0
- package/dist/dictionaries/indexDict.d.ts.map +1 -0
- package/dist/dictionaries/injectAndMerge.d.ts +9 -0
- package/dist/dictionaries/injectAndMerge.d.ts.map +1 -0
- package/dist/dictionaries/injectEntry.d.ts +18 -0
- package/dist/dictionaries/injectEntry.d.ts.map +1 -0
- package/dist/dictionaries/injectFallbacks.d.ts +17 -0
- package/dist/dictionaries/injectFallbacks.d.ts.map +1 -0
- package/dist/dictionaries/injectHashes.d.ts +11 -0
- package/dist/dictionaries/injectHashes.d.ts.map +1 -0
- package/dist/dictionaries/injectTranslations.d.ts +20 -0
- package/dist/dictionaries/injectTranslations.d.ts.map +1 -0
- package/dist/dictionaries/isDictionaryEntry.d.ts +8 -0
- package/dist/dictionaries/isDictionaryEntry.d.ts.map +1 -0
- package/dist/dictionaries/loadDictionaryHelper.d.ts +3 -0
- package/dist/dictionaries/loadDictionaryHelper.d.ts.map +1 -0
- package/dist/dictionaries/mergeDictionaries.d.ts +3 -0
- package/dist/dictionaries/mergeDictionaries.d.ts.map +1 -0
- package/dist/dictionaries/stripMetadataFromEntries.d.ts +6 -0
- package/dist/dictionaries/stripMetadataFromEntries.d.ts.map +1 -0
- package/dist/errors/createErrors.d.ts +33 -0
- package/dist/errors/createErrors.d.ts.map +1 -0
- package/dist/hooks/useDefaultLocale.d.ts +13 -0
- package/dist/hooks/useDefaultLocale.d.ts.map +1 -0
- package/dist/hooks/useGTClass.d.ts +23 -0
- package/dist/hooks/useGTClass.d.ts.map +1 -0
- package/dist/hooks/useLocale.d.ts +11 -0
- package/dist/hooks/useLocale.d.ts.map +1 -0
- package/dist/hooks/useLocaleDirection.d.ts +14 -0
- package/dist/hooks/useLocaleDirection.d.ts.map +1 -0
- package/dist/hooks/useLocaleSelector.d.ts +42 -0
- package/dist/hooks/useLocaleSelector.d.ts.map +1 -0
- package/dist/hooks/useLocales.d.ts +11 -0
- package/dist/hooks/useLocales.d.ts.map +1 -0
- package/dist/hooks/useRegion.d.ts +20 -0
- package/dist/hooks/useRegion.d.ts.map +1 -0
- package/dist/hooks/useRegionSelector.d.ts +82 -0
- package/dist/hooks/useRegionSelector.d.ts.map +1 -0
- package/dist/hooks/useSetLocale.d.ts +12 -0
- package/dist/hooks/useSetLocale.d.ts.map +1 -0
- package/dist/index.cjs.min.cjs +3 -21
- package/dist/index.d.ts +22 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.min.mjs +3 -21
- package/dist/internal/addGTIdentifier.d.ts +4 -0
- package/dist/internal/addGTIdentifier.d.ts.map +1 -0
- package/dist/internal/flattenDictionary.d.ts +11 -0
- package/dist/internal/flattenDictionary.d.ts.map +1 -0
- package/dist/internal/writeChildrenAsObjects.d.ts +10 -0
- package/dist/internal/writeChildrenAsObjects.d.ts.map +1 -0
- package/dist/internal.cjs.min.cjs +16 -17
- package/dist/internal.d.ts +31 -5
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.esm.min.mjs +16 -17
- package/dist/messages/messages.d.ts +43 -0
- package/dist/messages/messages.d.ts.map +1 -0
- package/dist/promises/dangerouslyUsable.d.ts +37 -0
- package/dist/promises/dangerouslyUsable.d.ts.map +1 -0
- package/dist/promises/reactHasUse.d.ts +2 -0
- package/dist/promises/reactHasUse.d.ts.map +1 -0
- package/dist/provider/ClientProvider.d.ts +1 -1
- package/dist/provider/ClientProvider.d.ts.map +1 -1
- package/dist/provider/GTContext.d.ts +4 -0
- package/dist/provider/GTContext.d.ts.map +1 -0
- package/dist/provider/GTProvider.d.ts +23 -3
- package/dist/provider/GTProvider.d.ts.map +1 -1
- package/dist/provider/config/defaultProps.d.ts +4 -0
- package/dist/provider/config/defaultProps.d.ts.map +1 -0
- package/dist/provider/helpers/isSSREnabled.d.ts.map +1 -1
- package/dist/provider/helpers/validateString.d.ts +6 -0
- package/dist/provider/helpers/validateString.d.ts.map +1 -0
- package/dist/provider/hooks/locales/useDetermineLocale.d.ts +9 -2
- package/dist/provider/hooks/locales/useDetermineLocale.d.ts.map +1 -1
- package/dist/provider/hooks/locales/useLocaleState.d.ts +16 -0
- package/dist/provider/hooks/locales/useLocaleState.d.ts.map +1 -0
- package/dist/provider/hooks/translation/useCreateInternalUseGTFunction.d.ts +18 -0
- package/dist/provider/hooks/translation/useCreateInternalUseGTFunction.d.ts.map +1 -0
- package/dist/provider/hooks/translation/useCreateInternalUseTranslationsFunction.d.ts +4 -0
- package/dist/provider/hooks/translation/useCreateInternalUseTranslationsFunction.d.ts.map +1 -0
- package/dist/provider/hooks/translation/useCreateInternalUseTranslationsObjFunction.d.ts +4 -0
- package/dist/provider/hooks/translation/useCreateInternalUseTranslationsObjFunction.d.ts.map +1 -0
- package/dist/provider/hooks/useErrorChecks.d.ts +9 -0
- package/dist/provider/hooks/useErrorChecks.d.ts.map +1 -0
- package/dist/provider/hooks/useLoadDictionary.d.ts +15 -0
- package/dist/provider/hooks/useLoadDictionary.d.ts.map +1 -0
- package/dist/provider/hooks/useLoadTranslations.d.ts +17 -0
- package/dist/provider/hooks/useLoadTranslations.d.ts.map +1 -0
- package/dist/provider/hooks/useRuntimeTranslation.d.ts +23 -0
- package/dist/provider/hooks/useRuntimeTranslation.d.ts.map +1 -0
- package/dist/rendering/defaultRenderSettings.d.ts +6 -0
- package/dist/rendering/defaultRenderSettings.d.ts.map +1 -0
- package/dist/rendering/getGTTag.d.ts +3 -0
- package/dist/rendering/getGTTag.d.ts.map +1 -0
- package/dist/rendering/isVariableObject.d.ts +3 -0
- package/dist/rendering/isVariableObject.d.ts.map +1 -0
- package/dist/rendering/renderDefaultChildren.d.ts +8 -0
- package/dist/rendering/renderDefaultChildren.d.ts.map +1 -0
- package/dist/rendering/renderSkeleton.d.ts +8 -0
- package/dist/rendering/renderSkeleton.d.ts.map +1 -0
- package/dist/rendering/renderTranslatedChildren.d.ts +9 -0
- package/dist/rendering/renderTranslatedChildren.d.ts.map +1 -0
- package/dist/rendering/renderVariable.d.ts +4 -0
- package/dist/rendering/renderVariable.d.ts.map +1 -0
- package/dist/translation/hooks/useGT.d.ts +20 -0
- package/dist/translation/hooks/useGT.d.ts.map +1 -0
- package/dist/translation/hooks/useMessages.d.ts +19 -0
- package/dist/translation/hooks/useMessages.d.ts.map +1 -0
- package/dist/translation/hooks/useTranslations.d.ts +17 -0
- package/dist/translation/hooks/useTranslations.d.ts.map +1 -0
- package/dist/translation/inline/T.d.ts +42 -0
- package/dist/translation/inline/T.d.ts.map +1 -0
- package/dist/types/config.d.ts +41 -23
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/context.d.ts +30 -0
- package/dist/types/context.d.ts.map +1 -0
- package/dist/types/runtime.d.ts +20 -0
- package/dist/types/runtime.d.ts.map +1 -0
- package/dist/types/types.d.ts +90 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/utils/cookies.d.ts +9 -0
- package/dist/utils/cookies.d.ts.map +1 -0
- package/dist/utils/fetchTranslations.d.ts +9 -0
- package/dist/utils/fetchTranslations.d.ts.map +1 -0
- package/dist/utils/utils.d.ts +6 -2
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/variables/Currency.d.ts +30 -0
- package/dist/variables/Currency.d.ts.map +1 -0
- package/dist/variables/DateTime.d.ts +29 -0
- package/dist/variables/DateTime.d.ts.map +1 -0
- package/dist/variables/Num.d.ts +31 -0
- package/dist/variables/Num.d.ts.map +1 -0
- package/dist/variables/Var.d.ts +32 -0
- package/dist/variables/Var.d.ts.map +1 -0
- package/dist/variables/_getVariableProps.d.ts +11 -0
- package/dist/variables/_getVariableProps.d.ts.map +1 -0
- package/dist/variables/getVariableName.d.ts +10 -0
- package/dist/variables/getVariableName.d.ts.map +1 -0
- package/package.json +3 -4
- package/dist/client.cjs.min.cjs.map +0 -1
- package/dist/client.esm.min.mjs.map +0 -1
- package/dist/errors-dir/constants.d.ts +0 -2
- package/dist/errors-dir/constants.d.ts.map +0 -1
- package/dist/index.cjs.min.cjs.map +0 -1
- package/dist/index.esm.min.mjs.map +0 -1
- package/dist/internal.cjs.min.cjs.map +0 -1
- package/dist/internal.esm.min.mjs.map +0 -1
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import { GTProviderProps } from '../types/config';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Provides General Translation context to its children, which can then access `useGT`, `useLocale`, and `useDefaultLocale`.
|
|
4
|
+
*
|
|
5
|
+
* @param {React.ReactNode} children - The children components that will use the translation context.
|
|
6
|
+
* @param {string} [projectId] - The project ID required for General Translation cloud services.
|
|
7
|
+
* @param {Dictionary} [dictionary=defaultDictionary] - The translation dictionary for the project.
|
|
8
|
+
* @param {string[]} [locales] - The list of approved locales for the project.
|
|
9
|
+
* @param {string} [defaultLocale=libraryDefaultLocale] - The default locale to use if no other locale is found.
|
|
10
|
+
* @param {string} [locale] - The current locale, if already set.
|
|
11
|
+
* @param {string} [cacheUrl='https://cdn.gtx.dev'] - The URL of the cache service for fetching translations.
|
|
12
|
+
* @param {string} [runtimeUrl='https://runtime.gtx.dev'] - The URL of the runtime service for fetching translations.
|
|
13
|
+
* @param {RenderSettings} [renderSettings=defaultRenderSettings] - The settings for rendering translations.
|
|
14
|
+
* @param {string} [_versionId] - The version ID for fetching translations.
|
|
15
|
+
* @param {string} [devApiKey] - The API key for development environments.
|
|
16
|
+
* @param {object} [metadata] - Additional metadata to pass to the context.
|
|
17
|
+
* @param {boolean} [ssr=isSSREnabled()] - Whether to enable server-side rendering.
|
|
18
|
+
* @param {string} [localeCookieName=defaultLocaleCookieName] - The name of the cookie to store the locale.
|
|
19
|
+
* @param {Translations | null} [translations=null] - The translations to use for the context.
|
|
20
|
+
* @param {React.ReactNode} [fallback = undefined] - Custom fallback to display while loading
|
|
21
|
+
*
|
|
22
|
+
* @returns {JSX.Element} The provider component for General Translation context.
|
|
23
|
+
*/
|
|
24
|
+
export default function GTProvider({ children, config, projectId: _projectId, devApiKey: _devApiKey, dictionary: _dictionary, locales, defaultLocale, cacheUrl, runtimeUrl, renderSettings, ssr, localeCookieName, locale: _locale, region: _region, loadDictionary, loadTranslations, fallback, translations: _translations, _versionId, customMapping, ...metadata }: GTProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
5
25
|
//# sourceMappingURL=GTProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTProvider.d.ts","sourceRoot":"","sources":["../../src/provider/GTProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GTProvider.d.ts","sourceRoot":"","sources":["../../src/provider/GTProvider.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAQlD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,QAAQ,EACR,MAAM,EACN,SAAS,EAAE,UAAoC,EAC/C,SAAS,EAAE,UAAoC,EAC/C,UAAU,EAAE,WAAsC,EAClD,OAA+B,EAC/B,aAA6D,EAC7D,QAA8C,EAC9C,UAAuD,EACvD,cAAgE,EAChE,GAAmC,EACnC,gBAAsE,EACtE,MAAM,EAAE,OAAY,EACpB,MAAM,EAAE,OAAO,EACf,cAAc,EACd,gBAAgB,EAChB,QAAoB,EACpB,YAAY,EAAE,aAAoB,EAClC,UAAU,EACV,aAAqC,EACrC,GAAG,QAAQ,EACZ,EAAE,eAAe,2CAsMjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultProps.d.ts","sourceRoot":"","sources":["../../../src/provider/config/defaultProps.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,aAAa,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isSSREnabled.d.ts","sourceRoot":"","sources":["../../../src/provider/helpers/isSSREnabled.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,
|
|
1
|
+
{"version":3,"file":"isSSREnabled.d.ts","sourceRoot":"","sources":["../../../src/provider/helpers/isSSREnabled.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,YAU3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateString.d.ts","sourceRoot":"","sources":["../../../src/provider/helpers/validateString.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,WASlC"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CustomMapping } from 'generaltranslation/types';
|
|
2
2
|
export declare function useDetermineLocale({ locale: _locale, defaultLocale, locales, localeCookieName, ssr, // when false, breaks server side rendering by accessing document and navigator on first render
|
|
3
|
-
customMapping, }:
|
|
3
|
+
customMapping, }: {
|
|
4
|
+
defaultLocale: string;
|
|
5
|
+
locales: string[];
|
|
6
|
+
locale?: string;
|
|
7
|
+
localeCookieName?: string;
|
|
8
|
+
ssr?: boolean;
|
|
9
|
+
customMapping?: CustomMapping;
|
|
10
|
+
}): [string, (locale: string) => void];
|
|
4
11
|
//# sourceMappingURL=useDetermineLocale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDetermineLocale.d.ts","sourceRoot":"","sources":["../../../../src/provider/hooks/locales/useDetermineLocale.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDetermineLocale.d.ts","sourceRoot":"","sources":["../../../../src/provider/hooks/locales/useDetermineLocale.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EAAE,OAAY,EACpB,aAAoC,EACpC,OAAY,EACZ,gBAA0C,EAC1C,GAAU,EAAE,+FAA+F;AAC3G,aAAa,GACd,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC,CA+CrC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CustomMapping } from 'generaltranslation/types';
|
|
2
|
+
export declare function useLocaleState({ _locale, defaultLocale, locales: _locales, ssr, localeCookieName, customMapping, }: {
|
|
3
|
+
_locale: string;
|
|
4
|
+
defaultLocale: string;
|
|
5
|
+
locales: string[];
|
|
6
|
+
ssr: boolean;
|
|
7
|
+
localeCookieName: string;
|
|
8
|
+
customMapping?: CustomMapping;
|
|
9
|
+
}): {
|
|
10
|
+
locale: string;
|
|
11
|
+
setLocale: (locale: string) => void;
|
|
12
|
+
locales: string[];
|
|
13
|
+
translationRequired: boolean;
|
|
14
|
+
dialectTranslationRequired: boolean;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useLocaleState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocaleState.d.ts","sourceRoot":"","sources":["../../../../src/provider/hooks/locales/useLocaleState.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAMzD,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,aAAa,EACb,OAAO,EAAE,QAAQ,EACjB,GAAG,EACH,gBAAgB,EAChB,aAAa,GACd,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,GAAG,EAAE,OAAO,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;;;;;;EAgEA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { InlineTranslationOptions, Translations, _Messages } from '../../../types/types';
|
|
2
|
+
import { TranslateIcuCallback } from '../../../types/runtime';
|
|
3
|
+
import { GT } from 'generaltranslation';
|
|
4
|
+
export default function useCreateInternalUseGTFunction({ gt, translations, locale, defaultLocale, translationRequired, developmentApiEnabled, registerIcuForTranslation, }: {
|
|
5
|
+
gt: GT;
|
|
6
|
+
translations: Translations | null;
|
|
7
|
+
locale: string;
|
|
8
|
+
defaultLocale: string;
|
|
9
|
+
translationRequired: boolean;
|
|
10
|
+
developmentApiEnabled: boolean;
|
|
11
|
+
registerIcuForTranslation: TranslateIcuCallback;
|
|
12
|
+
}): {
|
|
13
|
+
_tFunction: (message: string, options?: InlineTranslationOptions, preloadedTranslations?: Translations) => string;
|
|
14
|
+
_mFunction: <T extends string | null | undefined>(message: T, options?: Record<string, any>, preloadedTranslations?: Translations) => T extends string ? string : T;
|
|
15
|
+
_filterMessagesForPreload: (_messages: _Messages) => _Messages;
|
|
16
|
+
_preloadMessages: (_messages: _Messages) => Promise<Translations>;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=useCreateInternalUseGTFunction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCreateInternalUseGTFunction.d.ts","sourceRoot":"","sources":["../../../../src/provider/hooks/translation/useCreateInternalUseGTFunction.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EACxB,YAAY,EACZ,SAAS,EAEV,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AASxC,MAAM,CAAC,OAAO,UAAU,8BAA8B,CAAC,EACrD,EAAE,EACF,YAAY,EACZ,MAAM,EACN,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,GAC1B,EAAE;IACD,EAAE,EAAE,EAAE,CAAC;IACP,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,yBAAyB,EAAE,oBAAoB,CAAC;CACjD,GAAG;IACF,UAAU,EAAE,CACV,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,wBAAwB,EAClC,qBAAqB,CAAC,EAAE,YAAY,KACjC,MAAM,CAAC;IACZ,UAAU,EAAE,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9C,OAAO,EAAE,CAAC,EACV,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,qBAAqB,CAAC,EAAE,YAAY,KACjC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC;IACnC,yBAAyB,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,SAAS,CAAC;IAC/D,gBAAgB,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;CACnE,CAkSA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Dictionary, DictionaryTranslationOptions, Translations } from '../../../types/types';
|
|
2
|
+
import { TranslateIcuCallback } from '../../../types/runtime';
|
|
3
|
+
export default function useCreateInternalUseTranslationsFunction(dictionary: Dictionary | undefined, dictionaryTranslations: Dictionary | undefined, translations: Translations | null, locale: string, defaultLocale: string, translationRequired: boolean, dialectTranslationRequired: boolean, developmentApiEnabled: boolean, registerIcuForTranslation: TranslateIcuCallback): (id: string, options?: DictionaryTranslationOptions) => string;
|
|
4
|
+
//# sourceMappingURL=useCreateInternalUseTranslationsFunction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCreateInternalUseTranslationsFunction.d.ts","sourceRoot":"","sources":["../../../../src/provider/hooks/translation/useCreateInternalUseTranslationsFunction.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,4BAA4B,EAC5B,YAAY,EACb,MAAM,sBAAsB,CAAC;AAY9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,CAAC,OAAO,UAAU,wCAAwC,CAC9D,UAAU,EAAE,UAAU,GAAG,SAAS,EAClC,sBAAsB,EAAE,UAAU,GAAG,SAAS,EAC9C,YAAY,EAAE,YAAY,GAAG,IAAI,EACjC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,mBAAmB,EAAE,OAAO,EAC5B,0BAA0B,EAAE,OAAO,EACnC,qBAAqB,EAAE,OAAO,EAC9B,yBAAyB,EAAE,oBAAoB,QAGxC,MAAM,YAAW,4BAA4B,KAAQ,MAAM,CAoHnE"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TranslateIcuCallback } from '../../../types/runtime';
|
|
2
|
+
import { Dictionary, DictionaryTranslationOptions, Translations } from '../../../types/types';
|
|
3
|
+
export declare function useCreateInternalUseTranslationsObjFunction(dictionary: Dictionary, dictionaryTranslations: Dictionary, setDictionary: Function, setDictionaryTranslations: Function, translations: Translations | null, locale: string, defaultLocale: string, translationRequired: boolean, dialectTranslationRequired: boolean, developmentApiEnabled: boolean, registerIcuForTranslation: TranslateIcuCallback, tFunction: (id: string, options: DictionaryTranslationOptions) => string): (id: string, idWithParent: string, options?: DictionaryTranslationOptions) => any;
|
|
4
|
+
//# sourceMappingURL=useCreateInternalUseTranslationsObjFunction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCreateInternalUseTranslationsObjFunction.d.ts","sourceRoot":"","sources":["../../../../src/provider/hooks/translation/useCreateInternalUseTranslationsObjFunction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACL,UAAU,EACV,4BAA4B,EAE5B,YAAY,EACb,MAAM,sBAAsB,CAAC;AAmB9B,wBAAgB,2CAA2C,CACzD,UAAU,EAAE,UAAU,EACtB,sBAAsB,EAAE,UAAU,EAClC,aAAa,EAAE,QAAQ,EACvB,yBAAyB,EAAE,QAAQ,EACnC,YAAY,EAAE,YAAY,GAAG,IAAI,EACjC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,mBAAmB,EAAE,OAAO,EAC5B,0BAA0B,EAAE,OAAO,EACnC,qBAAqB,EAAE,OAAO,EAC9B,yBAAyB,EAAE,oBAAoB,EAC/C,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,4BAA4B,KAAK,MAAM,QAehE,MAAM,gBACI,MAAM,YACX,4BAA4B,KACpC,GAAG,CAgJT"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function useErrorChecks({ devApiKey, projectId, runtimeUrl, loadTranslationsType, cacheUrl, locales, }: {
|
|
2
|
+
devApiKey?: string;
|
|
3
|
+
projectId: string;
|
|
4
|
+
runtimeUrl: string;
|
|
5
|
+
loadTranslationsType: string;
|
|
6
|
+
cacheUrl: string;
|
|
7
|
+
locales: string[];
|
|
8
|
+
}): void;
|
|
9
|
+
//# sourceMappingURL=useErrorChecks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useErrorChecks.d.ts","sourceRoot":"","sources":["../../../src/provider/hooks/useErrorChecks.ts"],"names":[],"mappings":"AAaA,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACR,OAAO,GACR,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,QAgDA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CustomLoader } from '../../types/types';
|
|
2
|
+
import { Dictionary } from '../../types/types';
|
|
3
|
+
export declare function useLoadDictionary({ _dictionary, _dictionaryTranslations, loadDictionary, locale, defaultLocale, }: {
|
|
4
|
+
_dictionary: Dictionary | undefined;
|
|
5
|
+
_dictionaryTranslations: Dictionary | undefined;
|
|
6
|
+
loadDictionary: CustomLoader | undefined;
|
|
7
|
+
locale: string;
|
|
8
|
+
defaultLocale: string;
|
|
9
|
+
}): {
|
|
10
|
+
dictionary: Dictionary | undefined;
|
|
11
|
+
setDictionary: import("react").Dispatch<import("react").SetStateAction<Dictionary | undefined>>;
|
|
12
|
+
dictionaryTranslations: Dictionary | undefined;
|
|
13
|
+
setDictionaryTranslations: import("react").Dispatch<import("react").SetStateAction<Dictionary | undefined>>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=useLoadDictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLoadDictionary.d.ts","sourceRoot":"","sources":["../../../src/provider/hooks/useLoadDictionary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,uBAA4B,EAC5B,cAAc,EACd,MAAM,EACN,aAAa,GACd,EAAE;IACD,WAAW,EAAE,UAAU,GAAG,SAAS,CAAC;IACpC,uBAAuB,EAAE,UAAU,GAAG,SAAS,CAAC;IAChD,cAAc,EAAE,YAAY,GAAG,SAAS,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB;;;;;EAoDA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CustomLoader, Translations } from '../../types/types';
|
|
2
|
+
import { GT } from 'generaltranslation';
|
|
3
|
+
export declare function useLoadTranslations({ _translations, translationRequired, loadTranslationsType, loadTranslations, locale, cacheUrl, projectId, _versionId, gt, }: {
|
|
4
|
+
_translations: Translations | null;
|
|
5
|
+
translationRequired: boolean;
|
|
6
|
+
loadTranslationsType: string;
|
|
7
|
+
loadTranslations?: CustomLoader;
|
|
8
|
+
locale: string;
|
|
9
|
+
cacheUrl: string;
|
|
10
|
+
projectId: string;
|
|
11
|
+
_versionId?: string;
|
|
12
|
+
gt: GT;
|
|
13
|
+
}): {
|
|
14
|
+
translations: Translations | null;
|
|
15
|
+
setTranslations: import("react").Dispatch<import("react").SetStateAction<Translations | null>>;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=useLoadTranslations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLoadTranslations.d.ts","sourceRoot":"","sources":["../../../src/provider/hooks/useLoadTranslations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC,wBAAgB,mBAAmB,CAAC,EAClC,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,MAAM,EACN,QAAQ,EACR,SAAS,EACT,UAAU,EACV,EAAE,GACH,EAAE;IACD,aAAa,EAAE,YAAY,GAAG,IAAI,CAAC;IACnC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,EAAE,CAAC;CACR;;;EA0FA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RenderMethod, Translations } from '../../types/types';
|
|
3
|
+
import { TranslateIcuCallback, TranslateChildrenCallback } from '../../types/runtime';
|
|
4
|
+
import { GT } from 'generaltranslation';
|
|
5
|
+
export default function useRuntimeTranslation({ gt, locale, versionId, // kept for API compatibility (not used)
|
|
6
|
+
defaultLocale, runtimeUrl, renderSettings, setTranslations, ...additionalMetadata }: {
|
|
7
|
+
gt: GT;
|
|
8
|
+
locale: string;
|
|
9
|
+
versionId?: string;
|
|
10
|
+
defaultLocale?: string;
|
|
11
|
+
runtimeUrl?: string | null;
|
|
12
|
+
renderSettings: {
|
|
13
|
+
method: RenderMethod;
|
|
14
|
+
timeout?: number;
|
|
15
|
+
};
|
|
16
|
+
setTranslations: React.Dispatch<React.SetStateAction<Translations | null>>;
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}): {
|
|
19
|
+
registerIcuForTranslation: TranslateIcuCallback;
|
|
20
|
+
registerJsxForTranslation: TranslateChildrenCallback;
|
|
21
|
+
developmentApiEnabled: boolean;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=useRuntimeTranslation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRuntimeTranslation.d.ts","sourceRoot":"","sources":["../../../src/provider/hooks/useRuntimeTranslation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EACL,YAAY,EAEZ,YAAY,EACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,qBAAqB,CAAC;AAO7B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAwBxC,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,EAAE,EACF,MAAM,EACN,SAAS,EAAE,wCAAwC;AACnD,aAAa,EACb,UAAU,EACV,cAAc,EACd,eAAe,EACf,GAAG,kBAAkB,EACtB,EAAE;IACD,EAAE,EAAE,EAAE,CAAC;IACP,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE;QACd,MAAM,EAAE,YAAY,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,eAAe,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,GAAG;IACF,yBAAyB,EAAE,oBAAoB,CAAC;IAChD,yBAAyB,EAAE,yBAAyB,CAAC;IACrD,qBAAqB,EAAE,OAAO,CAAC;CAChC,CA8TA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultRenderSettings.d.ts","sourceRoot":"","sources":["../../src/rendering/defaultRenderSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAS9C,eAAO,MAAM,qBAAqB,EAAE;IAClC,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CAIR,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getGTTag.d.ts","sourceRoot":"","sources":["../../src/rendering/getGTTag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,GAAG,IAAI,CAKnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isVariableObject.d.ts","sourceRoot":"","sources":["../../src/rendering/isVariableObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,QAAQ,CAsBtE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RenderVariable, TaggedChildren } from '../types/types';
|
|
3
|
+
export default function renderDefaultChildren({ children, defaultLocale, renderVariable, }: {
|
|
4
|
+
children: TaggedChildren;
|
|
5
|
+
defaultLocale: string;
|
|
6
|
+
renderVariable: RenderVariable;
|
|
7
|
+
}): React.ReactNode;
|
|
8
|
+
//# sourceMappingURL=renderDefaultChildren.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderDefaultChildren.d.ts","sourceRoot":"","sources":["../../src/rendering/renderDefaultChildren.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAMzC,OAAO,EACL,cAAc,EAEd,cAAc,EAEf,MAAM,gBAAgB,CAAC;AAGxB,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,QAAQ,EACR,aAAoC,EACpC,cAAc,GACf,EAAE;IACD,QAAQ,EAAE,cAAc,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,cAAc,CAAC;CAChC,GAAG,KAAK,CAAC,SAAS,CAqElB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* renderSkeleton is a function that handles the rendering behavior for the skeleton loading method.
|
|
4
|
+
* It replaces all content with empty strings
|
|
5
|
+
* @returns an empty string
|
|
6
|
+
*/
|
|
7
|
+
export default function renderSkeleton(): React.ReactNode;
|
|
8
|
+
//# sourceMappingURL=renderSkeleton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderSkeleton.d.ts","sourceRoot":"","sources":["../../src/rendering/renderSkeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,IAAI,KAAK,CAAC,SAAS,CAExD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { TaggedChildren, TranslatedChildren, RenderVariable } from '../types/types';
|
|
3
|
+
export default function renderTranslatedChildren({ source, target, locales, renderVariable, }: {
|
|
4
|
+
source: TaggedChildren;
|
|
5
|
+
target: TranslatedChildren;
|
|
6
|
+
locales: string[];
|
|
7
|
+
renderVariable: RenderVariable;
|
|
8
|
+
}): ReactNode;
|
|
9
|
+
//# sourceMappingURL=renderTranslatedChildren.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderTranslatedChildren.d.ts","sourceRoot":"","sources":["../../src/rendering/renderTranslatedChildren.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EACL,cAAc,EAEd,kBAAkB,EAClB,cAAc,EAEf,MAAM,gBAAgB,CAAC;AA+GxB,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,MAAM,EACN,MAAM,EACN,OAAgC,EAChC,cAAc,GACf,EAAE;IACD,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,EAAE,cAAc,CAAC;CAChC,GAAG,SAAS,CAgIZ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderVariable.d.ts","sourceRoot":"","sources":["../../src/rendering/renderVariable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,QAAA,MAAM,cAAc,EAAE,cAarB,CAAC;AACF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { _Messages } from '../../types/types';
|
|
2
|
+
/**
|
|
3
|
+
* Gets the translation function `gt` provided by `<GTProvider>`.
|
|
4
|
+
*
|
|
5
|
+
* @returns {Function} A translation function that accepts an ICU message format string and returns the translation of that string.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const gt = useGT();
|
|
9
|
+
* console.log(gt('To be or not to be...'));
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const gt = useGT();
|
|
13
|
+
* gt('My name is {customName}', { customName: "Brian", id: 'my-name', context: 'a proper noun' } )
|
|
14
|
+
*/
|
|
15
|
+
export default function useGT(_messages?: _Messages): (string: string, options?: Record<string, any> & {
|
|
16
|
+
$id?: string;
|
|
17
|
+
$context?: string;
|
|
18
|
+
$_hash?: string;
|
|
19
|
+
}) => string;
|
|
20
|
+
//# sourceMappingURL=useGT.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGT.d.ts","sourceRoot":"","sources":["../../../src/translation/hooks/useGT.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAgB,MAAM,mBAAmB,CAAC;AAK5D;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,SAAS,CAAC,EAAE,SAAS,YAmCvC,MAAM,YACL,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,KACA,MAAM,CAmBV"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { _Messages } from '../../types/types';
|
|
2
|
+
import { MFunctionType } from '../../types/types';
|
|
3
|
+
/**
|
|
4
|
+
* Gets the message decoding and translation function `m` provided by `<GTProvider>`.
|
|
5
|
+
*
|
|
6
|
+
* @returns {Function} A translation function that accepts an encoded message, decodes it, and returns the translated value.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const encodedMessage = msg("Hello, world")
|
|
10
|
+
* const m = useMessages();
|
|
11
|
+
* m(encodedMessage) // returns "Hello, world" translated
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const encodedMessage = msg("My name is {name}", { name: "Brian" });
|
|
15
|
+
* const m = useMessages();
|
|
16
|
+
* m(encodedMessage) // returns "My name is Brian" translated
|
|
17
|
+
*/
|
|
18
|
+
export default function useMessages(_messages?: _Messages): MFunctionType;
|
|
19
|
+
//# sourceMappingURL=useMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMessages.d.ts","sourceRoot":"","sources":["../../../src/translation/hooks/useMessages.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAgB,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,aAAa,CA4DxE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the dictionary access function `t` provided by `<GTProvider>`.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} [id] - Optional prefix to prepend to the translation keys.
|
|
5
|
+
* @returns {Function} A translation function that accepts a key string and returns the translated value.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const t = useTranslations('user');
|
|
9
|
+
* console.log(t('name')); // Translates item 'user.name'
|
|
10
|
+
*
|
|
11
|
+
* const t = useTranslations();
|
|
12
|
+
* console.log(t('hello')); // Translates item 'hello'
|
|
13
|
+
*/
|
|
14
|
+
export default function useTranslations(id?: string): ((id: string, options?: Record<string, any>) => string) & {
|
|
15
|
+
obj: (id: string, options?: Record<string, any>) => any | undefined;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=useTranslations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTranslations.d.ts","sourceRoot":"","sources":["../../../src/translation/hooks/useTranslations.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,CACrD,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC1B,MAAM,CAAC,GAAG;IACb,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,GAAG,GAAG,SAAS,CAAC;CACrE,CAgDA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Build-time translation component that renders its children in the user's given locale.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```jsx
|
|
7
|
+
* // Basic usage:
|
|
8
|
+
* <T id="welcome_message">
|
|
9
|
+
* Hello, <Var>{name}</Var>!
|
|
10
|
+
* </T>
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```jsx
|
|
15
|
+
* // Translating a plural
|
|
16
|
+
* <T id="item_count">
|
|
17
|
+
* <Plural n={3} singular={<>You have <Num children={n}/> item.</>}>
|
|
18
|
+
* You have <Num children={n}/> items.
|
|
19
|
+
* </Plural>
|
|
20
|
+
* </T>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @param {React.ReactNode} children - The content to be translated or displayed.
|
|
24
|
+
* @param {string} [id] - Optional identifier for the translation string. If not provided, a hash will be generated from the content.
|
|
25
|
+
* @param {any} [context] - Additional context for translation key generation.
|
|
26
|
+
*
|
|
27
|
+
* @returns {JSX.Element} The rendered translation or fallback content based on the provided configuration.
|
|
28
|
+
*
|
|
29
|
+
* @throws {Error} If a plural translation is requested but the `n` option is not provided.
|
|
30
|
+
*/
|
|
31
|
+
declare function T({ children, id, context, _hash, ...options }: {
|
|
32
|
+
children: any;
|
|
33
|
+
id?: string;
|
|
34
|
+
context?: string;
|
|
35
|
+
_hash?: string;
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}): React.JSX.Element | undefined;
|
|
38
|
+
declare namespace T {
|
|
39
|
+
var _gtt: string;
|
|
40
|
+
}
|
|
41
|
+
export default T;
|
|
42
|
+
//# sourceMappingURL=T.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"T.d.ts","sourceRoot":"","sources":["../../../src/translation/inline/T.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAgBnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,iBAAS,CAAC,CAAC,EACT,QAAQ,EACR,EAAE,EACF,OAAO,EACP,KAAK,EACL,GAAG,OAAO,EACX,EAAE;IACD,QAAQ,EAAE,GAAG,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,SAAS,CAiKhC;kBA7KQ,CAAC;;;AAiLV,eAAe,CAAC,CAAC"}
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,32 +1,23 @@
|
|
|
1
|
-
import { RenderMethod
|
|
1
|
+
import { RenderMethod } from '../internal';
|
|
2
|
+
import { Dictionary, Translations, CustomLoader } from './types';
|
|
2
3
|
import { CustomMapping } from 'generaltranslation/types';
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
dictionaryEnabled?: boolean;
|
|
13
|
-
defaultLocale: string;
|
|
14
|
-
translationRequired: boolean;
|
|
15
|
-
dialectTranslationRequired: boolean;
|
|
16
|
-
renderSettings: {
|
|
4
|
+
export type GTConfig = {
|
|
5
|
+
projectId?: string;
|
|
6
|
+
devApiKey?: string;
|
|
7
|
+
locales?: string[];
|
|
8
|
+
defaultLocale?: string;
|
|
9
|
+
dictionary?: string;
|
|
10
|
+
runtimeUrl?: string;
|
|
11
|
+
cacheUrl?: string;
|
|
12
|
+
renderSettings?: {
|
|
17
13
|
method: RenderMethod;
|
|
18
14
|
timeout?: number;
|
|
19
15
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
devApiKey?: string;
|
|
23
|
-
runtimeUrl?: string | null;
|
|
24
|
-
gtServicesEnabled?: boolean;
|
|
16
|
+
_versionId?: string;
|
|
17
|
+
ssr?: boolean;
|
|
25
18
|
localeCookieName?: string;
|
|
26
|
-
resetLocaleCookieName: string;
|
|
27
|
-
regionCookieName?: string;
|
|
28
19
|
customMapping?: CustomMapping;
|
|
29
|
-
|
|
20
|
+
modelProvider?: string;
|
|
30
21
|
};
|
|
31
22
|
export type GTProviderProps = {
|
|
32
23
|
children?: React.ReactNode;
|
|
@@ -55,4 +46,31 @@ export type GTProviderProps = {
|
|
|
55
46
|
modelProvider?: string;
|
|
56
47
|
[key: string]: any;
|
|
57
48
|
};
|
|
49
|
+
export type ClientProviderProps = {
|
|
50
|
+
children: any;
|
|
51
|
+
dictionary: Dictionary;
|
|
52
|
+
dictionaryTranslations: Dictionary;
|
|
53
|
+
translations: Translations;
|
|
54
|
+
locale: string;
|
|
55
|
+
locales: string[];
|
|
56
|
+
region?: string;
|
|
57
|
+
_versionId?: string;
|
|
58
|
+
dictionaryEnabled?: boolean;
|
|
59
|
+
defaultLocale: string;
|
|
60
|
+
translationRequired: boolean;
|
|
61
|
+
dialectTranslationRequired: boolean;
|
|
62
|
+
renderSettings: {
|
|
63
|
+
method: RenderMethod;
|
|
64
|
+
timeout?: number;
|
|
65
|
+
};
|
|
66
|
+
developmentApiEnabled: boolean;
|
|
67
|
+
projectId?: string;
|
|
68
|
+
devApiKey?: string;
|
|
69
|
+
runtimeUrl?: string | null;
|
|
70
|
+
gtServicesEnabled?: boolean;
|
|
71
|
+
localeCookieName?: string;
|
|
72
|
+
resetLocaleCookieName: string;
|
|
73
|
+
regionCookieName?: string;
|
|
74
|
+
customMapping?: CustomMapping;
|
|
75
|
+
};
|
|
58
76
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Translations, RenderMethod, InlineTranslationOptions, DictionaryTranslationOptions, _Messages, Dictionary, DictionaryEntry } from './types';
|
|
2
|
+
import { TranslateIcuCallback, TranslateChildrenCallback } from './runtime';
|
|
3
|
+
import { GT } from 'generaltranslation';
|
|
4
|
+
export type GTContextType = {
|
|
5
|
+
gt: GT;
|
|
6
|
+
registerIcuForTranslation: TranslateIcuCallback;
|
|
7
|
+
registerJsxForTranslation: TranslateChildrenCallback;
|
|
8
|
+
_tFunction: (message: string, options?: InlineTranslationOptions, preloadedTranslations?: Translations) => string;
|
|
9
|
+
_mFunction: <T extends string | null | undefined>(encodedMsg: T, options?: Record<string, any>, preloadedTranslations?: Translations) => T extends string ? string : T;
|
|
10
|
+
_filterMessagesForPreload: (_messages: _Messages) => _Messages;
|
|
11
|
+
_preloadMessages: (_messages: _Messages) => Promise<Translations>;
|
|
12
|
+
_dictionaryFunction: (id: string, options?: DictionaryTranslationOptions) => string;
|
|
13
|
+
_dictionaryObjFunction: (id: string, idWithParent: string, options?: DictionaryTranslationOptions) => Dictionary | DictionaryEntry | string | undefined;
|
|
14
|
+
developmentApiEnabled: boolean;
|
|
15
|
+
locale: string;
|
|
16
|
+
locales: string[];
|
|
17
|
+
setLocale: (locale: string) => void;
|
|
18
|
+
defaultLocale: string;
|
|
19
|
+
region: string | undefined;
|
|
20
|
+
setRegion: (region: string | undefined) => void;
|
|
21
|
+
translations: Translations | null;
|
|
22
|
+
translationRequired: boolean;
|
|
23
|
+
dialectTranslationRequired: boolean;
|
|
24
|
+
renderSettings: {
|
|
25
|
+
method: RenderMethod;
|
|
26
|
+
timeout?: number;
|
|
27
|
+
};
|
|
28
|
+
projectId?: string;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/types/context.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,wBAAwB,EACxB,4BAA4B,EAC5B,SAAS,EAGT,UAAU,EACV,eAAe,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,EAAE,CAAC;IACP,yBAAyB,EAAE,oBAAoB,CAAC;IAChD,yBAAyB,EAAE,yBAAyB,CAAC;IACrD,UAAU,EAAE,CACV,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,wBAAwB,EAClC,qBAAqB,CAAC,EAAE,YAAY,KACjC,MAAM,CAAC;IACZ,UAAU,EAAE,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9C,UAAU,EAAE,CAAC,EACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,qBAAqB,CAAC,EAAE,YAAY,KACjC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC;IACnC,yBAAyB,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,SAAS,CAAC;IAC/D,gBAAgB,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAClE,mBAAmB,EAAE,CACnB,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,4BAA4B,KACnC,MAAM,CAAC;IACZ,sBAAsB,EAAE,CACtB,EAAE,EAAE,MAAM,EACV,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,4BAA4B,KACnC,UAAU,GAAG,eAAe,GAAG,MAAM,GAAG,SAAS,CAAC;IACvD,qBAAqB,EAAE,OAAO,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAChD,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,0BAA0B,EAAE,OAAO,CAAC;IACpC,cAAc,EAAE;QAAE,MAAM,EAAE,YAAY,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { JsxChildren } from 'generaltranslation/types';
|
|
2
|
+
import { TranslatedChildren } from './types';
|
|
3
|
+
export type TranslateIcuCallback = (params: {
|
|
4
|
+
source: string;
|
|
5
|
+
targetLocale: string;
|
|
6
|
+
metadata: {
|
|
7
|
+
hash: string;
|
|
8
|
+
context?: string;
|
|
9
|
+
} & Record<string, any>;
|
|
10
|
+
}) => Promise<TranslatedChildren>;
|
|
11
|
+
export type TranslateI18nextCallback = TranslateIcuCallback;
|
|
12
|
+
export type TranslateChildrenCallback = (params: {
|
|
13
|
+
source: JsxChildren | undefined;
|
|
14
|
+
targetLocale: string;
|
|
15
|
+
metadata: {
|
|
16
|
+
hash: string;
|
|
17
|
+
context?: string;
|
|
18
|
+
} & Record<string, any>;
|
|
19
|
+
}) => Promise<TranslatedChildren>;
|
|
20
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/types/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACpE,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAElC,MAAM,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAE5D,MAAM,MAAM,yBAAyB,GAAG,CAAC,MAAM,EAAE;IAC/C,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACpE,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC"}
|