gt-react-native 11.0.0-odysseus.9 → 11.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.
Files changed (70) hide show
  1. package/dist/commonjs/condition-store/NativeConditionStore.js +19 -27
  2. package/dist/commonjs/condition-store/NativeConditionStore.js.map +1 -1
  3. package/dist/commonjs/hooks/selectors.js.map +1 -1
  4. package/dist/commonjs/index.js +34 -9
  5. package/dist/commonjs/provider/GTProvider.js +32 -21
  6. package/dist/commonjs/provider/GTProvider.js.map +1 -1
  7. package/dist/commonjs/provider/NativeGTProvider.js +0 -3
  8. package/dist/commonjs/provider/NativeGTProvider.js.map +1 -1
  9. package/dist/commonjs/setup/initializeGT.js +6 -11
  10. package/dist/commonjs/utils/getInitialNativeConditions.js +2 -2
  11. package/dist/commonjs/utils/getInitialNativeConditions.js.map +1 -1
  12. package/dist/commonjs/utils/getLocale.js +1 -1
  13. package/dist/commonjs/utils/getLocale.js.map +1 -1
  14. package/dist/commonjs/utils/nativeStore.js +2 -2
  15. package/dist/commonjs/utils/nativeStore.js.map +1 -1
  16. package/dist/commonjs/utils/resolveLocale.js +1 -2
  17. package/dist/commonjs/utils/resolveLocale.js.map +1 -1
  18. package/dist/module/condition-store/NativeConditionStore.d.ts +0 -7
  19. package/dist/module/condition-store/NativeConditionStore.d.ts.map +1 -1
  20. package/dist/module/condition-store/NativeConditionStore.js +20 -28
  21. package/dist/module/condition-store/NativeConditionStore.js.map +1 -1
  22. package/dist/module/hooks/selectors.d.ts +3 -11
  23. package/dist/module/hooks/selectors.d.ts.map +1 -1
  24. package/dist/module/hooks/selectors.js.map +1 -1
  25. package/dist/module/index.d.ts +2 -3
  26. package/dist/module/index.d.ts.map +1 -1
  27. package/dist/module/index.js +3 -4
  28. package/dist/module/provider/GTProvider.d.ts +1 -1
  29. package/dist/module/provider/GTProvider.d.ts.map +1 -1
  30. package/dist/module/provider/GTProvider.js +32 -21
  31. package/dist/module/provider/GTProvider.js.map +1 -1
  32. package/dist/module/provider/NativeGTProvider.d.ts.map +1 -1
  33. package/dist/module/provider/NativeGTProvider.js +0 -3
  34. package/dist/module/provider/NativeGTProvider.js.map +1 -1
  35. package/dist/module/setup/initializeGT.d.ts +3 -4
  36. package/dist/module/setup/initializeGT.d.ts.map +1 -1
  37. package/dist/module/setup/initializeGT.js +1 -11
  38. package/dist/module/utils/getInitialNativeConditions.d.ts.map +1 -1
  39. package/dist/module/utils/getInitialNativeConditions.js +3 -3
  40. package/dist/module/utils/getInitialNativeConditions.js.map +1 -1
  41. package/dist/module/utils/getLocale.d.ts.map +1 -1
  42. package/dist/module/utils/getLocale.js +2 -2
  43. package/dist/module/utils/getLocale.js.map +1 -1
  44. package/dist/module/utils/nativeStore.d.ts +1 -1
  45. package/dist/module/utils/nativeStore.d.ts.map +1 -1
  46. package/dist/module/utils/nativeStore.js +3 -3
  47. package/dist/module/utils/nativeStore.js.map +1 -1
  48. package/dist/module/utils/resolveLocale.d.ts.map +1 -1
  49. package/dist/module/utils/resolveLocale.js +1 -2
  50. package/dist/module/utils/resolveLocale.js.map +1 -1
  51. package/package.json +6 -6
  52. package/src/condition-store/NativeConditionStore.ts +21 -40
  53. package/src/hooks/selectors.ts +17 -3
  54. package/src/index.tsx +5 -2
  55. package/src/provider/GTProvider.tsx +51 -29
  56. package/src/provider/NativeGTProvider.tsx +1 -9
  57. package/src/setup/initializeGT.ts +7 -19
  58. package/src/utils/getInitialNativeConditions.ts +3 -6
  59. package/src/utils/getLocale.ts +2 -2
  60. package/src/utils/nativeStore.ts +3 -3
  61. package/src/utils/resolveLocale.ts +1 -5
  62. package/dist/commonjs/hooks/utils.js +0 -17
  63. package/dist/commonjs/hooks/utils.js.map +0 -1
  64. package/dist/commonjs/setup/initializeGT.js.map +0 -1
  65. package/dist/module/hooks/utils.d.ts +0 -3
  66. package/dist/module/hooks/utils.d.ts.map +0 -1
  67. package/dist/module/hooks/utils.js +0 -14
  68. package/dist/module/hooks/utils.js.map +0 -1
  69. package/dist/module/setup/initializeGT.js.map +0 -1
  70. package/src/hooks/utils.ts +0 -14
