gt-react 10.5.1 → 10.6.0-alpha.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/dist/client.cjs.min.cjs +3 -3
- package/dist/client.d.ts +8 -3
- package/dist/client.esm.min.mjs +3 -3
- package/dist/dictionaries/collectUntranslatedEntries.d.ts +17 -0
- package/dist/dictionaries/collectUntranslatedEntries.d.ts.map +1 -0
- package/dist/dictionaries/getDictionaryEntry.d.ts.map +1 -1
- 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/mergeDictionaries.d.ts.map +1 -1
- package/dist/dictionaries/stripMetadataFromEntries.d.ts +6 -0
- package/dist/dictionaries/stripMetadataFromEntries.d.ts.map +1 -0
- package/dist/index.cjs.min.cjs +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.min.mjs +3 -3
- package/dist/internal/flattenDictionary.d.ts.map +1 -1
- package/dist/internal.cjs.min.cjs +3 -3
- package/dist/internal.d.ts +10 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.esm.min.mjs +3 -3
- package/dist/provider/ClientProvider.d.ts +1 -1
- package/dist/provider/ClientProvider.d.ts.map +1 -1
- package/dist/provider/GTProvider.d.ts.map +1 -1
- package/dist/provider/hooks/translation/useCreateInternalUseTranslationsFunction.d.ts +2 -4
- package/dist/provider/hooks/translation/useCreateInternalUseTranslationsFunction.d.ts.map +1 -1
- 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/useLoadDictionary.d.ts +8 -2
- package/dist/provider/hooks/useLoadDictionary.d.ts.map +1 -1
- package/dist/translation/hooks/useTranslations.d.ts +4 -1
- package/dist/translation/hooks/useTranslations.d.ts.map +1 -1
- package/dist/types/config.d.ts +1 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/context.d.ts +2 -1
- package/dist/types/context.d.ts.map +1 -1
- package/dist/types/types.d.ts +2 -1
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -12,12 +12,13 @@ import * as generaltranslation_dist_locales_getLocaleProperties from 'generaltra
|
|
|
12
12
|
type Entry = string;
|
|
13
13
|
type MetaEntry = {
|
|
14
14
|
$context?: string;
|
|
15
|
+
$_hash?: string;
|
|
15
16
|
[key: string]: unknown;
|
|
16
17
|
};
|
|
17
18
|
type DictionaryEntry = Entry | [Entry] | [Entry, MetaEntry];
|
|
18
19
|
type Dictionary = {
|
|
19
20
|
[key: string]: Dictionary | DictionaryEntry;
|
|
20
|
-
};
|
|
21
|
+
} | (Dictionary | DictionaryEntry)[];
|
|
21
22
|
/**
|
|
22
23
|
* Translated content types
|
|
23
24
|
*/
|
|
@@ -84,6 +85,7 @@ type GTContextType = {
|
|
|
84
85
|
_filterMessagesForPreload: (_messages: _Messages) => _Messages;
|
|
85
86
|
_preloadMessages: (_messages: _Messages) => Promise<Translations>;
|
|
86
87
|
_dictionaryFunction: (id: string, options?: DictionaryTranslationOptions) => string;
|
|
88
|
+
_dictionaryObjFunction: (id: string, idWithParent: string, options?: DictionaryTranslationOptions) => Dictionary | DictionaryEntry | string | undefined;
|
|
87
89
|
developmentApiEnabled: boolean;
|
|
88
90
|
locale: string;
|
|
89
91
|
locales: string[];
|
|
@@ -213,6 +215,7 @@ type GTProviderProps = {
|
|
|
213
215
|
type ClientProviderProps = {
|
|
214
216
|
children: any;
|
|
215
217
|
dictionary: Dictionary;
|
|
218
|
+
dictionaryTranslations: Dictionary;
|
|
216
219
|
translations: Translations;
|
|
217
220
|
locale: string;
|
|
218
221
|
locales: string[];
|
|
@@ -237,7 +240,7 @@ type ClientProviderProps = {
|
|
|
237
240
|
customMapping?: CustomMapping;
|
|
238
241
|
};
|
|
239
242
|
|
|
240
|
-
declare function ClientProvider({ children, dictionary, translations: _translations, locale: _locale, region: _region, _versionId, defaultLocale, translationRequired, dialectTranslationRequired, locales, renderSettings, projectId, devApiKey, runtimeUrl, developmentApiEnabled, resetLocaleCookieName, localeCookieName, regionCookieName, customMapping, }: ClientProviderProps): React$1.JSX.Element;
|
|
243
|
+
declare function ClientProvider({ children, dictionary: _dictionary, dictionaryTranslations: _dictionaryTranslations, translations: _translations, locale: _locale, region: _region, _versionId, defaultLocale, translationRequired, dialectTranslationRequired, locales, renderSettings, projectId, devApiKey, runtimeUrl, developmentApiEnabled, resetLocaleCookieName, localeCookieName, regionCookieName, customMapping, }: ClientProviderProps): React$1.JSX.Element;
|
|
241
244
|
|
|
242
245
|
/**
|
|
243
246
|
* The `<Branch>` component dynamically renders a specified branch of content or a fallback child component.
|
|
@@ -354,7 +357,9 @@ declare function useDefaultLocale(): string;
|
|
|
354
357
|
* const t = useTranslations();
|
|
355
358
|
* console.log(t('hello')); // Translates item 'hello'
|
|
356
359
|
*/
|
|
357
|
-
declare function useTranslations(id?: string): (id: string, options?: Record<string, any>) => string
|
|
360
|
+
declare function useTranslations(id?: string): ((id: string, options?: Record<string, any>) => string) & {
|
|
361
|
+
obj: (id: string, options?: Record<string, any>) => Dictionary | DictionaryEntry | string | undefined;
|
|
362
|
+
};
|
|
358
363
|
|
|
359
364
|
/**
|
|
360
365
|
* Retrieves the user's locale from the `<GTProvider>` context.
|