@generaltranslation/react-core 11.4.3 → 11.4.5
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 +12 -0
- package/dist/context/InternalGTProvider.cjs +1 -1
- package/dist/context/InternalGTProvider.cjs.map +1 -1
- package/dist/context/InternalGTProvider.d.ts +13 -3
- package/dist/context/InternalGTProvider.d.ts.map +1 -1
- package/dist/context/InternalGTProvider.mjs +1 -1
- package/dist/context/InternalGTProvider.mjs.map +1 -1
- package/dist/context/context.cjs.map +1 -1
- package/dist/context/context.mjs.map +1 -1
- package/dist/hooks/condition-store.cjs +1 -1
- package/dist/hooks/condition-store.cjs.map +1 -1
- package/dist/hooks/condition-store.d.ts +1 -4
- package/dist/hooks/condition-store.d.ts.map +1 -1
- package/dist/hooks/condition-store.mjs +1 -1
- package/dist/hooks/condition-store.mjs.map +1 -1
- package/dist/hooks/utils.cjs +1 -1
- package/dist/hooks/utils.cjs.map +1 -1
- package/dist/hooks/utils.d.ts.map +1 -1
- package/dist/hooks/utils.mjs +1 -1
- package/dist/hooks/utils.mjs.map +1 -1
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.mjs +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @generaltranslation/react-core
|
|
2
2
|
|
|
3
|
+
## 11.4.5
|
|
4
|
+
|
|
5
|
+
## 11.4.4
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- [#2330](https://github.com/generaltranslation/gt/pull/2330) [`9ee7dc3`](https://github.com/generaltranslation/gt/commit/9ee7dc3ae792cd81ce7edb5c6e43c963f7055261) Thanks [@eoinest](https://github.com/eoinest)! - Use server-provided locale and condition props as the only rendered state in server-rendered apps. Condition setters write cookies for middleware and request a reload; provider-free SPA apps keep their cookie-backed behavior.
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`5d75eb4`](https://github.com/generaltranslation/gt/commit/5d75eb475a9e36a61845f0368566a9d40466251c)]:
|
|
12
|
+
- generaltranslation@9.5.1
|
|
13
|
+
- gt-i18n@1.0.32
|
|
14
|
+
|
|
3
15
|
## 11.4.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./context.cjs`);let t=require(`react/jsx-runtime`),n=require(`react`);const r=e.getGTContext();function i({children:e,translations:i,dictionaries:a,
|
|
1
|
+
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./context.cjs`);let t=require(`react/jsx-runtime`),n=require(`react`);const r=e.getGTContext();function i({children:e,translations:i,dictionaries:a,locale:o,region:s,enableI18n:c,setLocale:l,setRegion:u,setEnableI18n:d,i18nStore:f,onMissingTranslation:p,onMissingDictionaryEntry:m,onMissingDictionaryObj:h}){let g=(0,n.useMemo)(()=>({translationsSnapshot:i,dictionariesSnapshot:a??{},i18nStore:f,locale:o,region:s,enableI18n:c,setLocale:l,setRegion:u,setEnableI18n:d,onMissingTranslation:p,onMissingDictionaryEntry:m,onMissingDictionaryObj:h}),[i,a,f,o,s,c,l,u,d,p,m,h]);return(0,n.useEffect)(()=>{f.updateTranslations(i),f.updateDictionaries(a??{})},[i,a,f]),(0,t.jsx)(r.Provider,{value:g,children:e})}exports.InternalGTProvider=i;
|
|
2
2
|
//# sourceMappingURL=InternalGTProvider.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalGTProvider.cjs","names":["getGTContext"],"sources":["../../src/context/InternalGTProvider.tsx"],"sourcesContent":["import { useEffect, useMemo, type ReactNode } from 'react';\nimport { I18nStore } from '../i18n-store/I18nStore';\nimport type { Dictionary, Translation } from 'gt-i18n/types';\nimport type {
|
|
1
|
+
{"version":3,"file":"InternalGTProvider.cjs","names":["getGTContext"],"sources":["../../src/context/InternalGTProvider.tsx"],"sourcesContent":["import { useEffect, useMemo, type ReactNode } from 'react';\nimport { I18nStore } from '../i18n-store/I18nStore';\nimport type { Dictionary, Translation } from 'gt-i18n/types';\nimport type { Locale, Hash } from 'gt-i18n/internal/types';\nimport { getGTContext } from './context';\nimport type {\n OnMissingDictionaryEntry,\n OnMissingDictionaryObj,\n OnMissingTranslation,\n} from '../hooks/utils/missing-translation';\n\nexport type InternalGTProviderProps = {\n children?: ReactNode;\n // For streaming translations to server\n translations: Record<Locale, Record<Hash, Translation>>;\n dictionaries?: Record<Locale, Dictionary>;\n locale: string;\n region: string | undefined;\n enableI18n: boolean;\n setLocale: (locale: string) => void;\n setRegion: (region: string | undefined) => void;\n setEnableI18n: (enabled: boolean) => void;\n i18nStore: I18nStore;\n // Custom override missing translation behavior for dev hot reload\n onMissingTranslation?: OnMissingTranslation;\n onMissingDictionaryEntry?: OnMissingDictionaryEntry;\n onMissingDictionaryObj?: OnMissingDictionaryObj;\n};\n\n// ===== Component ===== //\nconst GTContext = getGTContext();\n/**\n * - Shared provider logic btwn client and server providers\n * - This is not userfacing, it should be wrapped in a userfacing provider with runtime-specific logic\n * - Locale and translations (and dictionaries if applicable) are required\n *\n * TODO: selectively filter to only pass new translations to client for dev hot reload\n * TODO: rename parent directory to \"/provider\" (separate PR)\n */\nexport function InternalGTProvider({\n children,\n translations,\n dictionaries,\n locale,\n region,\n enableI18n,\n setLocale,\n setRegion,\n setEnableI18n,\n i18nStore,\n onMissingTranslation,\n onMissingDictionaryEntry,\n onMissingDictionaryObj,\n}: InternalGTProviderProps) {\n const value = useMemo(\n () => ({\n translationsSnapshot: translations,\n dictionariesSnapshot: dictionaries ?? {},\n i18nStore,\n locale,\n region,\n enableI18n,\n setLocale,\n setRegion,\n setEnableI18n,\n onMissingTranslation,\n onMissingDictionaryEntry,\n onMissingDictionaryObj,\n }),\n [\n translations,\n dictionaries,\n i18nStore,\n locale,\n region,\n enableI18n,\n setLocale,\n setRegion,\n setEnableI18n,\n onMissingTranslation,\n onMissingDictionaryEntry,\n onMissingDictionaryObj,\n ]\n );\n\n // Update cache with data from server, do not emit events\n useEffect(() => {\n i18nStore.updateTranslations(translations);\n i18nStore.updateDictionaries(dictionaries ?? {});\n }, [translations, dictionaries, i18nStore]);\n\n return <GTContext.Provider value={value}>{children}</GTContext.Provider>;\n}\n"],"mappings":"oIA8BA,MAAM,EAAYA,EAAAA,cAAc,CAShC,SAAgB,EAAmB,CACjC,WACA,eACA,eACA,SACA,SACA,aACA,YACA,YACA,gBACA,YACA,uBACA,2BACA,0BAC0B,CAC1B,IAAM,GAAA,EAAA,EAAA,cACG,CACL,qBAAsB,EACtB,qBAAsB,GAAgB,EAAE,CACxC,YACA,SACA,SACA,aACA,YACA,YACA,gBACA,uBACA,2BACA,yBACD,EACD,CACE,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACD,CACF,CAQD,OALA,EAAA,EAAA,eAAgB,CACd,EAAU,mBAAmB,EAAa,CAC1C,EAAU,mBAAmB,GAAgB,EAAE,CAAC,EAC/C,CAAC,EAAc,EAAc,EAAU,CAAC,EAEpC,EAAA,EAAA,KAAC,EAAU,SAAX,CAA2B,QAAQ,WAA8B,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { I18nStore } from "../i18n-store/I18nStore.js";
|
|
|
2
2
|
import { OnMissingDictionaryEntry, OnMissingDictionaryObj, OnMissingTranslation } from "../hooks/utils/missing-translation.js";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
import { Dictionary, Translation } from "gt-i18n/types";
|
|
5
|
-
import { Hash, Locale
|
|
5
|
+
import { Hash, Locale } from "gt-i18n/internal/types";
|
|
6
6
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
7
7
|
|
|
8
8
|
//#region src/context/InternalGTProvider.d.ts
|
|
@@ -10,7 +10,12 @@ type InternalGTProviderProps = {
|
|
|
10
10
|
children?: ReactNode;
|
|
11
11
|
translations: Record<Locale, Record<Hash, Translation>>;
|
|
12
12
|
dictionaries?: Record<Locale, Dictionary>;
|
|
13
|
-
|
|
13
|
+
locale: string;
|
|
14
|
+
region: string | undefined;
|
|
15
|
+
enableI18n: boolean;
|
|
16
|
+
setLocale: (locale: string) => void;
|
|
17
|
+
setRegion: (region: string | undefined) => void;
|
|
18
|
+
setEnableI18n: (enabled: boolean) => void;
|
|
14
19
|
i18nStore: I18nStore;
|
|
15
20
|
onMissingTranslation?: OnMissingTranslation;
|
|
16
21
|
onMissingDictionaryEntry?: OnMissingDictionaryEntry;
|
|
@@ -28,7 +33,12 @@ declare function InternalGTProvider({
|
|
|
28
33
|
children,
|
|
29
34
|
translations,
|
|
30
35
|
dictionaries,
|
|
31
|
-
|
|
36
|
+
locale,
|
|
37
|
+
region,
|
|
38
|
+
enableI18n,
|
|
39
|
+
setLocale,
|
|
40
|
+
setRegion,
|
|
41
|
+
setEnableI18n,
|
|
32
42
|
i18nStore,
|
|
33
43
|
onMissingTranslation,
|
|
34
44
|
onMissingDictionaryEntry,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalGTProvider.d.ts","names":[],"sources":["../../src/context/InternalGTProvider.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"InternalGTProvider.d.ts","names":[],"sources":["../../src/context/InternalGTProvider.tsx"],"mappings":";;;;;;;;KAWY,uBAAA;EACV,QAAA,GAAW,SAAA;EAEX,YAAA,EAAc,MAAA,CAAO,MAAA,EAAQ,MAAA,CAAO,IAAA,EAAM,WAAA;EAC1C,YAAA,GAAe,MAAA,CAAO,MAAA,EAAQ,UAAA;EAC9B,MAAA;EACA,MAAA;EACA,UAAA;EACA,SAAA,GAAY,MAAA;EACZ,SAAA,GAAY,MAAA;EACZ,aAAA,GAAgB,OAAA;EAChB,SAAA,EAAW,SAAA;EAEX,oBAAA,GAAuB,oBAAA;EACvB,wBAAA,GAA2B,wBAAA;EAC3B,sBAAA,GAAyB,sBAAA;AAAA;;;;;;;;;iBAaX,kBAAA,CAAA;EACd,QAAA;EACA,YAAA;EACA,YAAA;EACA,MAAA;EACA,MAAA;EACA,UAAA;EACA,SAAA;EACA,SAAA;EACA,aAAA;EACA,SAAA;EACA,oBAAA;EACA,wBAAA;EACA;AAAA,GACC,uBAAA,GAAuB,oBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getGTContext as e}from"./context.mjs";import{jsx as t}from"react/jsx-runtime";import{useEffect as n,useMemo as r}from"react";const i=e();function a({children:e,translations:a,dictionaries:o,
|
|
1
|
+
import{getGTContext as e}from"./context.mjs";import{jsx as t}from"react/jsx-runtime";import{useEffect as n,useMemo as r}from"react";const i=e();function a({children:e,translations:a,dictionaries:o,locale:s,region:c,enableI18n:l,setLocale:u,setRegion:d,setEnableI18n:f,i18nStore:p,onMissingTranslation:m,onMissingDictionaryEntry:h,onMissingDictionaryObj:g}){let _=r(()=>({translationsSnapshot:a,dictionariesSnapshot:o??{},i18nStore:p,locale:s,region:c,enableI18n:l,setLocale:u,setRegion:d,setEnableI18n:f,onMissingTranslation:m,onMissingDictionaryEntry:h,onMissingDictionaryObj:g}),[a,o,p,s,c,l,u,d,f,m,h,g]);return n(()=>{p.updateTranslations(a),p.updateDictionaries(o??{})},[a,o,p]),t(i.Provider,{value:_,children:e})}export{a as InternalGTProvider};
|
|
2
2
|
//# sourceMappingURL=InternalGTProvider.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalGTProvider.mjs","names":[],"sources":["../../src/context/InternalGTProvider.tsx"],"sourcesContent":["import { useEffect, useMemo, type ReactNode } from 'react';\nimport { I18nStore } from '../i18n-store/I18nStore';\nimport type { Dictionary, Translation } from 'gt-i18n/types';\nimport type {
|
|
1
|
+
{"version":3,"file":"InternalGTProvider.mjs","names":[],"sources":["../../src/context/InternalGTProvider.tsx"],"sourcesContent":["import { useEffect, useMemo, type ReactNode } from 'react';\nimport { I18nStore } from '../i18n-store/I18nStore';\nimport type { Dictionary, Translation } from 'gt-i18n/types';\nimport type { Locale, Hash } from 'gt-i18n/internal/types';\nimport { getGTContext } from './context';\nimport type {\n OnMissingDictionaryEntry,\n OnMissingDictionaryObj,\n OnMissingTranslation,\n} from '../hooks/utils/missing-translation';\n\nexport type InternalGTProviderProps = {\n children?: ReactNode;\n // For streaming translations to server\n translations: Record<Locale, Record<Hash, Translation>>;\n dictionaries?: Record<Locale, Dictionary>;\n locale: string;\n region: string | undefined;\n enableI18n: boolean;\n setLocale: (locale: string) => void;\n setRegion: (region: string | undefined) => void;\n setEnableI18n: (enabled: boolean) => void;\n i18nStore: I18nStore;\n // Custom override missing translation behavior for dev hot reload\n onMissingTranslation?: OnMissingTranslation;\n onMissingDictionaryEntry?: OnMissingDictionaryEntry;\n onMissingDictionaryObj?: OnMissingDictionaryObj;\n};\n\n// ===== Component ===== //\nconst GTContext = getGTContext();\n/**\n * - Shared provider logic btwn client and server providers\n * - This is not userfacing, it should be wrapped in a userfacing provider with runtime-specific logic\n * - Locale and translations (and dictionaries if applicable) are required\n *\n * TODO: selectively filter to only pass new translations to client for dev hot reload\n * TODO: rename parent directory to \"/provider\" (separate PR)\n */\nexport function InternalGTProvider({\n children,\n translations,\n dictionaries,\n locale,\n region,\n enableI18n,\n setLocale,\n setRegion,\n setEnableI18n,\n i18nStore,\n onMissingTranslation,\n onMissingDictionaryEntry,\n onMissingDictionaryObj,\n}: InternalGTProviderProps) {\n const value = useMemo(\n () => ({\n translationsSnapshot: translations,\n dictionariesSnapshot: dictionaries ?? {},\n i18nStore,\n locale,\n region,\n enableI18n,\n setLocale,\n setRegion,\n setEnableI18n,\n onMissingTranslation,\n onMissingDictionaryEntry,\n onMissingDictionaryObj,\n }),\n [\n translations,\n dictionaries,\n i18nStore,\n locale,\n region,\n enableI18n,\n setLocale,\n setRegion,\n setEnableI18n,\n onMissingTranslation,\n onMissingDictionaryEntry,\n onMissingDictionaryObj,\n ]\n );\n\n // Update cache with data from server, do not emit events\n useEffect(() => {\n i18nStore.updateTranslations(translations);\n i18nStore.updateDictionaries(dictionaries ?? {});\n }, [translations, dictionaries, i18nStore]);\n\n return <GTContext.Provider value={value}>{children}</GTContext.Provider>;\n}\n"],"mappings":"oIA8BA,MAAM,EAAY,GAAc,CAShC,SAAgB,EAAmB,CACjC,WACA,eACA,eACA,SACA,SACA,aACA,YACA,YACA,gBACA,YACA,uBACA,2BACA,0BAC0B,CAC1B,IAAM,EAAQ,OACL,CACL,qBAAsB,EACtB,qBAAsB,GAAgB,EAAE,CACxC,YACA,SACA,SACA,aACA,YACA,YACA,gBACA,uBACA,2BACA,yBACD,EACD,CACE,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACD,CACF,CAQD,OALA,MAAgB,CACd,EAAU,mBAAmB,EAAa,CAC1C,EAAU,mBAAmB,GAAgB,EAAE,CAAC,EAC/C,CAAC,EAAc,EAAc,EAAU,CAAC,CAEpC,EAAC,EAAU,SAAX,CAA2B,QAAQ,WAA8B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.cjs","names":["getI18nConfig"],"sources":["../../src/context/context.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"context.cjs","names":["getI18nConfig"],"sources":["../../src/context/context.ts"],"sourcesContent":["import { Dictionary, Hash, Locale } from 'gt-i18n/internal/types';\nimport { Translation } from 'gt-i18n/types';\nimport { createDiagnosticMessage } from 'generaltranslation/internal';\nimport { createGlobalSingleton } from 'gt-i18n/internal';\nimport { createContext, useContext, type Context } from 'react';\nimport { I18nStore } from '../i18n-store/I18nStore';\nimport { getI18nConfig } from '../setup/i18nConfig';\nimport type {\n OnMissingTranslation,\n OnMissingDictionaryEntry,\n OnMissingDictionaryObj,\n} from '../hooks/utils/missing-translation';\n\nexport type GTContextType = {\n /**\n * Source of truth for translations, streamed from server\n * In SPA mode, these won't be accessible and translations\n * can be accessed via useSyncExternalStore() directly\n */\n translationsSnapshot: Record<Locale, Record<Hash, Translation>>;\n dictionariesSnapshot: Record<Locale, Dictionary>;\n /**\n * I18nStore allows us to sync state updates in ConditionStore and I18nCache\n * with renders\n */\n i18nStore: I18nStore;\n locale: string;\n region: string | undefined;\n enableI18n: boolean;\n setLocale: (locale: string) => void;\n setRegion: (region: string | undefined) => void;\n setEnableI18n: (enabled: boolean) => void;\n /**\n * Custom override behavior on missing translations\n * Used for server triggering tx hmr b/c no access to useEffect\n */\n onMissingTranslation?: OnMissingTranslation;\n onMissingDictionaryEntry?: OnMissingDictionaryEntry;\n onMissingDictionaryObj?: OnMissingDictionaryObj;\n};\n\nconst gtContextSingleton = createGlobalSingleton<\n Context<GTContextType | undefined>\n>({\n namespace: 'reactCore',\n key: 'gtContext',\n source: '@generaltranslation/react-core',\n notInitialized: () =>\n createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'Cannot read GTContext before it has been initialized',\n why: 'the internal GTContext singleton is unavailable',\n fix: 'Add a <GTProvider> at the root of your component tree.',\n }),\n});\n\nexport function getGTContext(): Context<GTContextType | undefined> {\n // Lazily create the React context once and share it across instances.\n if (!gtContextSingleton.isInitialized()) {\n gtContextSingleton.set(createContext<GTContextType | undefined>(undefined));\n }\n return gtContextSingleton.get();\n}\n\nexport function useGTContext(): GTContextType | undefined {\n const context = useContext(getGTContext());\n if (context || getI18nConfig().getRenderStrategy() === 'SPA') {\n return context;\n }\n /**\n * TODO: in a separate PR, we should figure out how to make this more of a forgiving system\n */\n throw new Error(createMissingGTProviderError());\n}\n\nfunction createMissingGTProviderError(): string {\n return createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'GT runtime context could not be read',\n why: 'GTContext was accessed outside of a <GTProvider>',\n fix: 'Add a <GTProvider> at the root of your component tree.',\n });\n}\n"],"mappings":"sLAyCA,MAAM,GAAA,EAAA,EAAA,uBAEJ,CACA,UAAW,YACX,IAAK,YACL,OAAQ,iCACR,oBAAA,EAAA,EAAA,yBAC0B,CACtB,OAAQ,iCACR,SAAU,QACV,aAAc,uDACd,IAAK,kDACL,IAAK,yDACN,CAAC,CACL,CAAC,CAEF,SAAgB,GAAmD,CAKjE,OAHK,EAAmB,eAAe,EACrC,EAAmB,KAAA,EAAA,EAAA,eAA6C,IAAA,GAAU,CAAC,CAEtE,EAAmB,KAAK,CAGjC,SAAgB,GAA0C,CACxD,IAAM,GAAA,EAAA,EAAA,YAAqB,GAAc,CAAC,CAC1C,GAAI,GAAWA,EAAAA,eAAe,CAAC,mBAAmB,GAAK,MACrD,OAAO,EAKT,MAAU,MAAM,GAA8B,CAAC,CAGjD,SAAS,GAAuC,CAC9C,OAAA,EAAA,EAAA,yBAA+B,CAC7B,OAAQ,iCACR,SAAU,QACV,aAAc,uCACd,IAAK,mDACL,IAAK,yDACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.mjs","names":["getI18nConfig"],"sources":["../../src/context/context.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"context.mjs","names":["getI18nConfig"],"sources":["../../src/context/context.ts"],"sourcesContent":["import { Dictionary, Hash, Locale } from 'gt-i18n/internal/types';\nimport { Translation } from 'gt-i18n/types';\nimport { createDiagnosticMessage } from 'generaltranslation/internal';\nimport { createGlobalSingleton } from 'gt-i18n/internal';\nimport { createContext, useContext, type Context } from 'react';\nimport { I18nStore } from '../i18n-store/I18nStore';\nimport { getI18nConfig } from '../setup/i18nConfig';\nimport type {\n OnMissingTranslation,\n OnMissingDictionaryEntry,\n OnMissingDictionaryObj,\n} from '../hooks/utils/missing-translation';\n\nexport type GTContextType = {\n /**\n * Source of truth for translations, streamed from server\n * In SPA mode, these won't be accessible and translations\n * can be accessed via useSyncExternalStore() directly\n */\n translationsSnapshot: Record<Locale, Record<Hash, Translation>>;\n dictionariesSnapshot: Record<Locale, Dictionary>;\n /**\n * I18nStore allows us to sync state updates in ConditionStore and I18nCache\n * with renders\n */\n i18nStore: I18nStore;\n locale: string;\n region: string | undefined;\n enableI18n: boolean;\n setLocale: (locale: string) => void;\n setRegion: (region: string | undefined) => void;\n setEnableI18n: (enabled: boolean) => void;\n /**\n * Custom override behavior on missing translations\n * Used for server triggering tx hmr b/c no access to useEffect\n */\n onMissingTranslation?: OnMissingTranslation;\n onMissingDictionaryEntry?: OnMissingDictionaryEntry;\n onMissingDictionaryObj?: OnMissingDictionaryObj;\n};\n\nconst gtContextSingleton = createGlobalSingleton<\n Context<GTContextType | undefined>\n>({\n namespace: 'reactCore',\n key: 'gtContext',\n source: '@generaltranslation/react-core',\n notInitialized: () =>\n createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'Cannot read GTContext before it has been initialized',\n why: 'the internal GTContext singleton is unavailable',\n fix: 'Add a <GTProvider> at the root of your component tree.',\n }),\n});\n\nexport function getGTContext(): Context<GTContextType | undefined> {\n // Lazily create the React context once and share it across instances.\n if (!gtContextSingleton.isInitialized()) {\n gtContextSingleton.set(createContext<GTContextType | undefined>(undefined));\n }\n return gtContextSingleton.get();\n}\n\nexport function useGTContext(): GTContextType | undefined {\n const context = useContext(getGTContext());\n if (context || getI18nConfig().getRenderStrategy() === 'SPA') {\n return context;\n }\n /**\n * TODO: in a separate PR, we should figure out how to make this more of a forgiving system\n */\n throw new Error(createMissingGTProviderError());\n}\n\nfunction createMissingGTProviderError(): string {\n return createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'GT runtime context could not be read',\n why: 'GTContext was accessed outside of a <GTProvider>',\n fix: 'Add a <GTProvider> at the root of your component tree.',\n });\n}\n"],"mappings":"6OAyCA,MAAM,EAAqB,EAEzB,CACA,UAAW,YACX,IAAK,YACL,OAAQ,iCACR,mBACE,EAAwB,CACtB,OAAQ,iCACR,SAAU,QACV,aAAc,uDACd,IAAK,kDACL,IAAK,yDACN,CAAC,CACL,CAAC,CAEF,SAAgB,GAAmD,CAKjE,OAHK,EAAmB,eAAe,EACrC,EAAmB,IAAI,EAAyC,IAAA,GAAU,CAAC,CAEtE,EAAmB,KAAK,CAGjC,SAAgB,GAA0C,CACxD,IAAM,EAAU,EAAW,GAAc,CAAC,CAC1C,GAAI,GAAWA,GAAe,CAAC,mBAAmB,GAAK,MACrD,OAAO,EAKT,MAAU,MAAM,GAA8B,CAAC,CAGjD,SAAS,GAAuC,CAC9C,OAAO,EAAwB,CAC7B,OAAQ,iCACR,SAAU,QACV,aAAc,uCACd,IAAK,mDACL,IAAK,yDACN,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
const e=require(`../condition-store/singleton-operations.cjs`),t=require(`../context/context.cjs`);function n(){let n=t.useGTContext();return n?n.locale:e.getConditionStore().getLocale()}function r(){let n=t.useGTContext();return n?n.region:e.getConditionStore().getRegion()}function i(){let n=t.useGTContext();return n?n.enableI18n:e.getConditionStore().getEnableI18n()}function a(){let n=t.useGTContext();return n?n.setLocale:e.getConditionStore().setLocale}function o(){let n=t.useGTContext();return n?n.setRegion:e.getConditionStore().setRegion}function s(){let n=t.useGTContext();return n?n.setEnableI18n:e.getConditionStore().setEnableI18n}exports.useEnableI18n=i,exports.useLocale=n,exports.useRegion=r,exports.useSetEnableI18n=s,exports.useSetLocale=a,exports.useSetRegion=o;
|
|
2
2
|
//# sourceMappingURL=condition-store.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition-store.cjs","names":["useGTContext","getReadonlyConditionStore"],"sources":["../../src/hooks/condition-store.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"condition-store.cjs","names":["useGTContext","getReadonlyConditionStore"],"sources":["../../src/hooks/condition-store.ts"],"sourcesContent":["import { getReadonlyConditionStore } from '../condition-store/singleton-operations';\nimport { useGTContext } from '../context/context';\n\n/**\n * Returns the current locale.\n */\nexport function useLocale(): string {\n const context = useGTContext();\n return context ? context.locale : getReadonlyConditionStore().getLocale();\n}\n\n/**\n * Returns the current region, or undefined if no region is set.\n */\nexport function useRegion(): string | undefined {\n const context = useGTContext();\n return context ? context.region : getReadonlyConditionStore().getRegion();\n}\n\n/**\n * Returns the current enableI18n flag.\n */\nexport function useEnableI18n(): boolean {\n const context = useGTContext();\n return context\n ? context.enableI18n\n : getReadonlyConditionStore().getEnableI18n();\n}\n\nexport function useSetLocale(): (locale: string) => void {\n const context = useGTContext();\n return context ? context.setLocale : getReadonlyConditionStore().setLocale;\n}\n\nexport function useSetRegion(): (region: string | undefined) => void {\n const context = useGTContext();\n return context ? context.setRegion : getReadonlyConditionStore().setRegion;\n}\n\nexport function useSetEnableI18n(): (enabled: boolean) => void {\n const context = useGTContext();\n return context\n ? context.setEnableI18n\n : getReadonlyConditionStore().setEnableI18n;\n}\n"],"mappings":"mGAMA,SAAgB,GAAoB,CAClC,IAAM,EAAUA,EAAAA,cAAc,CAC9B,OAAO,EAAU,EAAQ,OAASC,EAAAA,mBAA2B,CAAC,WAAW,CAM3E,SAAgB,GAAgC,CAC9C,IAAM,EAAUD,EAAAA,cAAc,CAC9B,OAAO,EAAU,EAAQ,OAASC,EAAAA,mBAA2B,CAAC,WAAW,CAM3E,SAAgB,GAAyB,CACvC,IAAM,EAAUD,EAAAA,cAAc,CAC9B,OAAO,EACH,EAAQ,WACRC,EAAAA,mBAA2B,CAAC,eAAe,CAGjD,SAAgB,GAAyC,CACvD,IAAM,EAAUD,EAAAA,cAAc,CAC9B,OAAO,EAAU,EAAQ,UAAYC,EAAAA,mBAA2B,CAAC,UAGnE,SAAgB,GAAqD,CACnE,IAAM,EAAUD,EAAAA,cAAc,CAC9B,OAAO,EAAU,EAAQ,UAAYC,EAAAA,mBAA2B,CAAC,UAGnE,SAAgB,GAA+C,CAC7D,IAAM,EAAUD,EAAAA,cAAc,CAC9B,OAAO,EACH,EAAQ,cACRC,EAAAA,mBAA2B,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { ReadonlyConditionStoreInterface } from "gt-i18n/internal/types";
|
|
2
|
-
|
|
3
1
|
//#region src/hooks/condition-store.d.ts
|
|
4
|
-
declare function useConditionStore(): ReadonlyConditionStoreInterface;
|
|
5
2
|
/**
|
|
6
3
|
* Returns the current locale.
|
|
7
4
|
*/
|
|
@@ -18,5 +15,5 @@ declare function useSetLocale(): (locale: string) => void;
|
|
|
18
15
|
declare function useSetRegion(): (region: string | undefined) => void;
|
|
19
16
|
declare function useSetEnableI18n(): (enabled: boolean) => void;
|
|
20
17
|
//#endregion
|
|
21
|
-
export {
|
|
18
|
+
export { useEnableI18n, useLocale, useRegion, useSetEnableI18n, useSetLocale, useSetRegion };
|
|
22
19
|
//# sourceMappingURL=condition-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition-store.d.ts","names":[],"sources":["../../src/hooks/condition-store.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"condition-store.d.ts","names":[],"sources":["../../src/hooks/condition-store.ts"],"mappings":";;AAMA;;iBAAgB,SAAA,CAAA;;;AAQhB;iBAAgB,SAAA,CAAA;;;;iBAQA,aAAA,CAAA;AAAA,iBAOA,YAAA,CAAA,IAAiB,MAAA;AAAA,iBAKjB,YAAA,CAAA,IAAiB,MAAA;AAAA,iBAKjB,gBAAA,CAAA,IAAqB,OAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getConditionStore as e}from"../condition-store/singleton-operations.mjs";import{useGTContext as t}from"../context/context.mjs";
|
|
1
|
+
import{getConditionStore as e}from"../condition-store/singleton-operations.mjs";import{useGTContext as t}from"../context/context.mjs";function n(){let n=t();return n?n.locale:e().getLocale()}function r(){let n=t();return n?n.region:e().getRegion()}function i(){let n=t();return n?n.enableI18n:e().getEnableI18n()}function a(){let n=t();return n?n.setLocale:e().setLocale}function o(){let n=t();return n?n.setRegion:e().setRegion}function s(){let n=t();return n?n.setEnableI18n:e().setEnableI18n}export{i as useEnableI18n,n as useLocale,r as useRegion,s as useSetEnableI18n,a as useSetLocale,o as useSetRegion};
|
|
2
2
|
//# sourceMappingURL=condition-store.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition-store.mjs","names":["getReadonlyConditionStore"],"sources":["../../src/hooks/condition-store.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"condition-store.mjs","names":["getReadonlyConditionStore"],"sources":["../../src/hooks/condition-store.ts"],"sourcesContent":["import { getReadonlyConditionStore } from '../condition-store/singleton-operations';\nimport { useGTContext } from '../context/context';\n\n/**\n * Returns the current locale.\n */\nexport function useLocale(): string {\n const context = useGTContext();\n return context ? context.locale : getReadonlyConditionStore().getLocale();\n}\n\n/**\n * Returns the current region, or undefined if no region is set.\n */\nexport function useRegion(): string | undefined {\n const context = useGTContext();\n return context ? context.region : getReadonlyConditionStore().getRegion();\n}\n\n/**\n * Returns the current enableI18n flag.\n */\nexport function useEnableI18n(): boolean {\n const context = useGTContext();\n return context\n ? context.enableI18n\n : getReadonlyConditionStore().getEnableI18n();\n}\n\nexport function useSetLocale(): (locale: string) => void {\n const context = useGTContext();\n return context ? context.setLocale : getReadonlyConditionStore().setLocale;\n}\n\nexport function useSetRegion(): (region: string | undefined) => void {\n const context = useGTContext();\n return context ? context.setRegion : getReadonlyConditionStore().setRegion;\n}\n\nexport function useSetEnableI18n(): (enabled: boolean) => void {\n const context = useGTContext();\n return context\n ? context.setEnableI18n\n : getReadonlyConditionStore().setEnableI18n;\n}\n"],"mappings":"sIAMA,SAAgB,GAAoB,CAClC,IAAM,EAAU,GAAc,CAC9B,OAAO,EAAU,EAAQ,OAASA,GAA2B,CAAC,WAAW,CAM3E,SAAgB,GAAgC,CAC9C,IAAM,EAAU,GAAc,CAC9B,OAAO,EAAU,EAAQ,OAASA,GAA2B,CAAC,WAAW,CAM3E,SAAgB,GAAyB,CACvC,IAAM,EAAU,GAAc,CAC9B,OAAO,EACH,EAAQ,WACRA,GAA2B,CAAC,eAAe,CAGjD,SAAgB,GAAyC,CACvD,IAAM,EAAU,GAAc,CAC9B,OAAO,EAAU,EAAQ,UAAYA,GAA2B,CAAC,UAGnE,SAAgB,GAAqD,CACnE,IAAM,EAAU,GAAc,CAC9B,OAAO,EAAU,EAAQ,UAAYA,GAA2B,CAAC,UAGnE,SAAgB,GAA+C,CAC7D,IAAM,EAAU,GAAc,CAC9B,OAAO,EACH,EAAQ,cACRA,GAA2B,CAAC"}
|
package/dist/hooks/utils.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./utils/getFormatLocales.cjs`),t=require(`./condition-store.cjs`);let n=require(`gt-i18n/internal`),r=require(`react`);const i=[];function a(n=i){let a=t.useLocale(),o=t.useEnableI18n();return(0,r.useMemo)(()=>e.getFormatLocales({locale:a,enableI18n:o,localesProp:n}),[a,o,n])}function o(){let e=t.useEnableI18n(),r=t.useLocale();return e&&(0,n.getI18nConfig)().requiresTranslation(r)}function s(){let e=t.
|
|
1
|
+
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./utils/getFormatLocales.cjs`),t=require(`./condition-store.cjs`);let n=require(`gt-i18n/internal`),r=require(`react`);const i=[];function a(n=i){let a=t.useLocale(),o=t.useEnableI18n();return(0,r.useMemo)(()=>e.getFormatLocales({locale:a,enableI18n:o,localesProp:n}),[a,o,n])}function o(){let e=t.useEnableI18n(),r=t.useLocale();return e&&(0,n.getI18nConfig)().requiresTranslation(r)}function s(){let e=t.useLocale();return{locale:e,shouldTranslate:t.useEnableI18n()&&(0,n.getI18nConfig)().requiresTranslation(e)}}function c(e){return(0,r.useMemo)(()=>(0,n.getI18nConfig)().getGTClass().getLocaleProperties(e),[e])}function l(e){let i=t.useLocale(),a=e??i;return(0,r.useMemo)(()=>(0,n.getI18nConfig)().getGTClass().getLocaleDirection(a),[a])}exports.useFormatLocales=a,exports.useLocaleDirection=l,exports.useLocaleProperties=c,exports.useShouldTranslate=o,exports.useTranslationConditions=s;
|
|
2
2
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/hooks/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":["useLocale","useEnableI18n","getFormatLocales"
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":["useLocale","useEnableI18n","getFormatLocales"],"sources":["../../src/hooks/utils.ts"],"sourcesContent":["import type { LocaleProperties } from '@generaltranslation/format/types';\nimport { useMemo } from 'react';\nimport { useEnableI18n, useLocale } from './condition-store';\nimport { getFormatLocales } from './utils/getFormatLocales';\nimport { getI18nConfig } from 'gt-i18n/internal';\n\nconst EMPTY_LOCALES_PROP: string[] = [];\n\nexport { getFormatLocales };\n\nexport function useFormatLocales(\n localesProp: string[] = EMPTY_LOCALES_PROP\n): string[] {\n const locale = useLocale();\n const enableI18n = useEnableI18n();\n return useMemo(\n () =>\n getFormatLocales({\n locale,\n enableI18n,\n localesProp,\n }),\n [locale, enableI18n, localesProp]\n );\n}\n\nexport function useShouldTranslate(): boolean {\n const enableI18n = useEnableI18n();\n const locale = useLocale();\n return enableI18n && getI18nConfig().requiresTranslation(locale);\n}\n\n/**\n * Resolves the condition values shared by translation hooks once per render.\n */\nexport function useTranslationConditions(): {\n locale: string;\n shouldTranslate: boolean;\n} {\n const locale = useLocale();\n const enableI18n = useEnableI18n();\n return {\n locale,\n shouldTranslate: enableI18n && getI18nConfig().requiresTranslation(locale),\n };\n}\n\nexport function useLocaleProperties(locale: string): LocaleProperties {\n return useMemo(\n () => getI18nConfig().getGTClass().getLocaleProperties(locale),\n [locale]\n );\n}\n\nexport function useLocaleDirection(locale?: string): 'ltr' | 'rtl' {\n const currentLocale = useLocale();\n const resolvedLocale = locale ?? currentLocale;\n return useMemo(\n () => getI18nConfig().getGTClass().getLocaleDirection(resolvedLocale),\n [resolvedLocale]\n );\n}\n"],"mappings":"qLAMA,MAAM,EAA+B,EAAE,CAIvC,SAAgB,EACd,EAAwB,EACd,CACV,IAAM,EAASA,EAAAA,WAAW,CACpB,EAAaC,EAAAA,eAAe,CAClC,OAAA,EAAA,EAAA,aAEIC,EAAAA,iBAAiB,CACf,SACA,aACA,cACD,CAAC,CACJ,CAAC,EAAQ,EAAY,EAAY,CAClC,CAGH,SAAgB,GAA8B,CAC5C,IAAM,EAAaD,EAAAA,eAAe,CAC5B,EAASD,EAAAA,WAAW,CAC1B,OAAO,IAAA,EAAA,EAAA,gBAA6B,CAAC,oBAAoB,EAAO,CAMlE,SAAgB,GAGd,CACA,IAAM,EAASA,EAAAA,WAAW,CAE1B,MAAO,CACL,SACA,gBAHiBC,EAAAA,eAGU,GAAA,EAAA,EAAA,gBAAmB,CAAC,oBAAoB,EAAO,CAC3E,CAGH,SAAgB,EAAoB,EAAkC,CACpE,OAAA,EAAA,EAAA,cAAA,EAAA,EAAA,gBACuB,CAAC,YAAY,CAAC,oBAAoB,EAAO,CAC9D,CAAC,EAAO,CACT,CAGH,SAAgB,EAAmB,EAAgC,CACjE,IAAM,EAAgBD,EAAAA,WAAW,CAC3B,EAAiB,GAAU,EACjC,OAAA,EAAA,EAAA,cAAA,EAAA,EAAA,gBACuB,CAAC,YAAY,CAAC,mBAAmB,EAAe,CACrE,CAAC,EAAe,CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/hooks/utils.ts"],"mappings":";;;;iBAUgB,gBAAA,CACd,WAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/hooks/utils.ts"],"mappings":";;;;iBAUgB,gBAAA,CACd,WAAA;AAAA,iBAoCc,mBAAA,CAAoB,MAAA,WAAiB,gBAAA;AAAA,iBAOrC,kBAAA,CAAmB,MAAA"}
|
package/dist/hooks/utils.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getFormatLocales as e}from"./utils/getFormatLocales.mjs";import{
|
|
1
|
+
import{getFormatLocales as e}from"./utils/getFormatLocales.mjs";import{useEnableI18n as t,useLocale as n}from"./condition-store.mjs";import{getI18nConfig as r}from"gt-i18n/internal";import{useMemo as i}from"react";const a=[];function o(r=a){let o=n(),s=t();return i(()=>e({locale:o,enableI18n:s,localesProp:r}),[o,s,r])}function s(){let e=t(),i=n();return e&&r().requiresTranslation(i)}function c(){let e=n();return{locale:e,shouldTranslate:t()&&r().requiresTranslation(e)}}function l(e){return i(()=>r().getGTClass().getLocaleProperties(e),[e])}function u(e){let t=n(),a=e??t;return i(()=>r().getGTClass().getLocaleDirection(a),[a])}export{o as useFormatLocales,u as useLocaleDirection,l as useLocaleProperties,s as useShouldTranslate,c as useTranslationConditions};
|
|
2
2
|
//# sourceMappingURL=utils.mjs.map
|
package/dist/hooks/utils.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","names":[],"sources":["../../src/hooks/utils.ts"],"sourcesContent":["import type { LocaleProperties } from '@generaltranslation/format/types';\nimport { useMemo } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../../src/hooks/utils.ts"],"sourcesContent":["import type { LocaleProperties } from '@generaltranslation/format/types';\nimport { useMemo } from 'react';\nimport { useEnableI18n, useLocale } from './condition-store';\nimport { getFormatLocales } from './utils/getFormatLocales';\nimport { getI18nConfig } from 'gt-i18n/internal';\n\nconst EMPTY_LOCALES_PROP: string[] = [];\n\nexport { getFormatLocales };\n\nexport function useFormatLocales(\n localesProp: string[] = EMPTY_LOCALES_PROP\n): string[] {\n const locale = useLocale();\n const enableI18n = useEnableI18n();\n return useMemo(\n () =>\n getFormatLocales({\n locale,\n enableI18n,\n localesProp,\n }),\n [locale, enableI18n, localesProp]\n );\n}\n\nexport function useShouldTranslate(): boolean {\n const enableI18n = useEnableI18n();\n const locale = useLocale();\n return enableI18n && getI18nConfig().requiresTranslation(locale);\n}\n\n/**\n * Resolves the condition values shared by translation hooks once per render.\n */\nexport function useTranslationConditions(): {\n locale: string;\n shouldTranslate: boolean;\n} {\n const locale = useLocale();\n const enableI18n = useEnableI18n();\n return {\n locale,\n shouldTranslate: enableI18n && getI18nConfig().requiresTranslation(locale),\n };\n}\n\nexport function useLocaleProperties(locale: string): LocaleProperties {\n return useMemo(\n () => getI18nConfig().getGTClass().getLocaleProperties(locale),\n [locale]\n );\n}\n\nexport function useLocaleDirection(locale?: string): 'ltr' | 'rtl' {\n const currentLocale = useLocale();\n const resolvedLocale = locale ?? currentLocale;\n return useMemo(\n () => getI18nConfig().getGTClass().getLocaleDirection(resolvedLocale),\n [resolvedLocale]\n );\n}\n"],"mappings":"sNAMA,MAAM,EAA+B,EAAE,CAIvC,SAAgB,EACd,EAAwB,EACd,CACV,IAAM,EAAS,GAAW,CACpB,EAAa,GAAe,CAClC,OAAO,MAEH,EAAiB,CACf,SACA,aACA,cACD,CAAC,CACJ,CAAC,EAAQ,EAAY,EAAY,CAClC,CAGH,SAAgB,GAA8B,CAC5C,IAAM,EAAa,GAAe,CAC5B,EAAS,GAAW,CAC1B,OAAO,GAAc,GAAe,CAAC,oBAAoB,EAAO,CAMlE,SAAgB,GAGd,CACA,IAAM,EAAS,GAAW,CAE1B,MAAO,CACL,SACA,gBAHiB,GAGU,EAAI,GAAe,CAAC,oBAAoB,EAAO,CAC3E,CAGH,SAAgB,EAAoB,EAAkC,CACpE,OAAO,MACC,GAAe,CAAC,YAAY,CAAC,oBAAoB,EAAO,CAC9D,CAAC,EAAO,CACT,CAGH,SAAgB,EAAmB,EAAgC,CACjE,IAAM,EAAgB,GAAW,CAC3B,EAAiB,GAAU,EACjC,OAAO,MACC,GAAe,CAAC,YAAY,CAAC,mBAAmB,EAAe,CACrE,CAAC,EAAe,CACjB"}
|
package/dist/hooks.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./hooks/condition-store.cjs`),t=require(`./hooks/i18n-config.cjs`),n=require(`./hooks/utils.cjs`),r=require(`./hooks/useGT.cjs`),i=require(`./hooks/useMessages.cjs`),a=require(`./hooks/useTranslations.cjs`),o=require(`./hooks/useInternalLocaleSelector.cjs`),s=require(`./hooks/useInternalRegionSelector.cjs`);exports.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./hooks/condition-store.cjs`),t=require(`./hooks/i18n-config.cjs`),n=require(`./hooks/utils.cjs`),r=require(`./hooks/useGT.cjs`),i=require(`./hooks/useMessages.cjs`),a=require(`./hooks/useTranslations.cjs`),o=require(`./hooks/useInternalLocaleSelector.cjs`),s=require(`./hooks/useInternalRegionSelector.cjs`);exports.useCustomMapping=t.useCustomMapping,exports.useDefaultLocale=t.useDefaultLocale,exports.useEnableI18n=e.useEnableI18n,exports.useFormatLocales=n.useFormatLocales,exports.useGT=r.useGT,exports.useInternalLocaleSelector=o.useInternalLocaleSelector,exports.useInternalRegionSelector=s.useInternalRegionSelector,exports.useLocale=e.useLocale,exports.useLocaleDirection=n.useLocaleDirection,exports.useLocaleProperties=n.useLocaleProperties,exports.useLocales=t.useLocales,exports.useMessages=i.useMessages,exports.useRegion=e.useRegion,exports.useSetEnableI18n=e.useSetEnableI18n,exports.useSetLocale=e.useSetLocale,exports.useSetRegion=e.useSetRegion,exports.useTranslations=a.useTranslations;
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { InternalRegionSelectorOptions, InternalRegionSelectorResult, RegionData, useInternalRegionSelector } from "./hooks/useInternalRegionSelector.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useEnableI18n, useLocale, useRegion, useSetEnableI18n, useSetLocale, useSetRegion } from "./hooks/condition-store.js";
|
|
3
3
|
import { useCustomMapping, useDefaultLocale, useLocales } from "./hooks/i18n-config.js";
|
|
4
4
|
import { useGT } from "./hooks/useGT.js";
|
|
5
5
|
import { useMessages } from "./hooks/useMessages.js";
|
|
6
6
|
import { useTranslations } from "./hooks/useTranslations.js";
|
|
7
7
|
import { useFormatLocales, useLocaleDirection, useLocaleProperties } from "./hooks/utils.js";
|
|
8
8
|
import { InternalLocaleSelectorResult, useInternalLocaleSelector } from "./hooks/useInternalLocaleSelector.js";
|
|
9
|
-
export { type InternalLocaleSelectorResult, type InternalRegionSelectorOptions, type InternalRegionSelectorResult, type RegionData,
|
|
9
|
+
export { type InternalLocaleSelectorResult, type InternalRegionSelectorOptions, type InternalRegionSelectorResult, type RegionData, useCustomMapping, useDefaultLocale, useEnableI18n, useFormatLocales, useGT, useInternalLocaleSelector, useInternalRegionSelector, useLocale, useLocaleDirection, useLocaleProperties, useLocales, useMessages, useRegion, useSetEnableI18n, useSetLocale, useSetRegion, useTranslations };
|
package/dist/hooks.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{useEnableI18n as e,useLocale as t,useRegion as n,useSetEnableI18n as r,useSetLocale as i,useSetRegion as a}from"./hooks/condition-store.mjs";import{useCustomMapping as o,useDefaultLocale as s,useLocales as c}from"./hooks/i18n-config.mjs";import{useFormatLocales as l,useLocaleDirection as u,useLocaleProperties as d}from"./hooks/utils.mjs";import{useGT as f}from"./hooks/useGT.mjs";import{useMessages as p}from"./hooks/useMessages.mjs";import{useTranslations as m}from"./hooks/useTranslations.mjs";import{useInternalLocaleSelector as h}from"./hooks/useInternalLocaleSelector.mjs";import{useInternalRegionSelector as g}from"./hooks/useInternalRegionSelector.mjs";export{o as useCustomMapping,s as useDefaultLocale,e as useEnableI18n,l as useFormatLocales,f as useGT,h as useInternalLocaleSelector,g as useInternalRegionSelector,t as useLocale,u as useLocaleDirection,d as useLocaleProperties,c as useLocales,p as useMessages,n as useRegion,r as useSetEnableI18n,i as useSetLocale,a as useSetRegion,m as useTranslations};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@generaltranslation/react-core",
|
|
3
|
-
"version": "11.4.
|
|
3
|
+
"version": "11.4.5",
|
|
4
4
|
"description": "A pure React library for internationalization",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@generaltranslation/format": "0.1.9",
|
|
15
|
-
"generaltranslation": "9.5.
|
|
16
|
-
"gt-i18n": "1.0.
|
|
15
|
+
"generaltranslation": "9.5.1",
|
|
16
|
+
"gt-i18n": "1.0.32"
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|