react-intlayer 5.6.0 → 5.7.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/cjs/client/index.cjs +3 -0
- package/dist/cjs/client/index.cjs.map +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +49 -0
- package/dist/cjs/client/useDictionaryAsync.cjs.map +1 -0
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/server/index.cjs +3 -0
- package/dist/cjs/server/index.cjs.map +1 -1
- package/dist/cjs/server/useDictionaryAsync.cjs +47 -0
- package/dist/cjs/server/useDictionaryAsync.cjs.map +1 -0
- package/dist/esm/client/index.mjs +2 -0
- package/dist/esm/client/index.mjs.map +1 -1
- package/dist/esm/client/useDictionaryAsync.mjs +15 -0
- package/dist/esm/client/useDictionaryAsync.mjs.map +1 -0
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/server/index.mjs +2 -0
- package/dist/esm/server/index.mjs.map +1 -1
- package/dist/esm/server/useDictionaryAsync.mjs +13 -0
- package/dist/esm/server/useDictionaryAsync.mjs.map +1 -0
- package/dist/types/client/index.d.ts +1 -0
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/client/useDictionaryAsync.d.ts +9 -0
- package/dist/types/client/useDictionaryAsync.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/server/index.d.ts +1 -0
- package/dist/types/server/index.d.ts.map +1 -1
- package/dist/types/server/useDictionaryAsync.d.ts +9 -0
- package/dist/types/server/useDictionaryAsync.d.ts.map +1 -0
- package/package.json +13 -13
|
@@ -26,6 +26,7 @@ __export(client_exports, {
|
|
|
26
26
|
setLocaleCookie: () => import_useLocaleCookie.setLocaleCookie,
|
|
27
27
|
t: () => import_t.t,
|
|
28
28
|
useDictionary: () => import_useDictionary.useDictionary,
|
|
29
|
+
useDictionaryAsync: () => import_useDictionaryAsync.useDictionaryAsync,
|
|
29
30
|
useDictionaryDynamic: () => import_useDictionaryDynamic.useDictionaryDynamic,
|
|
30
31
|
useIntlayer: () => import_useIntlayer.useIntlayer,
|
|
31
32
|
useIntlayerAsync: () => import_useIntlayerAsync.useIntlayerAsync,
|
|
@@ -40,6 +41,7 @@ var import_getBrowserLocale = require('./getBrowserLocale.cjs');
|
|
|
40
41
|
var import_IntlayerProvider = require('./IntlayerProvider.cjs');
|
|
41
42
|
var import_t = require('./t.cjs');
|
|
42
43
|
var import_useDictionary = require('./useDictionary.cjs');
|
|
44
|
+
var import_useDictionaryAsync = require('./useDictionaryAsync.cjs');
|
|
43
45
|
var import_useDictionaryDynamic = require('./useDictionaryDynamic.cjs');
|
|
44
46
|
var import_useIntlayer = require('./useIntlayer.cjs');
|
|
45
47
|
var import_useIntlayerAsync = require('./useIntlayerAsync.cjs');
|
|
@@ -57,6 +59,7 @@ var import_useLocaleCookie = require('./useLocaleCookie.cjs');
|
|
|
57
59
|
setLocaleCookie,
|
|
58
60
|
t,
|
|
59
61
|
useDictionary,
|
|
62
|
+
useDictionaryAsync,
|
|
60
63
|
useDictionaryDynamic,
|
|
61
64
|
useIntlayer,
|
|
62
65
|
useIntlayerAsync,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export { getBrowserLocale } from './getBrowserLocale';\nexport {\n IntlayerClientContext,\n IntlayerProvider,\n IntlayerProviderContent,\n useIntlayerContext,\n type IntlayerProviderProps,\n} from './IntlayerProvider';\nexport { t } from './t';\nexport { useDictionary } from './useDictionary';\nexport { useDictionaryDynamic } from './useDictionaryDynamic';\nexport { useIntlayer } from './useIntlayer';\nexport { useIntlayerAsync } from './useIntlayerAsync';\nexport { useLoadDynamic } from './useLoadDynamic';\nexport { useLocale } from './useLocale';\nexport { useLocaleBase } from './useLocaleBase';\nexport {\n localeCookie,\n setLocaleCookie,\n useLocaleCookie,\n} from './useLocaleCookie';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAiC;AACjC,8BAMO;AACP,eAAkB;AAClB,2BAA8B;AAC9B,kCAAqC;AACrC,yBAA4B;AAC5B,8BAAiC;AACjC,4BAA+B;AAC/B,uBAA0B;AAC1B,2BAA8B;AAC9B,6BAIO;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export { getBrowserLocale } from './getBrowserLocale';\nexport {\n IntlayerClientContext,\n IntlayerProvider,\n IntlayerProviderContent,\n useIntlayerContext,\n type IntlayerProviderProps,\n} from './IntlayerProvider';\nexport { t } from './t';\nexport { useDictionary } from './useDictionary';\nexport { useDictionaryAsync } from './useDictionaryAsync';\nexport { useDictionaryDynamic } from './useDictionaryDynamic';\nexport { useIntlayer } from './useIntlayer';\nexport { useIntlayerAsync } from './useIntlayerAsync';\nexport { useLoadDynamic } from './useLoadDynamic';\nexport { useLocale } from './useLocale';\nexport { useLocaleBase } from './useLocaleBase';\nexport {\n localeCookie,\n setLocaleCookie,\n useLocaleCookie,\n} from './useLocaleCookie';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAiC;AACjC,8BAMO;AACP,eAAkB;AAClB,2BAA8B;AAC9B,gCAAmC;AACnC,kCAAqC;AACrC,yBAA4B;AAC5B,8BAAiC;AACjC,4BAA+B;AAC/B,uBAA0B;AAC1B,2BAA8B;AAC9B,6BAIO;","names":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var useDictionaryAsync_exports = {};
|
|
31
|
+
__export(useDictionaryAsync_exports, {
|
|
32
|
+
useDictionaryAsync: () => useDictionaryAsync
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(useDictionaryAsync_exports);
|
|
35
|
+
var import_built = __toESM(require("@intlayer/config/built"));
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_IntlayerProvider = require('./IntlayerProvider.cjs');
|
|
38
|
+
var import_useDictionary = require('./useDictionary.cjs');
|
|
39
|
+
const useDictionaryAsync = async (dictionaryPromise, locale) => {
|
|
40
|
+
const { locale: currentLocale } = (0, import_react.useContext)(import_IntlayerProvider.IntlayerClientContext);
|
|
41
|
+
const localeTarget = locale ?? currentLocale ?? import_built.default?.internationalization.defaultLocale;
|
|
42
|
+
const dictionary = await dictionaryPromise[localeTarget]();
|
|
43
|
+
return (0, import_useDictionary.useDictionary)(dictionary, localeTarget);
|
|
44
|
+
};
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
useDictionaryAsync
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=useDictionaryAsync.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/client/useDictionaryAsync.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport type { Dictionary, LanguageContent } from '@intlayer/core';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { useDictionary } from './useDictionary';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryAsync = async <T extends Dictionary>(\n dictionaryPromise: LanguageContent<() => Promise<T>>,\n locale?: LocalesValues\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget =\n locale ??\n currentLocale ??\n configuration?.internationalization.defaultLocale;\n\n const dictionary = await dictionaryPromise[localeTarget]!();\n\n return useDictionary(dictionary, localeTarget) as T;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA0B;AAG1B,mBAA2B;AAC3B,8BAAsC;AACtC,2BAA8B;AAOvB,MAAM,qBAAqB,OAChC,mBACA,WACG;AACH,QAAM,EAAE,QAAQ,cAAc,QAAI,yBAAW,6CAAqB;AAClE,QAAM,eACJ,UACA,iBACA,aAAAA,SAAe,qBAAqB;AAEtC,QAAM,aAAa,MAAM,kBAAkB,YAAY,EAAG;AAE1D,aAAO,oCAAc,YAAY,YAAY;AAC/C;","names":["configuration"]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -27,6 +27,7 @@ __export(index_exports, {
|
|
|
27
27
|
setLocaleCookie: () => import_client.setLocaleCookie,
|
|
28
28
|
t: () => import_client.t,
|
|
29
29
|
useDictionary: () => import_client.useDictionary,
|
|
30
|
+
useDictionaryAsync: () => import_client.useDictionaryAsync,
|
|
30
31
|
useDictionaryDynamic: () => import_client.useDictionaryDynamic,
|
|
31
32
|
useIntlayer: () => import_client.useIntlayer,
|
|
32
33
|
useIntlayerAsync: () => import_client.useIntlayerAsync,
|
|
@@ -50,6 +51,7 @@ var import_markdown = require('./markdown/index.cjs');
|
|
|
50
51
|
setLocaleCookie,
|
|
51
52
|
t,
|
|
52
53
|
useDictionary,
|
|
54
|
+
useDictionaryAsync,
|
|
53
55
|
useDictionaryDynamic,
|
|
54
56
|
useIntlayer,
|
|
55
57
|
useIntlayerAsync,
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import type { IInterpreterPluginReact } from './plugins';\n\ndeclare module '@intlayer/core' {\n interface IInterpreterPlugin<T, S> extends IInterpreterPluginReact<T> {}\n}\n\nexport {\n getBrowserLocale,\n IntlayerClientContext,\n IntlayerProvider,\n IntlayerProviderContent,\n localeCookie,\n setLocaleCookie,\n t,\n useDictionary,\n useDictionaryDynamic,\n useIntlayer,\n useIntlayerAsync,\n useIntlayerContext,\n useLoadDynamic,\n useLocale,\n useLocaleBase,\n useLocaleCookie,\n type IntlayerProviderProps,\n} from './client/index';\nexport { type IntlayerNode } from './IntlayerNode';\nexport { MarkdownProvider } from './markdown/index';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import type { IInterpreterPluginReact } from './plugins';\n\ndeclare module '@intlayer/core' {\n interface IInterpreterPlugin<T, S> extends IInterpreterPluginReact<T> {}\n}\n\nexport {\n getBrowserLocale,\n IntlayerClientContext,\n IntlayerProvider,\n IntlayerProviderContent,\n localeCookie,\n setLocaleCookie,\n t,\n useDictionary,\n useDictionaryAsync,\n useDictionaryDynamic,\n useIntlayer,\n useIntlayerAsync,\n useIntlayerContext,\n useLoadDynamic,\n useLocale,\n useLocaleBase,\n useLocaleCookie,\n type IntlayerProviderProps,\n} from './client/index';\nexport { type IntlayerNode } from './IntlayerNode';\nexport { MarkdownProvider } from './markdown/index';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,oBAmBO;AAEP,sBAAiC;","names":[]}
|
|
@@ -23,6 +23,7 @@ __export(server_exports, {
|
|
|
23
23
|
locale: () => import_IntlayerServerProvider.locale,
|
|
24
24
|
t: () => import_t.t,
|
|
25
25
|
useDictionary: () => import_useDictionary.useDictionary,
|
|
26
|
+
useDictionaryAsync: () => import_useDictionaryAsync.useDictionaryAsync,
|
|
26
27
|
useDictionaryDynamic: () => import_useDictionaryDynamic.useDictionaryDynamic,
|
|
27
28
|
useIntlayer: () => import_useIntlayer.useIntlayer,
|
|
28
29
|
useLoadDynamic: () => import_useLoadDynamic.useLoadDynamic,
|
|
@@ -32,6 +33,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
32
33
|
var import_IntlayerServerProvider = require('./IntlayerServerProvider.cjs');
|
|
33
34
|
var import_t = require('./t.cjs');
|
|
34
35
|
var import_useDictionary = require('./useDictionary.cjs');
|
|
36
|
+
var import_useDictionaryAsync = require('./useDictionaryAsync.cjs');
|
|
35
37
|
var import_useDictionaryDynamic = require('./useDictionaryDynamic.cjs');
|
|
36
38
|
var import_useIntlayer = require('./useIntlayer.cjs');
|
|
37
39
|
var import_useLoadDynamic = require('./useLoadDynamic.cjs');
|
|
@@ -43,6 +45,7 @@ var import_useLocale = require('./useLocale.cjs');
|
|
|
43
45
|
locale,
|
|
44
46
|
t,
|
|
45
47
|
useDictionary,
|
|
48
|
+
useDictionaryAsync,
|
|
46
49
|
useDictionaryDynamic,
|
|
47
50
|
useIntlayer,
|
|
48
51
|
useLoadDynamic,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["export {\n IntlayerServerContext as IntlayerServer,\n IntlayerServerProvider,\n locale,\n} from './IntlayerServerProvider';\nexport { t } from './t';\nexport { useDictionary } from './useDictionary';\nexport { useDictionaryDynamic } from './useDictionaryDynamic';\nexport { useIntlayer } from './useIntlayer';\nexport { useLoadDynamic } from './useLoadDynamic';\nexport { useLocale } from './useLocale';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAIO;AACP,eAAkB;AAClB,2BAA8B;AAC9B,kCAAqC;AACrC,yBAA4B;AAC5B,4BAA+B;AAC/B,uBAA0B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["export {\n IntlayerServerContext as IntlayerServer,\n IntlayerServerProvider,\n locale,\n} from './IntlayerServerProvider';\nexport { t } from './t';\nexport { useDictionary } from './useDictionary';\nexport { useDictionaryAsync } from './useDictionaryAsync';\nexport { useDictionaryDynamic } from './useDictionaryDynamic';\nexport { useIntlayer } from './useIntlayer';\nexport { useLoadDynamic } from './useLoadDynamic';\nexport { useLocale } from './useLocale';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAIO;AACP,eAAkB;AAClB,2BAA8B;AAC9B,gCAAmC;AACnC,kCAAqC;AACrC,yBAA4B;AAC5B,4BAA+B;AAC/B,uBAA0B;","names":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useDictionaryAsync_exports = {};
|
|
30
|
+
__export(useDictionaryAsync_exports, {
|
|
31
|
+
useDictionaryAsync: () => useDictionaryAsync
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(useDictionaryAsync_exports);
|
|
34
|
+
var import_built = __toESM(require("@intlayer/config/built"));
|
|
35
|
+
var import_IntlayerServerProvider = require('./IntlayerServerProvider.cjs');
|
|
36
|
+
var import_serverContext = require('./serverContext.cjs');
|
|
37
|
+
var import_useDictionary = require('./useDictionary.cjs');
|
|
38
|
+
const useDictionaryAsync = async (dictionaryPromise, locale) => {
|
|
39
|
+
const localeTarget = locale ?? (0, import_serverContext.getServerContext)(import_IntlayerServerProvider.IntlayerServerContext) ?? import_built.default?.internationalization.defaultLocale;
|
|
40
|
+
const dictionary = await dictionaryPromise[localeTarget]();
|
|
41
|
+
return (0, import_useDictionary.useDictionary)(dictionary, localeTarget);
|
|
42
|
+
};
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
useDictionaryAsync
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=useDictionaryAsync.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/server/useDictionaryAsync.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport { LanguageContent, type Dictionary } from '@intlayer/core';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\nimport { useDictionary } from './useDictionary';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the server context\n */\nexport const useDictionaryAsync = async <T extends Dictionary>(\n dictionaryPromise: LanguageContent<() => Promise<T>>,\n locale?: LocalesValues\n) => {\n const localeTarget =\n locale ??\n getServerContext<LocalesValues>(IntlayerServerContext) ??\n configuration?.internationalization.defaultLocale;\n\n const dictionary = await dictionaryPromise[localeTarget]!();\n\n return useDictionary(dictionary, localeTarget) as any;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAG1B,oCAAsC;AACtC,2BAAiC;AACjC,2BAA8B;AAOvB,MAAM,qBAAqB,OAChC,mBACA,WACG;AACH,QAAM,eACJ,cACA,uCAAgC,mDAAqB,KACrD,aAAAA,SAAe,qBAAqB;AAEtC,QAAM,aAAa,MAAM,kBAAkB,YAAY,EAAG;AAE1D,aAAO,oCAAc,YAAY,YAAY;AAC/C;","names":["configuration"]}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from "./IntlayerProvider.mjs";
|
|
8
8
|
import { t } from "./t.mjs";
|
|
9
9
|
import { useDictionary } from "./useDictionary.mjs";
|
|
10
|
+
import { useDictionaryAsync } from "./useDictionaryAsync.mjs";
|
|
10
11
|
import { useDictionaryDynamic } from "./useDictionaryDynamic.mjs";
|
|
11
12
|
import { useIntlayer } from "./useIntlayer.mjs";
|
|
12
13
|
import { useIntlayerAsync } from "./useIntlayerAsync.mjs";
|
|
@@ -27,6 +28,7 @@ export {
|
|
|
27
28
|
setLocaleCookie,
|
|
28
29
|
t,
|
|
29
30
|
useDictionary,
|
|
31
|
+
useDictionaryAsync,
|
|
30
32
|
useDictionaryDynamic,
|
|
31
33
|
useIntlayer,
|
|
32
34
|
useIntlayerAsync,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export { getBrowserLocale } from './getBrowserLocale';\nexport {\n IntlayerClientContext,\n IntlayerProvider,\n IntlayerProviderContent,\n useIntlayerContext,\n type IntlayerProviderProps,\n} from './IntlayerProvider';\nexport { t } from './t';\nexport { useDictionary } from './useDictionary';\nexport { useDictionaryDynamic } from './useDictionaryDynamic';\nexport { useIntlayer } from './useIntlayer';\nexport { useIntlayerAsync } from './useIntlayerAsync';\nexport { useLoadDynamic } from './useLoadDynamic';\nexport { useLocale } from './useLocale';\nexport { useLocaleBase } from './useLocaleBase';\nexport {\n localeCookie,\n setLocaleCookie,\n useLocaleCookie,\n} from './useLocaleCookie';\n"],"mappings":"AAAA,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,SAAS;AAClB,SAAS,qBAAqB;AAC9B,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export { getBrowserLocale } from './getBrowserLocale';\nexport {\n IntlayerClientContext,\n IntlayerProvider,\n IntlayerProviderContent,\n useIntlayerContext,\n type IntlayerProviderProps,\n} from './IntlayerProvider';\nexport { t } from './t';\nexport { useDictionary } from './useDictionary';\nexport { useDictionaryAsync } from './useDictionaryAsync';\nexport { useDictionaryDynamic } from './useDictionaryDynamic';\nexport { useIntlayer } from './useIntlayer';\nexport { useIntlayerAsync } from './useIntlayerAsync';\nexport { useLoadDynamic } from './useLoadDynamic';\nexport { useLocale } from './useLocale';\nexport { useLocaleBase } from './useLocaleBase';\nexport {\n localeCookie,\n setLocaleCookie,\n useLocaleCookie,\n} from './useLocaleCookie';\n"],"mappings":"AAAA,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,SAAS;AAClB,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import configuration from "@intlayer/config/built";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import { IntlayerClientContext } from "./IntlayerProvider.mjs";
|
|
5
|
+
import { useDictionary } from "./useDictionary.mjs";
|
|
6
|
+
const useDictionaryAsync = async (dictionaryPromise, locale) => {
|
|
7
|
+
const { locale: currentLocale } = useContext(IntlayerClientContext);
|
|
8
|
+
const localeTarget = locale ?? currentLocale ?? configuration?.internationalization.defaultLocale;
|
|
9
|
+
const dictionary = await dictionaryPromise[localeTarget]();
|
|
10
|
+
return useDictionary(dictionary, localeTarget);
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
useDictionaryAsync
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=useDictionaryAsync.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/client/useDictionaryAsync.ts"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport type { Dictionary, LanguageContent } from '@intlayer/core';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { useDictionary } from './useDictionary';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryAsync = async <T extends Dictionary>(\n dictionaryPromise: LanguageContent<() => Promise<T>>,\n locale?: LocalesValues\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget =\n locale ??\n currentLocale ??\n configuration?.internationalization.defaultLocale;\n\n const dictionary = await dictionaryPromise[localeTarget]!();\n\n return useDictionary(dictionary, localeTarget) as T;\n};\n"],"mappings":";AAEA,OAAO,mBAAmB;AAG1B,SAAS,kBAAkB;AAC3B,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;AAOvB,MAAM,qBAAqB,OAChC,mBACA,WACG;AACH,QAAM,EAAE,QAAQ,cAAc,IAAI,WAAW,qBAAqB;AAClE,QAAM,eACJ,UACA,iBACA,eAAe,qBAAqB;AAEtC,QAAM,aAAa,MAAM,kBAAkB,YAAY,EAAG;AAE1D,SAAO,cAAc,YAAY,YAAY;AAC/C;","names":[]}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
setLocaleCookie,
|
|
8
8
|
t,
|
|
9
9
|
useDictionary,
|
|
10
|
+
useDictionaryAsync,
|
|
10
11
|
useDictionaryDynamic,
|
|
11
12
|
useIntlayer,
|
|
12
13
|
useIntlayerAsync,
|
|
@@ -27,6 +28,7 @@ export {
|
|
|
27
28
|
setLocaleCookie,
|
|
28
29
|
t,
|
|
29
30
|
useDictionary,
|
|
31
|
+
useDictionaryAsync,
|
|
30
32
|
useDictionaryDynamic,
|
|
31
33
|
useIntlayer,
|
|
32
34
|
useIntlayerAsync,
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import type { IInterpreterPluginReact } from './plugins';\n\ndeclare module '@intlayer/core' {\n interface IInterpreterPlugin<T, S> extends IInterpreterPluginReact<T> {}\n}\n\nexport {\n getBrowserLocale,\n IntlayerClientContext,\n IntlayerProvider,\n IntlayerProviderContent,\n localeCookie,\n setLocaleCookie,\n t,\n useDictionary,\n useDictionaryDynamic,\n useIntlayer,\n useIntlayerAsync,\n useIntlayerContext,\n useLoadDynamic,\n useLocale,\n useLocaleBase,\n useLocaleCookie,\n type IntlayerProviderProps,\n} from './client/index';\nexport { type IntlayerNode } from './IntlayerNode';\nexport { MarkdownProvider } from './markdown/index';\n"],"mappings":"AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,wBAAwB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import type { IInterpreterPluginReact } from './plugins';\n\ndeclare module '@intlayer/core' {\n interface IInterpreterPlugin<T, S> extends IInterpreterPluginReact<T> {}\n}\n\nexport {\n getBrowserLocale,\n IntlayerClientContext,\n IntlayerProvider,\n IntlayerProviderContent,\n localeCookie,\n setLocaleCookie,\n t,\n useDictionary,\n useDictionaryAsync,\n useDictionaryDynamic,\n useIntlayer,\n useIntlayerAsync,\n useIntlayerContext,\n useLoadDynamic,\n useLocale,\n useLocaleBase,\n useLocaleCookie,\n type IntlayerProviderProps,\n} from './client/index';\nexport { type IntlayerNode } from './IntlayerNode';\nexport { MarkdownProvider } from './markdown/index';\n"],"mappings":"AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,wBAAwB;","names":[]}
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
} from "./IntlayerServerProvider.mjs";
|
|
6
6
|
import { t } from "./t.mjs";
|
|
7
7
|
import { useDictionary } from "./useDictionary.mjs";
|
|
8
|
+
import { useDictionaryAsync } from "./useDictionaryAsync.mjs";
|
|
8
9
|
import { useDictionaryDynamic } from "./useDictionaryDynamic.mjs";
|
|
9
10
|
import { useIntlayer } from "./useIntlayer.mjs";
|
|
10
11
|
import { useLoadDynamic } from "./useLoadDynamic.mjs";
|
|
@@ -15,6 +16,7 @@ export {
|
|
|
15
16
|
locale,
|
|
16
17
|
t,
|
|
17
18
|
useDictionary,
|
|
19
|
+
useDictionaryAsync,
|
|
18
20
|
useDictionaryDynamic,
|
|
19
21
|
useIntlayer,
|
|
20
22
|
useLoadDynamic,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["export {\n IntlayerServerContext as IntlayerServer,\n IntlayerServerProvider,\n locale,\n} from './IntlayerServerProvider';\nexport { t } from './t';\nexport { useDictionary } from './useDictionary';\nexport { useDictionaryDynamic } from './useDictionaryDynamic';\nexport { useIntlayer } from './useIntlayer';\nexport { useLoadDynamic } from './useLoadDynamic';\nexport { useLocale } from './useLocale';\n"],"mappings":"AAAA;AAAA,EAC2B;AAAA,EACzB;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS;AAClB,SAAS,qBAAqB;AAC9B,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["export {\n IntlayerServerContext as IntlayerServer,\n IntlayerServerProvider,\n locale,\n} from './IntlayerServerProvider';\nexport { t } from './t';\nexport { useDictionary } from './useDictionary';\nexport { useDictionaryAsync } from './useDictionaryAsync';\nexport { useDictionaryDynamic } from './useDictionaryDynamic';\nexport { useIntlayer } from './useIntlayer';\nexport { useLoadDynamic } from './useLoadDynamic';\nexport { useLocale } from './useLocale';\n"],"mappings":"AAAA;AAAA,EAC2B;AAAA,EACzB;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS;AAClB,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import configuration from "@intlayer/config/built";
|
|
2
|
+
import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
|
|
3
|
+
import { getServerContext } from "./serverContext.mjs";
|
|
4
|
+
import { useDictionary } from "./useDictionary.mjs";
|
|
5
|
+
const useDictionaryAsync = async (dictionaryPromise, locale) => {
|
|
6
|
+
const localeTarget = locale ?? getServerContext(IntlayerServerContext) ?? configuration?.internationalization.defaultLocale;
|
|
7
|
+
const dictionary = await dictionaryPromise[localeTarget]();
|
|
8
|
+
return useDictionary(dictionary, localeTarget);
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
useDictionaryAsync
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=useDictionaryAsync.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/server/useDictionaryAsync.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport { LanguageContent, type Dictionary } from '@intlayer/core';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\nimport { useDictionary } from './useDictionary';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the server context\n */\nexport const useDictionaryAsync = async <T extends Dictionary>(\n dictionaryPromise: LanguageContent<() => Promise<T>>,\n locale?: LocalesValues\n) => {\n const localeTarget =\n locale ??\n getServerContext<LocalesValues>(IntlayerServerContext) ??\n configuration?.internationalization.defaultLocale;\n\n const dictionary = await dictionaryPromise[localeTarget]!();\n\n return useDictionary(dictionary, localeTarget) as any;\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAG1B,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAOvB,MAAM,qBAAqB,OAChC,mBACA,WACG;AACH,QAAM,eACJ,UACA,iBAAgC,qBAAqB,KACrD,eAAe,qBAAqB;AAEtC,QAAM,aAAa,MAAM,kBAAkB,YAAY,EAAG;AAE1D,SAAO,cAAc,YAAY,YAAY;AAC/C;","names":[]}
|
|
@@ -2,6 +2,7 @@ export { getBrowserLocale } from './getBrowserLocale';
|
|
|
2
2
|
export { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, useIntlayerContext, type IntlayerProviderProps, } from './IntlayerProvider';
|
|
3
3
|
export { t } from './t';
|
|
4
4
|
export { useDictionary } from './useDictionary';
|
|
5
|
+
export { useDictionaryAsync } from './useDictionaryAsync';
|
|
5
6
|
export { useDictionaryDynamic } from './useDictionaryDynamic';
|
|
6
7
|
export { useIntlayer } from './useIntlayer';
|
|
7
8
|
export { useIntlayerAsync } from './useIntlayerAsync';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,qBAAqB,GAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,qBAAqB,GAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LocalesValues } from '@intlayer/config/client';
|
|
2
|
+
import type { Dictionary, LanguageContent } from '@intlayer/core';
|
|
3
|
+
/**
|
|
4
|
+
* On the server side, Hook that transform a dictionary and return the content
|
|
5
|
+
*
|
|
6
|
+
* If the locale is not provided, it will use the locale from the client context
|
|
7
|
+
*/
|
|
8
|
+
export declare const useDictionaryAsync: <T extends Dictionary>(dictionaryPromise: LanguageContent<() => Promise<T>>, locale?: LocalesValues) => Promise<T>;
|
|
9
|
+
//# sourceMappingURL=useDictionaryAsync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDictionaryAsync.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionaryAsync.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKlE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAU,CAAC,SAAS,UAAU,EAC3D,mBAAmB,eAAe,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EACpD,SAAS,aAAa,eAWvB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ declare module '@intlayer/core' {
|
|
|
3
3
|
interface IInterpreterPlugin<T, S> extends IInterpreterPluginReact<T> {
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
|
-
export { getBrowserLocale, IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, localeCookie, setLocaleCookie, t, useDictionary, useDictionaryDynamic, useIntlayer, useIntlayerAsync, useIntlayerContext, useLoadDynamic, useLocale, useLocaleBase, useLocaleCookie, type IntlayerProviderProps, } from './client/index';
|
|
6
|
+
export { getBrowserLocale, IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, localeCookie, setLocaleCookie, t, useDictionary, useDictionaryAsync, useDictionaryDynamic, useIntlayer, useIntlayerAsync, useIntlayerContext, useLoadDynamic, useLocale, useLocaleBase, useLocaleCookie, type IntlayerProviderProps, } from './client/index';
|
|
7
7
|
export { type IntlayerNode } from './IntlayerNode';
|
|
8
8
|
export { MarkdownProvider } from './markdown/index';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,QAAQ,gBAAgB,CAAC;IAC9B,UAAU,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,uBAAuB,CAAC,CAAC,CAAC;KAAG;CACzE;AAED,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,YAAY,EACZ,eAAe,EACf,CAAC,EACD,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,KAAK,qBAAqB,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,QAAQ,gBAAgB,CAAC;IAC9B,UAAU,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,uBAAuB,CAAC,CAAC,CAAC;KAAG;CACzE;AAED,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,YAAY,EACZ,eAAe,EACf,CAAC,EACD,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,KAAK,qBAAqB,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { IntlayerServerContext as IntlayerServer, IntlayerServerProvider, locale, } from './IntlayerServerProvider';
|
|
2
2
|
export { t } from './t';
|
|
3
3
|
export { useDictionary } from './useDictionary';
|
|
4
|
+
export { useDictionaryAsync } from './useDictionaryAsync';
|
|
4
5
|
export { useDictionaryDynamic } from './useDictionaryDynamic';
|
|
5
6
|
export { useIntlayer } from './useIntlayer';
|
|
6
7
|
export { useLoadDynamic } from './useLoadDynamic';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,IAAI,cAAc,EACvC,sBAAsB,EACtB,MAAM,GACP,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,IAAI,cAAc,EACvC,sBAAsB,EACtB,MAAM,GACP,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LocalesValues } from '@intlayer/config/client';
|
|
2
|
+
import { LanguageContent, type Dictionary } from '@intlayer/core';
|
|
3
|
+
/**
|
|
4
|
+
* On the server side, Hook that transform a dictionary and return the content
|
|
5
|
+
*
|
|
6
|
+
* If the locale is not provided, it will use the locale from the server context
|
|
7
|
+
*/
|
|
8
|
+
export declare const useDictionaryAsync: <T extends Dictionary>(dictionaryPromise: LanguageContent<() => Promise<T>>, locale?: LocalesValues) => Promise<any>;
|
|
9
|
+
//# sourceMappingURL=useDictionaryAsync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDictionaryAsync.d.ts","sourceRoot":"","sources":["../../../src/server/useDictionaryAsync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKlE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAU,CAAC,SAAS,UAAU,EAC3D,mBAAmB,eAAe,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EACpD,SAAS,aAAa,iBAUvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intlayer",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your React applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
],
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"js-cookie": "^3.0.5",
|
|
72
|
-
"@intlayer/
|
|
73
|
-
"@intlayer/
|
|
74
|
-
"@intlayer/
|
|
75
|
-
"@intlayer/
|
|
76
|
-
"@intlayer/
|
|
72
|
+
"@intlayer/api": "5.7.0",
|
|
73
|
+
"@intlayer/config": "5.7.0",
|
|
74
|
+
"@intlayer/core": "5.7.0",
|
|
75
|
+
"@intlayer/dictionaries-entry": "5.7.0",
|
|
76
|
+
"@intlayer/editor-react": "5.7.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@craco/types": "^7.1.0",
|
|
@@ -95,17 +95,17 @@
|
|
|
95
95
|
"@utils/ts-config": "1.0.4",
|
|
96
96
|
"@utils/ts-config-types": "1.0.4",
|
|
97
97
|
"@utils/tsup-config": "1.0.4",
|
|
98
|
-
"@intlayer/backend": "5.
|
|
98
|
+
"@intlayer/backend": "5.7.0"
|
|
99
99
|
},
|
|
100
100
|
"peerDependencies": {
|
|
101
101
|
"react": ">=16.0.0",
|
|
102
102
|
"react-dom": ">=16.0.0",
|
|
103
|
-
"@intlayer/
|
|
104
|
-
"@intlayer/config": "5.
|
|
105
|
-
"@intlayer/
|
|
106
|
-
"@intlayer/
|
|
107
|
-
"@intlayer/
|
|
108
|
-
"intlayer": "5.
|
|
103
|
+
"@intlayer/api": "5.7.0",
|
|
104
|
+
"@intlayer/config": "5.7.0",
|
|
105
|
+
"@intlayer/core": "5.7.0",
|
|
106
|
+
"@intlayer/editor-react": "5.7.0",
|
|
107
|
+
"@intlayer/dictionaries-entry": "5.7.0",
|
|
108
|
+
"intlayer": "5.7.0"
|
|
109
109
|
},
|
|
110
110
|
"engines": {
|
|
111
111
|
"node": ">=14.18"
|