@@ -3,14 +3,28 @@ import {
3
3
  useInternalLocaleSelector,
4
4
  useInternalRegionSelector,
5
5
  } from '@generaltranslation/react-core/hooks';
6
- import type { InternalRegionSelectorOptions } from '@generaltranslation/react-core/hooks';
6
+ import type {
7
+ InternalLocaleSelectorResult,
8
+ InternalRegionSelectorOptions,
9
+ InternalRegionSelectorResult,
10
+ } from '@generaltranslation/react-core/hooks';
7
11
 
8
- export function useLocaleSelector(locales?: string[]) {
12
+ // Explicit return types are required: project references make TypeScript try to
13
+ // name the inferred selector types, which otherwise reach into
14
+ // generaltranslation's non-portable bundled declarations (TS2742).
15
+ export function useLocaleSelector(
16
+ locales?: string[]
17
+ ): InternalLocaleSelectorResult & { setLocale: (locale: string) => void } {
9
18
  const setLocale = useSetLocale();
10
19
  return { setLocale, ...useInternalLocaleSelector(locales) };
11
20
  }
12
21
 
13
- export function useRegionSelector(options?: InternalRegionSelectorOptions) {
22
+ export function useRegionSelector(
23
+ options?: InternalRegionSelectorOptions
24
+ ): InternalRegionSelectorResult & {
25
+ setLocale: (locale: string) => void;
26
+ setRegion: (region: string | undefined) => void;
27
+ } {
14
28
  const setLocale = useSetLocale();
15
29
  const setRegion = useSetRegion();
16
30
  return { setLocale, setRegion, ...useInternalRegionSelector(options) };
package/src/index.tsx CHANGED
@@ -19,8 +19,8 @@ export {
19
19
  useEnableI18n,
20
20
  useFormatLocales,
21
21
  useGT,
22
- useGTClass,
23
22
  useLocale,
23
+ useLocaleDirection,
24
24
  useLocaleProperties,
25
25
  useLocales,
26
26
  useMessages,
@@ -33,7 +33,6 @@ export {
33
33
  useSetEnableI18n,
34
34
  } from './hooks/condition-store';
35
35
  export { useLocaleSelector, useRegionSelector } from './hooks/selectors';
36
- export { useLocaleDirection, useVersionId } from './hooks/utils';
37
36
 
38
37
  // ===== Functions ===== //
39
38
  export {
@@ -43,9 +42,13 @@ export {
43
42
  decodeVars,
44
43
  declareVar,
45
44
  derive,
45
+ getDefaultLocale,
46
46
  getFormatLocales,
47
+ getLocales,
48
+ resolveCanonicalLocale,
47
49
  getReactI18nCache,
48
50
  getTranslationsSnapshot,
51
+ getVersionId,
49
52
  gtFallback,
50
53
  mFallback,
51
54
  msg,
@@ -14,7 +14,10 @@ import {
14
14
  } from '../utils/getInitialNativeConditions';
15
15
  import { resolveLocale } from '../utils/resolveLocale';
16
16
  import { loadTranslations, type LocaleTranslations } from './loadTranslations';
17
- import { NativeGTProvider } from './NativeGTProvider';
17
+ import {
18
+ NativeGTProvider,
19
+ type NativeGTProviderProps,
20
+ } from './NativeGTProvider';
18
21
 
19
22
  export type GTProviderProps = Omit<
20
23
  InternalGTProviderProps,
@@ -23,49 +26,37 @@ export type GTProviderProps = Omit<
23
26
  Omit<NativeConditionStoreParams, 'locale' | '_reload'> & {
24
27
  children?: ReactNode;
25
28
  locale?: LocaleCandidates;
26
- loadingFallback?: ReactNode;
29
+ fallback?: ReactNode;
27
30
  };
28
31
 
29
- type LoadableGTProviderProps = Omit<GTProviderProps, 'loadingFallback'>;
32
+ type LoadedGTProviderProps = Omit<NativeGTProviderProps, 'translations'>;
30
33
  type TranslationSnapshot = Record<Locale, LocaleTranslations>;
31
34
 
32
35
  export function GTProvider(props: GTProviderProps) {
33
- const { loadingFallback, ...providerProps } = props;
34
-
35
- return (
36
- <Suspense fallback={loadingFallback ?? <DefaultLoadingFallback />}>
37
- <LoadableGTProvider {...providerProps} />
38
- </Suspense>
39
- );
36
+ return <LoadableGTProvider {...props} />;
40
37
  }
41
38
 
42
39
  /**
43
40
  * This wrapper takes the place of a loader that would be present in
44
41
  * SSR style applications.
45
42
  */
46
- function LoadableGTProvider(props: LoadableGTProviderProps) {
47
- const {
48
- locale,
49
- localeStoreKey,
50
- region,
51
- regionStoreKey,
52
- enableI18n,
53
- enableI18nStoreKey,
54
- } = props;
43
+ function LoadableGTProvider(props: GTProviderProps) {
44
+ const { fallback, ...providerProps } = props;
45
+ const renderedFallback = fallback ?? <DefaultLoadingFallback />;
46
+ const { locale, region, enableI18n } = providerProps;
55
47
  // Keep native conditions in React state so condition-store writes trigger rerenders.
56
48
  const [nativeConditions, setNativeConditions] =
57
49
  useState<NativeConditionStoreState>(() => ({
58
- locale: getLocale({ localeStoreKey }),
59
- region: getInitialRegion({ region, regionStoreKey }),
60
- enableI18n: getInitialEnableI18n({ enableI18n, enableI18nStoreKey }),
50
+ locale: getLocale(),
51
+ region: getInitialRegion({ region }),
52
+ enableI18n: getInitialEnableI18n({ enableI18n }),
61
53
  }));
62
54
  const activeLocale = resolveLocale(locale ?? nativeConditions.locale);
63
55
  const activeRegion = region ?? nativeConditions.region;
64
56
  const activeEnableI18n = enableI18n ?? nativeConditions.enableI18n;
65
- const localeTranslations = use(loadTranslations(activeLocale));
66
- const translations = useMemo<TranslationSnapshot>(
67
- () => ({ [activeLocale]: localeTranslations }),
68
- [activeLocale, localeTranslations]
57
+ const fallbackTranslations = useMemo<TranslationSnapshot>(
58
+ () => ({ [activeLocale]: {} }),
59
+ [activeLocale]
69
60
  );
70
61
  const reload = useCallback(
71
62
  (state: NativeConditionStoreState) => {
@@ -81,14 +72,45 @@ function LoadableGTProvider(props: LoadableGTProviderProps) {
81
72
  [enableI18n, locale, region]
82
73
  );
83
74
 
75
+ return (
76
+ <Suspense
77
+ fallback={
78
+ <NativeGTProvider
79
+ {...providerProps}
80
+ locale={activeLocale}
81
+ region={activeRegion}
82
+ enableI18n={activeEnableI18n}
83
+ translations={fallbackTranslations}
84
+ _reload={reload}
85
+ >
86
+ {renderedFallback}
87
+ </NativeGTProvider>
88
+ }
89
+ >
90
+ <LoadedGTProvider
91
+ {...providerProps}
92
+ locale={activeLocale}
93
+ region={activeRegion}
94
+ enableI18n={activeEnableI18n}
95
+ _reload={reload}
96
+ />
97
+ </Suspense>
98
+ );
99
+ }
100
+
101
+ function LoadedGTProvider(props: LoadedGTProviderProps) {
102
+ const activeLocale = resolveLocale(props.locale);
103
+ const localeTranslations = use(loadTranslations(activeLocale));
104
+ const translations = useMemo<TranslationSnapshot>(
105
+ () => ({ [activeLocale]: localeTranslations }),
106
+ [activeLocale, localeTranslations]
107
+ );
108
+
84
109
  return (
85
110
  <NativeGTProvider
86
111
  {...props}
87
112
  locale={activeLocale}
88
- region={activeRegion}
89
- enableI18n={activeEnableI18n}
90
113
  translations={translations}
91
- _reload={reload}
92
114
  />
93
115
  );
94
116
  }
@@ -19,15 +19,7 @@ export type NativeGTProviderProps = Omit<
19
19
  export function NativeGTProvider(props: NativeGTProviderProps) {
20
20
  const conditionStore = useMemo(() => {
21
21
  return new NativeConditionStore(props);
22
- }, [
23
- props.locale,
24
- props.region,
25
- props.enableI18n,
26
- props.localeStoreKey,
27
- props.regionStoreKey,
28
- props.enableI18nStoreKey,
29
- props._reload,
30
- ]);
22
+ }, [props.locale, props.region, props.enableI18n, props._reload]);
31
23
 
32
24
  const i18nStoreRef = useRef<I18nStore | null>(null);
33
25
  if (i18nStoreRef.current == null) {
@@ -1,23 +1,11 @@
1
- import {
2
- initializeI18nConfig,
3
- setReactI18nCache,
4
- } from '@generaltranslation/react-core/pure';
5
- import { ReactI18nCache } from '@generaltranslation/react-core/pure';
6
- import type { ReactI18nCacheParams } from '@generaltranslation/react-core/pure';
7
- import { setupGTServicesEnabled } from 'gt-i18n/internal';
8
1
  import type {
9
- GTServicesEnabledParams,
10
2
  I18nConfigParams,
11
- } from 'gt-i18n/internal/types';
12
-
13
- export type InitializeGTParams = I18nConfigParams &
14
- GTServicesEnabledParams &
15
- ReactI18nCacheParams;
3
+ ReactI18nCacheParams,
4
+ } from '@generaltranslation/react-core/pure';
16
5
 
17
- export function initializeGT(config: InitializeGTParams): void {
18
- setupGTServicesEnabled(config);
19
- initializeI18nConfig(config, 'server-render');
6
+ export type InitializeGTParams = I18nConfigParams & ReactI18nCacheParams;
20
7
 
21
- const i18nCache = new ReactI18nCache(config);
22
- setReactI18nCache(i18nCache);
23
- }
8
+ // Server-render initialization is identical to react-core's shared implementation
9
+ // (there is no native-specific setup here), so re-export it directly instead of
10
+ // maintaining a byte-for-byte copy.
11
+ export { internalInitializeGTSRA as initializeGT } from '@generaltranslation/react-core/pure';
@@ -1,8 +1,5 @@
1
1
  import type { WritableConditionStoreParams } from 'gt-i18n/internal/types';
2
- import {
3
- defaultEnableI18nCookieName as defaultEnableI18nStoreKey,
4
- defaultRegionCookieName as defaultRegionStoreKey,
5
- } from '@generaltranslation/react-core/pure';
2
+ import { getI18nConfig } from '@generaltranslation/react-core/pure';
6
3
  import { nativeStoreGet } from './nativeStore';
7
4
 
8
5
  type InitialRegionParams = Pick<WritableConditionStoreParams, 'region'> & {
@@ -18,7 +15,7 @@ type InitialEnableI18nParams = Pick<
18
15
 
19
16
  export function getInitialRegion({
20
17
  region,
21
- regionStoreKey = defaultRegionStoreKey,
18
+ regionStoreKey = getI18nConfig().getRegionCookieName(),
22
19
  }: InitialRegionParams): string | undefined {
23
20
  if (region !== undefined) return region;
24
21
  return nativeStoreGet(regionStoreKey) || undefined;
@@ -26,7 +23,7 @@ export function getInitialRegion({
26
23
 
27
24
  export function getInitialEnableI18n({
28
25
  enableI18n,
29
- enableI18nStoreKey = defaultEnableI18nStoreKey,
26
+ enableI18nStoreKey = getI18nConfig().getEnableI18nCookieName(),
30
27
  }: InitialEnableI18nParams): boolean {
31
28
  if (enableI18n !== undefined) return enableI18n;
32
29
  const storedEnableI18n = nativeStoreGet(enableI18nStoreKey);
@@ -1,5 +1,5 @@
1
1
  import type { LocaleCandidates } from 'gt-i18n/internal/types';
2
- import { defaultLocaleCookieName as defaultLocaleStoreKey } from '@generaltranslation/react-core/pure';
2
+ import { getI18nConfig } from '@generaltranslation/react-core/pure';
3
3
  import { getNativeLocales } from './getNativeLocales';
4
4
  import { nativeStoreGet } from './nativeStore';
5
5
  import { resolveLocale } from './resolveLocale';
@@ -12,7 +12,7 @@ export type GetLocaleParams = {
12
12
  * @internal
13
13
  */
14
14
  export function getLocale({
15
- localeStoreKey = defaultLocaleStoreKey,
15
+ localeStoreKey = getI18nConfig().getLocaleCookieName(),
16
16
  }: GetLocaleParams = {}): string {
17
17
  const candidates: string[] = [];
18
18
  pushLocaleCandidates(candidates, nativeStoreGet(localeStoreKey));
@@ -1,5 +1,5 @@
1
- import { defaultLocaleCookieName as defaultLocaleStoreKey } from '@generaltranslation/react-core/pure';
2
1
  import { Platform } from 'react-native';
2
+ import { getI18nConfig } from '@generaltranslation/react-core/pure';
3
3
  import { GtReactNative } from '../NativeGtReactNative';
4
4
  import { ssrUnsupportedWarning } from '../errors-dir/warnings';
5
5
 
@@ -9,13 +9,13 @@ import { ssrUnsupportedWarning } from '../errors-dir/warnings';
9
9
  * This reads persisted native storage directly, so it can temporarily be out of
10
10
  * sync with React state while a locale change is in progress.
11
11
  *
12
- * If GTProvider uses a custom localeStoreKey, pass that same value as the key.
12
+ * Defaults to the store key configured through initializeGT().
13
13
  *
14
14
  * @param key - The key to get the locale from
15
15
  * @returns The locale from the native store
16
16
  */
17
17
  export function getLocaleFromNativeStore(
18
- key = defaultLocaleStoreKey
18
+ key = getI18nConfig().getLocaleCookieName()
19
19
  ): string | null {
20
20
  return nativeStoreGet(key);
21
21
  }
@@ -2,9 +2,5 @@ import { getI18nConfig } from 'gt-i18n/internal';
2
2
  import type { LocaleCandidates } from 'gt-i18n/internal/types';
3
3
 
4
4
  export function resolveLocale(candidates?: LocaleCandidates | null): string {
5
- const i18nConfig = getI18nConfig();
6
- return (
7
- i18nConfig.determineLocale(candidates ?? undefined) ||
8
- i18nConfig.getDefaultLocale()
9
- );
5
+ return getI18nConfig().resolveSupportedLocale(candidates ?? undefined);
10
6
  }
@@ -1,17 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("../_virtual/_rolldown/runtime.js");
3
- let _generaltranslation_react_core_pure = require("@generaltranslation/react-core/pure");
4
- let _generaltranslation_react_core_hooks = require("@generaltranslation/react-core/hooks");
5
- //#region src/hooks/utils.ts
6
- function useLocaleDirection(locale) {
7
- const currentLocale = (0, _generaltranslation_react_core_hooks.useLocale)();
8
- return (0, _generaltranslation_react_core_hooks.useLocaleDirection)(locale ?? currentLocale);
9
- }
10
- function useVersionId() {
11
- return (0, _generaltranslation_react_core_pure.getVersionId)();
12
- }
13
- //#endregion
14
- exports.useLocaleDirection = useLocaleDirection;
15
- exports.useVersionId = useVersionId;
16
-
17
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":[],"sources":["../../../src/hooks/utils.ts"],"sourcesContent":["import { getVersionId } from '@generaltranslation/react-core/pure';\nimport {\n useLocale,\n useLocaleDirection as useCoreLocaleDirection,\n} from '@generaltranslation/react-core/hooks';\n\nexport function useLocaleDirection(locale?: string): 'ltr' | 'rtl' {\n const currentLocale = useLocale();\n return useCoreLocaleDirection(locale ?? currentLocale);\n}\n\nexport function useVersionId(): string | undefined {\n return getVersionId();\n}\n"],"mappings":";;;;;AAMA,SAAgB,mBAAmB,QAAgC;CACjE,MAAM,iBAAA,GAAA,qCAAA,YAA2B;AACjC,SAAA,GAAA,qCAAA,oBAA8B,UAAU,cAAc;;AAGxD,SAAgB,eAAmC;AACjD,SAAA,GAAA,oCAAA,eAAqB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"initializeGT.js","names":["ReactI18nCache"],"sources":["../../../src/setup/initializeGT.ts"],"sourcesContent":["import {\n initializeI18nConfig,\n setReactI18nCache,\n} from '@generaltranslation/react-core/pure';\nimport { ReactI18nCache } from '@generaltranslation/react-core/pure';\nimport type { ReactI18nCacheParams } from '@generaltranslation/react-core/pure';\nimport { setupGTServicesEnabled } from 'gt-i18n/internal';\nimport type {\n GTServicesEnabledParams,\n I18nConfigParams,\n} from 'gt-i18n/internal/types';\n\nexport type InitializeGTParams = I18nConfigParams &\n GTServicesEnabledParams &\n ReactI18nCacheParams;\n\nexport function initializeGT(config: InitializeGTParams): void {\n setupGTServicesEnabled(config);\n initializeI18nConfig(config, 'server-render');\n\n const i18nCache = new ReactI18nCache(config);\n setReactI18nCache(i18nCache);\n}\n"],"mappings":";;;;;AAgBA,SAAgB,aAAa,QAAkC;AAC7D,EAAA,GAAA,iBAAA,wBAAuB,OAAO;AAC9B,EAAA,GAAA,oCAAA,sBAAqB,QAAQ,gBAAgB;AAG7C,EAAA,GAAA,oCAAA,mBAAkB,IADIA,oCAAAA,eAAe,OACV,CAAC"}
@@ -1,3 +0,0 @@
1
- export declare function useLocaleDirection(locale?: string): 'ltr' | 'rtl';
2
- export declare function useVersionId(): string | undefined;
3
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/hooks/utils.ts"],"names":[],"mappings":"AAMA,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAGjE;AAED,wBAAgB,YAAY,IAAI,MAAM,GAAG,SAAS,CAEjD"}
@@ -1,14 +0,0 @@
1
- import { getVersionId } from "@generaltranslation/react-core/pure";
2
- import { useLocale, useLocaleDirection as useLocaleDirection$1 } from "@generaltranslation/react-core/hooks";
3
- //#region src/hooks/utils.ts
4
- function useLocaleDirection(locale) {
5
- const currentLocale = useLocale();
6
- return useLocaleDirection$1(locale ?? currentLocale);
7
- }
8
- function useVersionId() {
9
- return getVersionId();
10
- }
11
- //#endregion
12
- export { useLocaleDirection, useVersionId };
13
-
14
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":["useCoreLocaleDirection"],"sources":["../../../src/hooks/utils.ts"],"sourcesContent":["import { getVersionId } from '@generaltranslation/react-core/pure';\nimport {\n useLocale,\n useLocaleDirection as useCoreLocaleDirection,\n} from '@generaltranslation/react-core/hooks';\n\nexport function useLocaleDirection(locale?: string): 'ltr' | 'rtl' {\n const currentLocale = useLocale();\n return useCoreLocaleDirection(locale ?? currentLocale);\n}\n\nexport function useVersionId(): string | undefined {\n return getVersionId();\n}\n"],"mappings":";;;AAMA,SAAgB,mBAAmB,QAAgC;CACjE,MAAM,gBAAgB,WAAW;AACjC,QAAOA,qBAAuB,UAAU,cAAc;;AAGxD,SAAgB,eAAmC;AACjD,QAAO,cAAc"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"initializeGT.js","names":[],"sources":["../../../src/setup/initializeGT.ts"],"sourcesContent":["import {\n initializeI18nConfig,\n setReactI18nCache,\n} from '@generaltranslation/react-core/pure';\nimport { ReactI18nCache } from '@generaltranslation/react-core/pure';\nimport type { ReactI18nCacheParams } from '@generaltranslation/react-core/pure';\nimport { setupGTServicesEnabled } from 'gt-i18n/internal';\nimport type {\n GTServicesEnabledParams,\n I18nConfigParams,\n} from 'gt-i18n/internal/types';\n\nexport type InitializeGTParams = I18nConfigParams &\n GTServicesEnabledParams &\n ReactI18nCacheParams;\n\nexport function initializeGT(config: InitializeGTParams): void {\n setupGTServicesEnabled(config);\n initializeI18nConfig(config, 'server-render');\n\n const i18nCache = new ReactI18nCache(config);\n setReactI18nCache(i18nCache);\n}\n"],"mappings":";;;AAgBA,SAAgB,aAAa,QAAkC;AAC7D,wBAAuB,OAAO;AAC9B,sBAAqB,QAAQ,gBAAgB;AAG7C,mBAAkB,IADI,eAAe,OACV,CAAC"}
@@ -1,14 +0,0 @@
1
- import { getVersionId } from '@generaltranslation/react-core/pure';
2
- import {
3
- useLocale,
4
- useLocaleDirection as useCoreLocaleDirection,
5
- } from '@generaltranslation/react-core/hooks';
6
-
7
- export function useLocaleDirection(locale?: string): 'ltr' | 'rtl' {
8
- const currentLocale = useLocale();
9
- return useCoreLocaleDirection(locale ?? currentLocale);
10
- }
11
-
12
- export function useVersionId(): string | undefined {
13
- return getVersionId();
14
- }