react-intlayer 1.0.0 → 1.2.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/ContentEditor/ContentEditor.cjs +36 -39
- package/dist/cjs/ContentEditor/ContentEditor.d.ts +2 -2
- package/dist/cjs/ContentEditor/contentRender.cjs +10 -18
- package/dist/cjs/ContentEditor/index.cjs +11 -27
- package/dist/cjs/ContentEditor/index.d.ts +3 -3
- package/dist/cjs/IntlayerProvider.cjs +37 -0
- package/dist/cjs/IntlayerProvider.cjs.map +1 -0
- package/dist/cjs/IntlayerProvider.d.ts +9 -0
- package/dist/cjs/client/IntlayerClientProvider.cjs +45 -0
- package/dist/cjs/client/IntlayerClientProvider.cjs.map +1 -0
- package/dist/cjs/client/IntlayerClientProvider.d.ts +24 -0
- package/dist/cjs/client/index.cjs +24 -31
- package/dist/cjs/client/index.cjs.map +1 -1
- package/dist/cjs/client/index.d.ts +10 -19
- package/dist/cjs/client/useContent.cjs +11 -16
- package/dist/cjs/client/useContent.cjs.map +1 -1
- package/dist/cjs/client/useContent.d.ts +10 -8
- package/dist/cjs/client/useIntlayer.cjs +11 -18
- package/dist/cjs/client/useIntlayer.cjs.map +1 -1
- package/dist/cjs/client/useIntlayer.d.ts +8 -3
- package/dist/cjs/client/useLocale.cjs +12 -20
- package/dist/cjs/client/useLocale.cjs.map +1 -1
- package/dist/cjs/client/useLocale.d.ts +8 -5
- package/dist/cjs/client/useLocaleCookie.cjs +20 -30
- package/dist/cjs/client/useLocaleCookie.cjs.map +1 -1
- package/dist/cjs/client/useLocaleCookie.d.ts +12 -3
- package/dist/cjs/client/useTraduction.cjs +11 -18
- package/dist/cjs/client/useTraduction.cjs.map +1 -1
- package/dist/cjs/client/useTraduction.d.ts +22 -4
- package/dist/cjs/getEnumeration.cjs +9 -14
- package/dist/cjs/getEnumeration.cjs.map +1 -1
- package/dist/cjs/getEnumeration.d.ts +27 -5
- package/dist/cjs/getTranslation.cjs +9 -14
- package/dist/cjs/getTranslation.cjs.map +1 -1
- package/dist/cjs/getTranslation.d.ts +23 -6
- package/dist/cjs/index.cjs +20 -27
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +11 -20
- package/dist/cjs/processDictionary/contentDictionary.d.cjs +4 -8
- package/dist/cjs/processDictionary/contentDictionary.d.d.ts +6 -9
- package/dist/cjs/processDictionary/index.cjs +15 -17
- package/dist/cjs/processDictionary/index.cjs.map +1 -1
- package/dist/cjs/processDictionary/index.d.ts +6 -17
- package/dist/cjs/server/IntlayerServerProvider.cjs +46 -0
- package/dist/cjs/server/IntlayerServerProvider.cjs.map +1 -0
- package/dist/cjs/server/IntlayerServerProvider.d.ts +37 -0
- package/dist/cjs/server/getLocaleTranslation.cjs +12 -19
- package/dist/cjs/server/getLocaleTranslation.cjs.map +1 -1
- package/dist/cjs/server/getLocaleTranslation.d.ts +8 -7
- package/dist/cjs/server/index.cjs +20 -27
- package/dist/cjs/server/index.cjs.map +1 -1
- package/dist/cjs/server/index.d.ts +9 -13
- package/dist/cjs/server/serverContext.cjs +25 -31
- package/dist/cjs/server/serverContext.cjs.map +1 -1
- package/dist/cjs/server/serverContext.d.ts +16 -24
- package/dist/cjs/server/useIntlayer.cjs +12 -21
- package/dist/cjs/server/useIntlayer.cjs.map +1 -1
- package/dist/cjs/server/useIntlayer.d.ts +8 -3
- package/dist/cjs/server/useTraduction.cjs +12 -19
- package/dist/cjs/server/useTraduction.cjs.map +1 -1
- package/dist/cjs/server/useTraduction.d.ts +22 -4
- package/dist/cjs/useIntlayerBase.cjs +22 -31
- package/dist/cjs/useIntlayerBase.cjs.map +1 -1
- package/dist/cjs/useIntlayerBase.d.ts +7 -18
- package/dist/esm/ContentEditor/ContentEditor.d.mts +2 -2
- package/dist/esm/ContentEditor/ContentEditor.mjs +38 -29
- package/dist/esm/ContentEditor/contentRender.mjs +5 -3
- package/dist/esm/ContentEditor/index.d.mts +3 -3
- package/dist/esm/ContentEditor/index.mjs +3 -3
- package/dist/esm/IntlayerProvider.d.mts +9 -0
- package/dist/esm/IntlayerProvider.mjs +17 -0
- package/dist/esm/IntlayerProvider.mjs.map +1 -0
- package/dist/esm/client/IntlayerClientProvider.d.mts +24 -0
- package/dist/esm/client/IntlayerClientProvider.mjs +24 -0
- package/dist/esm/client/IntlayerClientProvider.mjs.map +1 -0
- package/dist/esm/client/index.d.mts +10 -19
- package/dist/esm/client/index.mjs +14 -14
- package/dist/esm/client/index.mjs.map +1 -1
- package/dist/esm/client/useContent.d.mts +10 -8
- package/dist/esm/client/useContent.mjs +7 -5
- package/dist/esm/client/useContent.mjs.map +1 -1
- package/dist/esm/client/useIntlayer.d.mts +8 -3
- package/dist/esm/client/useIntlayer.mjs +9 -5
- package/dist/esm/client/useIntlayer.mjs.map +1 -1
- package/dist/esm/client/useLocale.d.mts +8 -5
- package/dist/esm/client/useLocale.mjs +7 -5
- package/dist/esm/client/useLocale.mjs.map +1 -1
- package/dist/esm/client/useLocaleCookie.d.mts +12 -3
- package/dist/esm/client/useLocaleCookie.mjs +11 -5
- package/dist/esm/client/useLocaleCookie.mjs.map +1 -1
- package/dist/esm/client/useTraduction.d.mts +22 -4
- package/dist/esm/client/useTraduction.mjs +7 -5
- package/dist/esm/client/useTraduction.mjs.map +1 -1
- package/dist/esm/getEnumeration.d.mts +27 -5
- package/dist/esm/getEnumeration.mjs +9 -4
- package/dist/esm/getEnumeration.mjs.map +1 -1
- package/dist/esm/getTranslation.d.mts +23 -6
- package/dist/esm/getTranslation.mjs +8 -4
- package/dist/esm/getTranslation.mjs.map +1 -1
- package/dist/esm/index.d.mts +11 -20
- package/dist/esm/index.mjs +9 -11
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/processDictionary/contentDictionary.d.d.mts +6 -9
- package/dist/esm/processDictionary/contentDictionary.d.mjs +1 -1
- package/dist/esm/processDictionary/index.d.mts +6 -17
- package/dist/esm/processDictionary/index.mjs +25 -9
- package/dist/esm/processDictionary/index.mjs.map +1 -1
- package/dist/esm/server/IntlayerServerProvider.d.mts +37 -0
- package/dist/esm/server/IntlayerServerProvider.mjs +21 -0
- package/dist/esm/server/IntlayerServerProvider.mjs.map +1 -0
- package/dist/esm/server/getLocaleTranslation.d.mts +8 -7
- package/dist/esm/server/getLocaleTranslation.mjs +8 -6
- package/dist/esm/server/getLocaleTranslation.mjs.map +1 -1
- package/dist/esm/server/index.d.mts +9 -13
- package/dist/esm/server/index.mjs +10 -10
- package/dist/esm/server/index.mjs.map +1 -1
- package/dist/esm/server/serverContext.d.mts +16 -24
- package/dist/esm/server/serverContext.mjs +13 -6
- package/dist/esm/server/serverContext.mjs.map +1 -1
- package/dist/esm/server/useIntlayer.d.mts +8 -3
- package/dist/esm/server/useIntlayer.mjs +10 -6
- package/dist/esm/server/useIntlayer.mjs.map +1 -1
- package/dist/esm/server/useTraduction.d.mts +22 -4
- package/dist/esm/server/useTraduction.mjs +8 -6
- package/dist/esm/server/useTraduction.mjs.map +1 -1
- package/dist/esm/useIntlayerBase.d.mts +7 -18
- package/dist/esm/useIntlayerBase.mjs +9 -4
- package/dist/esm/useIntlayerBase.mjs.map +1 -1
- package/package.json +10 -10
- package/src/IntlayerProvider.tsx +24 -0
- package/src/client/IntlayerClientProvider.tsx +45 -0
- package/src/client/index.ts +5 -5
- package/src/client/useContent.ts +3 -0
- package/src/client/useIntlayer.ts +7 -2
- package/src/client/useLocale.ts +5 -2
- package/src/client/useLocaleCookie.ts +9 -1
- package/src/client/useTraduction.ts +23 -3
- package/src/getEnumeration.ts +25 -0
- package/src/getTranslation.ts +21 -1
- package/src/index.ts +3 -4
- package/src/processDictionary/index.ts +1 -1
- package/src/server/IntlayerServerProvider.tsx +39 -0
- package/src/server/getLocaleTranslation.ts +5 -2
- package/src/server/index.ts +3 -3
- package/src/server/serverContext.ts +4 -4
- package/src/server/useIntlayer.ts +8 -2
- package/src/server/useTraduction.ts +23 -3
- package/src/useIntlayerBase.ts +4 -1
- package/dist/cjs/LocaleContextProvider.cjs +0 -49
- package/dist/cjs/LocaleContextProvider.cjs.map +0 -1
- package/dist/cjs/LocaleContextProvider.d.ts +0 -10
- package/dist/cjs/client/LocaleClientContextProvider.cjs +0 -54
- package/dist/cjs/client/LocaleClientContextProvider.cjs.map +0 -1
- package/dist/cjs/client/LocaleClientContextProvider.d.ts +0 -20
- package/dist/cjs/server/LocaleServerContextProvider.cjs +0 -49
- package/dist/cjs/server/LocaleServerContextProvider.cjs.map +0 -1
- package/dist/cjs/server/LocaleServerContextProvider.d.ts +0 -34
- package/dist/esm/LocaleContextProvider.d.mts +0 -10
- package/dist/esm/LocaleContextProvider.mjs +0 -15
- package/dist/esm/LocaleContextProvider.mjs.map +0 -1
- package/dist/esm/client/LocaleClientContextProvider.d.mts +0 -20
- package/dist/esm/client/LocaleClientContextProvider.mjs +0 -16
- package/dist/esm/client/LocaleClientContextProvider.mjs.map +0 -1
- package/dist/esm/server/LocaleServerContextProvider.d.mts +0 -34
- package/dist/esm/server/LocaleServerContextProvider.mjs +0 -14
- package/dist/esm/server/LocaleServerContextProvider.mjs.map +0 -1
- package/src/LocaleContextProvider.tsx +0 -26
- package/src/client/LocaleClientContextProvider.tsx +0 -35
- package/src/server/LocaleServerContextProvider.tsx +0 -24
|
@@ -9,33 +9,26 @@ var __export = (target, all) => {
|
|
|
9
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
10
|
};
|
|
11
11
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
13
|
for (let key of __getOwnPropNames(from))
|
|
14
14
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, {
|
|
16
|
-
get: () => from[key],
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
18
|
-
});
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
16
|
}
|
|
20
17
|
return to;
|
|
21
18
|
};
|
|
22
|
-
var __toCommonJS = (mod) =>
|
|
23
|
-
__copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
20
|
var useLocale_exports = {};
|
|
25
21
|
__export(useLocale_exports, {
|
|
26
|
-
useLocale: () => useLocale
|
|
22
|
+
useLocale: () => useLocale
|
|
27
23
|
});
|
|
28
24
|
module.exports = __toCommonJS(useLocale_exports);
|
|
29
25
|
var import_client = require("@intlayer/config/client");
|
|
30
26
|
var import_core = require("@intlayer/core");
|
|
31
27
|
var import_react = require("react");
|
|
32
|
-
var
|
|
33
|
-
const { defaultLocale, locales: availableLocales } =
|
|
34
|
-
import_client.intlayerIntlConfiguration;
|
|
28
|
+
var import_IntlayerClientProvider = require('./IntlayerClientProvider.cjs');
|
|
29
|
+
const { defaultLocale, locales: availableLocales } = import_client.intlayerIntlConfiguration;
|
|
35
30
|
const useLocale = () => {
|
|
36
|
-
const { locale } = (0, import_react.useContext)(
|
|
37
|
-
import_LocaleClientContextProvider.LocaleClientContext
|
|
38
|
-
);
|
|
31
|
+
const { locale } = (0, import_react.useContext)(import_IntlayerClientProvider.IntlayerClientContext);
|
|
39
32
|
return {
|
|
40
33
|
locale,
|
|
41
34
|
// Current locale
|
|
@@ -43,13 +36,12 @@ const useLocale = () => {
|
|
|
43
36
|
// Principal locale defined in config
|
|
44
37
|
availableLocales,
|
|
45
38
|
// List of the available locales defined in config
|
|
46
|
-
localeList: import_core.localeList
|
|
39
|
+
localeList: import_core.localeList
|
|
47
40
|
// List of all available locales
|
|
48
41
|
};
|
|
49
42
|
};
|
|
50
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
-
0 &&
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
//# sourceMappingURL=useLocale.cjs.map
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
useLocale
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=useLocale.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["'use client';\n\nimport { intlayerIntlConfiguration } from '@intlayer/config/client';\nimport { localeList } from '@intlayer/core';\nimport { useContext } from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["'use client';\n\nimport { intlayerIntlConfiguration } from '@intlayer/config/client';\nimport { localeList } from '@intlayer/core';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerClientProvider';\n\nconst { defaultLocale, locales: availableLocales } = intlayerIntlConfiguration;\n\n/**\n * On the client side, hook to get the current locale and all related fields\n */\nexport const useLocale = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return {\n locale, // Current locale\n defaultLocale, // Principal locale defined in config\n availableLocales, // List of the available locales defined in config\n localeList, // List of all available locales\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA0C;AAC1C,kBAA2B;AAC3B,mBAA2B;AAC3B,oCAAsC;AAEtC,MAAM,EAAE,eAAe,SAAS,iBAAiB,IAAI;AAK9C,MAAM,YAAY,MAAM;AAC7B,QAAM,EAAE,OAAO,QAAI,yBAAW,mDAAqB;AAEnD,SAAO;AAAA,IACL;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import * as _intlayer_config_client from
|
|
1
|
+
import * as _intlayer_config_client from '@intlayer/config/client';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* On the client side, hook to get the current locale and all related fields
|
|
5
|
+
*/
|
|
3
6
|
declare const useLocale: () => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
locale: _intlayer_config_client.Locales;
|
|
8
|
+
defaultLocale: _intlayer_config_client.Locales;
|
|
9
|
+
availableLocales: _intlayer_config_client.Locales[];
|
|
10
|
+
localeList: _intlayer_config_client.Locales[];
|
|
8
11
|
};
|
|
9
12
|
|
|
10
13
|
export { useLocale };
|
|
@@ -10,36 +10,27 @@ var __export = (target, all) => {
|
|
|
10
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
11
|
};
|
|
12
12
|
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
14
|
for (let key of __getOwnPropNames(from))
|
|
15
15
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, {
|
|
17
|
-
get: () => from[key],
|
|
18
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
19
|
-
});
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
17
|
}
|
|
21
18
|
return to;
|
|
22
19
|
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
: target,
|
|
33
|
-
mod
|
|
34
|
-
)
|
|
35
|
-
);
|
|
36
|
-
var __toCommonJS = (mod) =>
|
|
37
|
-
__copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
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);
|
|
38
29
|
var useLocaleCookie_exports = {};
|
|
39
30
|
__export(useLocaleCookie_exports, {
|
|
40
31
|
localeCookie: () => localeCookie,
|
|
41
32
|
setLocaleCookie: () => setLocaleCookie,
|
|
42
|
-
useLocaleCookie: () => useLocaleCookie
|
|
33
|
+
useLocaleCookie: () => useLocaleCookie
|
|
43
34
|
});
|
|
44
35
|
module.exports = __toCommonJS(useLocaleCookie_exports);
|
|
45
36
|
var import_client = require("@intlayer/config/client");
|
|
@@ -50,7 +41,7 @@ const cookieAttributes = {
|
|
|
50
41
|
expires: void 0,
|
|
51
42
|
domain: void 0,
|
|
52
43
|
secure: false,
|
|
53
|
-
sameSite: "strict"
|
|
44
|
+
sameSite: "strict"
|
|
54
45
|
};
|
|
55
46
|
const localeCookie = import_js_cookie.default.get(cookieName);
|
|
56
47
|
const setLocaleCookie = (locale) => {
|
|
@@ -58,13 +49,12 @@ const setLocaleCookie = (locale) => {
|
|
|
58
49
|
};
|
|
59
50
|
const useLocaleCookie = () => ({
|
|
60
51
|
localeCookie,
|
|
61
|
-
setLocaleCookie
|
|
52
|
+
setLocaleCookie
|
|
62
53
|
});
|
|
63
54
|
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
-
0 &&
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
//# sourceMappingURL=useLocaleCookie.cjs.map
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
localeCookie,
|
|
57
|
+
setLocaleCookie,
|
|
58
|
+
useLocaleCookie
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=useLocaleCookie.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/useLocaleCookie.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/client/useLocaleCookie.ts"],"sourcesContent":["import {\n type Locales,\n intlayerMiddlewareConfiguration,\n} from '@intlayer/config/client';\nimport Cookies from 'js-cookie';\n\nconst { cookieName } = intlayerMiddlewareConfiguration;\n\nconst cookieAttributes: Cookies.CookieAttributes = {\n path: '/',\n expires: undefined,\n domain: undefined,\n secure: false,\n sameSite: 'strict',\n};\n\n/**\n * Get the locale cookie\n */\nexport const localeCookie = Cookies.get(cookieName) as Locales | undefined;\n\n/**\n * Set the locale cookie\n */\nexport const setLocaleCookie = (locale: Locales) => {\n Cookies.set(cookieName, locale, cookieAttributes);\n};\n\n/**\n * Hook that provides the locale cookie and a function to set it\n */\nexport const useLocaleCookie = () => ({\n localeCookie,\n setLocaleCookie,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAGO;AACP,uBAAoB;AAEpB,MAAM,EAAE,WAAW,IAAI;AAEvB,MAAM,mBAA6C;AAAA,EACjD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AACZ;AAKO,MAAM,eAAe,iBAAAA,QAAQ,IAAI,UAAU;AAK3C,MAAM,kBAAkB,CAAC,WAAoB;AAClD,mBAAAA,QAAQ,IAAI,YAAY,QAAQ,gBAAgB;AAClD;AAKO,MAAM,kBAAkB,OAAO;AAAA,EACpC;AAAA,EACA;AACF;","names":["Cookies"]}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import { Locales } from
|
|
1
|
+
import { Locales } from '@intlayer/config/client';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Get the locale cookie
|
|
5
|
+
*/
|
|
3
6
|
declare const localeCookie: Locales | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Set the locale cookie
|
|
9
|
+
*/
|
|
4
10
|
declare const setLocaleCookie: (locale: Locales) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Hook that provides the locale cookie and a function to set it
|
|
13
|
+
*/
|
|
5
14
|
declare const useLocaleCookie: () => {
|
|
6
|
-
|
|
7
|
-
|
|
15
|
+
localeCookie: Locales | undefined;
|
|
16
|
+
setLocaleCookie: (locale: Locales) => void;
|
|
8
17
|
};
|
|
9
18
|
|
|
10
19
|
export { localeCookie, setLocaleCookie, useLocaleCookie };
|
|
@@ -8,35 +8,28 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
12
|
for (let key of __getOwnPropNames(from))
|
|
13
13
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, {
|
|
15
|
-
get: () => from[key],
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
17
|
-
});
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
15
|
}
|
|
19
16
|
return to;
|
|
20
17
|
};
|
|
21
|
-
var __toCommonJS = (mod) =>
|
|
22
|
-
__copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
19
|
var useTraduction_exports = {};
|
|
24
20
|
__export(useTraduction_exports, {
|
|
25
|
-
useTraduction: () => useTraduction
|
|
21
|
+
useTraduction: () => useTraduction
|
|
26
22
|
});
|
|
27
23
|
module.exports = __toCommonJS(useTraduction_exports);
|
|
28
24
|
var import_react = require("react");
|
|
29
|
-
var import_getTranslation = require(
|
|
30
|
-
var
|
|
25
|
+
var import_getTranslation = require('../getTranslation.cjs');
|
|
26
|
+
var import_IntlayerClientProvider = require('./IntlayerClientProvider.cjs');
|
|
31
27
|
const useTraduction = (languageContent) => {
|
|
32
|
-
const { locale } = (0, import_react.useContext)(
|
|
33
|
-
import_LocaleClientContextProvider.LocaleClientContext
|
|
34
|
-
);
|
|
28
|
+
const { locale } = (0, import_react.useContext)(import_IntlayerClientProvider.IntlayerClientContext);
|
|
35
29
|
return (0, import_getTranslation.getTranslation)(languageContent, locale);
|
|
36
30
|
};
|
|
37
31
|
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
-
0 &&
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
//# sourceMappingURL=useTraduction.cjs.map
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
useTraduction
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=useTraduction.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/useTraduction.ts"],"sourcesContent":["import type { LanguageContent } from '@intlayer/core';\nimport { useContext } from 'react';\nimport { getTranslation } from '../getTranslation';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/client/useTraduction.ts"],"sourcesContent":["import type { LanguageContent } from '@intlayer/core';\nimport { useContext } from 'react';\nimport { getTranslation } from '../getTranslation';\nimport { IntlayerClientContext } from './IntlayerClientProvider';\n\n/**\n * On the client side, Hook that picking one dictionary by its id and return the content.\n *\n * If not locale found, it will return the content related to the default locale.\n *\n * Return either the content editor, or the content itself depending on the configuration.\n *\n * Usage:\n *\n * const content = getTranslation<string>({\n * en: 'Hello',\n * fr: 'Bonjour',\n * },\n * 'fr');\n * // 'Bonjour'\n *\n * Using TypeScript:\n * - this function will require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nexport const useTraduction = <Content = string>(\n languageContent: LanguageContent<Content>\n): Content => {\n const { locale } = useContext(IntlayerClientContext);\n\n return getTranslation(languageContent, locale);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA2B;AAC3B,4BAA+B;AAC/B,oCAAsC;AAsB/B,MAAM,gBAAgB,CAC3B,oBACY;AACZ,QAAM,EAAE,OAAO,QAAI,yBAAW,mDAAqB;AAEnD,aAAO,sCAAe,iBAAiB,MAAM;AAC/C;","names":[]}
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
import { LanguageContent } from
|
|
1
|
+
import { LanguageContent } from '@intlayer/core';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* On the client side, Hook that picking one dictionary by its id and return the content.
|
|
5
|
+
*
|
|
6
|
+
* If not locale found, it will return the content related to the default locale.
|
|
7
|
+
*
|
|
8
|
+
* Return either the content editor, or the content itself depending on the configuration.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
*
|
|
12
|
+
* const content = getTranslation<string>({
|
|
13
|
+
* en: 'Hello',
|
|
14
|
+
* fr: 'Bonjour',
|
|
15
|
+
* },
|
|
16
|
+
* 'fr');
|
|
17
|
+
* // 'Bonjour'
|
|
18
|
+
*
|
|
19
|
+
* Using TypeScript:
|
|
20
|
+
* - this function will require each locale to be defined if defined in the project configuration.
|
|
21
|
+
* - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
|
|
22
|
+
*/
|
|
23
|
+
declare const useTraduction: <Content = string>(languageContent: LanguageContent<Content>) => Content;
|
|
6
24
|
|
|
7
25
|
export { useTraduction };
|
|
@@ -8,25 +8,21 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
12
|
for (let key of __getOwnPropNames(from))
|
|
13
13
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, {
|
|
15
|
-
get: () => from[key],
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
17
|
-
});
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
15
|
}
|
|
19
16
|
return to;
|
|
20
17
|
};
|
|
21
|
-
var __toCommonJS = (mod) =>
|
|
22
|
-
__copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
19
|
var getEnumeration_exports = {};
|
|
24
20
|
__export(getEnumeration_exports, {
|
|
25
|
-
getEnumeration: () => getEnumeration
|
|
21
|
+
getEnumeration: () => getEnumeration
|
|
26
22
|
});
|
|
27
23
|
module.exports = __toCommonJS(getEnumeration_exports);
|
|
28
24
|
var import_core = require("@intlayer/core");
|
|
29
|
-
var import_contentRender = require(
|
|
25
|
+
var import_contentRender = require('./ContentEditor/contentRender.cjs');
|
|
30
26
|
const getEnumeration = (enumerationContent, quantity) => {
|
|
31
27
|
const result = (0, import_core.getEnumerationContent)(
|
|
32
28
|
enumerationContent,
|
|
@@ -38,8 +34,7 @@ const getEnumeration = (enumerationContent, quantity) => {
|
|
|
38
34
|
return result;
|
|
39
35
|
};
|
|
40
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
-
0 &&
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
//# sourceMappingURL=getEnumeration.cjs.map
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
getEnumeration
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=getEnumeration.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getEnumeration.ts"],"sourcesContent":["import { type QuantityContent, getEnumerationContent } from '@intlayer/core';\nimport { contentRender } from './ContentEditor/contentRender';\n\nexport const getEnumeration = <Content>(\n enumerationContent: QuantityContent<Content>,\n quantity: number\n): Content => {\n const result: Content = getEnumerationContent<Content>(\n enumerationContent,\n quantity\n );\n\n if (typeof result === 'string') {\n return contentRender(result) as Content;\n }\n\n return result;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA4D;AAC5D,2BAA8B;
|
|
1
|
+
{"version":3,"sources":["../../src/getEnumeration.ts"],"sourcesContent":["import { type QuantityContent, getEnumerationContent } from '@intlayer/core';\nimport { contentRender } from './ContentEditor/contentRender';\n\n/**\n * Allow to pick a content based on a quantity.\n *\n * Return either the content editor, or the content itself depending on the configuration.\n *\n * Usage:\n *\n * const content = getEnumeration({\n * '<=-2.3': 'You have less than -2.3',\n * '<1': 'You have less than one',\n * '2': 'You have two',\n * '>=3': 'You have three or more',\n * },\n * 2);\n * // 'You have two'\n *\n * The order of the keys will define the priority of the content.\n *\n * const content = getEnumeration({\n * '<4': 'You have less than four',\n * '2': 'You have two',\n * });\n * // 'You have less than four'\n *\n */\nexport const getEnumeration = <Content>(\n enumerationContent: QuantityContent<Content>,\n quantity: number\n): Content => {\n const result: Content = getEnumerationContent<Content>(\n enumerationContent,\n quantity\n );\n\n if (typeof result === 'string') {\n return contentRender(result) as Content;\n }\n\n return result;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA4D;AAC5D,2BAA8B;AA2BvB,MAAM,iBAAiB,CAC5B,oBACA,aACY;AACZ,QAAM,aAAkB;AAAA,IACtB;AAAA,IACA;AAAA,EACF;AAEA,MAAI,OAAO,WAAW,UAAU;AAC9B,eAAO,oCAAc,MAAM;AAAA,EAC7B;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,8 +1,30 @@
|
|
|
1
|
-
import { QuantityContent } from
|
|
1
|
+
import { QuantityContent } from '@intlayer/core';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Allow to pick a content based on a quantity.
|
|
5
|
+
*
|
|
6
|
+
* Return either the content editor, or the content itself depending on the configuration.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
*
|
|
10
|
+
* const content = getEnumeration({
|
|
11
|
+
* '<=-2.3': 'You have less than -2.3',
|
|
12
|
+
* '<1': 'You have less than one',
|
|
13
|
+
* '2': 'You have two',
|
|
14
|
+
* '>=3': 'You have three or more',
|
|
15
|
+
* },
|
|
16
|
+
* 2);
|
|
17
|
+
* // 'You have two'
|
|
18
|
+
*
|
|
19
|
+
* The order of the keys will define the priority of the content.
|
|
20
|
+
*
|
|
21
|
+
* const content = getEnumeration({
|
|
22
|
+
* '<4': 'You have less than four',
|
|
23
|
+
* '2': 'You have two',
|
|
24
|
+
* });
|
|
25
|
+
* // 'You have less than four'
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
declare const getEnumeration: <Content>(enumerationContent: QuantityContent<Content>, quantity: number) => Content;
|
|
7
29
|
|
|
8
30
|
export { getEnumeration };
|
|
@@ -8,26 +8,22 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
12
|
for (let key of __getOwnPropNames(from))
|
|
13
13
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, {
|
|
15
|
-
get: () => from[key],
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
17
|
-
});
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
15
|
}
|
|
19
16
|
return to;
|
|
20
17
|
};
|
|
21
|
-
var __toCommonJS = (mod) =>
|
|
22
|
-
__copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
19
|
var getTranslation_exports = {};
|
|
24
20
|
__export(getTranslation_exports, {
|
|
25
|
-
getTranslation: () => getTranslation
|
|
21
|
+
getTranslation: () => getTranslation
|
|
26
22
|
});
|
|
27
23
|
module.exports = __toCommonJS(getTranslation_exports);
|
|
28
24
|
var import_client = require("@intlayer/config/client");
|
|
29
25
|
var import_core = require("@intlayer/core");
|
|
30
|
-
var import_contentRender = require(
|
|
26
|
+
var import_contentRender = require('./ContentEditor/contentRender.cjs');
|
|
31
27
|
const getTranslation = (languageContent, locale) => {
|
|
32
28
|
const { defaultLocale } = import_client.intlayerIntlConfiguration;
|
|
33
29
|
const result = (0, import_core.getTranslationContent)(
|
|
@@ -40,8 +36,7 @@ const getTranslation = (languageContent, locale) => {
|
|
|
40
36
|
return result;
|
|
41
37
|
};
|
|
42
38
|
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
-
0 &&
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
//# sourceMappingURL=getTranslation.cjs.map
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
getTranslation
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=getTranslation.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getTranslation.ts"],"sourcesContent":["import {\n type Locales,\n intlayerIntlConfiguration,\n} from '@intlayer/config/client';\nimport { type LanguageContent, getTranslationContent } from '@intlayer/core';\nimport { contentRender } from './ContentEditor/contentRender';\n\nexport const getTranslation = <Content>(\n languageContent: LanguageContent<Content>,\n locale?: Locales\n): Content => {\n const { defaultLocale } = intlayerIntlConfiguration;\n\n const result: Content = getTranslationContent<Content>(\n languageContent,\n locale ?? defaultLocale\n );\n\n if (typeof result === 'string') {\n return contentRender(result) as Content;\n }\n\n return result;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAGO;AACP,kBAA4D;AAC5D,2BAA8B;
|
|
1
|
+
{"version":3,"sources":["../../src/getTranslation.ts"],"sourcesContent":["import {\n type Locales,\n intlayerIntlConfiguration,\n} from '@intlayer/config/client';\nimport { type LanguageContent, getTranslationContent } from '@intlayer/core';\nimport { contentRender } from './ContentEditor/contentRender';\n\n/**\n *\n * Allow to pick a content based on a locale.\n * If not locale found, it will return the content related to the default locale.\n *\n * Return either the content editor, or the content itself depending on the configuration.\n *\n * Usage:\n *\n * const content = getTranslation<string>({\n * en: 'Hello',\n * fr: 'Bonjour',\n * },\n * 'fr');\n * // 'Bonjour'\n *\n * Using TypeScript:\n * - this function will require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nexport const getTranslation = <Content = string>(\n languageContent: LanguageContent<Content>,\n locale?: Locales\n): Content => {\n const { defaultLocale } = intlayerIntlConfiguration;\n\n const result: Content = getTranslationContent<Content>(\n languageContent,\n locale ?? defaultLocale\n );\n\n if (typeof result === 'string') {\n return contentRender(result) as Content;\n }\n\n return result;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAGO;AACP,kBAA4D;AAC5D,2BAA8B;AAsBvB,MAAM,iBAAiB,CAC5B,iBACA,WACY;AACZ,QAAM,EAAE,cAAc,IAAI;AAE1B,QAAM,aAAkB;AAAA,IACtB;AAAA,IACA,UAAU;AAAA,EACZ;AAEA,MAAI,OAAO,WAAW,UAAU;AAC9B,eAAO,oCAAc,MAAM;AAAA,EAC7B;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,9 +1,26 @@
|
|
|
1
|
-
import { Locales } from
|
|
2
|
-
import { LanguageContent } from
|
|
1
|
+
import { Locales } from '@intlayer/config/client';
|
|
2
|
+
import { LanguageContent } from '@intlayer/core';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* Allow to pick a content based on a locale.
|
|
7
|
+
* If not locale found, it will return the content related to the default locale.
|
|
8
|
+
*
|
|
9
|
+
* Return either the content editor, or the content itself depending on the configuration.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
*
|
|
13
|
+
* const content = getTranslation<string>({
|
|
14
|
+
* en: 'Hello',
|
|
15
|
+
* fr: 'Bonjour',
|
|
16
|
+
* },
|
|
17
|
+
* 'fr');
|
|
18
|
+
* // 'Bonjour'
|
|
19
|
+
*
|
|
20
|
+
* Using TypeScript:
|
|
21
|
+
* - this function will require each locale to be defined if defined in the project configuration.
|
|
22
|
+
* - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
|
|
23
|
+
*/
|
|
24
|
+
declare const getTranslation: <Content = string>(languageContent: LanguageContent<Content>, locale?: Locales) => Content;
|
|
8
25
|
|
|
9
26
|
export { getTranslation };
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -8,46 +8,39 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
12
|
for (let key of __getOwnPropNames(from))
|
|
13
13
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, {
|
|
15
|
-
get: () => from[key],
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
17
|
-
});
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
15
|
}
|
|
19
16
|
return to;
|
|
20
17
|
};
|
|
21
|
-
var __toCommonJS = (mod) =>
|
|
22
|
-
__copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
19
|
var src_exports = {};
|
|
24
20
|
__export(src_exports, {
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
IntlayerClient: () => import_client.IntlayerClient,
|
|
22
|
+
IntlayerClientProvider: () => import_client.IntlayerClientProvider,
|
|
27
23
|
getTranslation: () => import_getTranslation.getTranslation,
|
|
28
24
|
localeCookie: () => import_client.localeCookie,
|
|
29
25
|
setLocaleCookie: () => import_client.setLocaleCookie,
|
|
30
26
|
useIntlayer: () => import_client.useIntlayer,
|
|
31
27
|
useLocale: () => import_client.useLocale,
|
|
32
|
-
useLocaleContext: () => import_client.useLocaleContext,
|
|
33
28
|
useLocaleCookie: () => import_client.useLocaleCookie,
|
|
34
|
-
useTraduction: () => import_client.useTraduction
|
|
29
|
+
useTraduction: () => import_client.useTraduction
|
|
35
30
|
});
|
|
36
31
|
module.exports = __toCommonJS(src_exports);
|
|
37
|
-
var import_getTranslation = require(
|
|
38
|
-
var import_client = require(
|
|
32
|
+
var import_getTranslation = require('./getTranslation.cjs');
|
|
33
|
+
var import_client = require('./client/index.cjs');
|
|
39
34
|
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
-
0 &&
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
//# sourceMappingURL=index.cjs.map
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
IntlayerClient,
|
|
37
|
+
IntlayerClientProvider,
|
|
38
|
+
getTranslation,
|
|
39
|
+
localeCookie,
|
|
40
|
+
setLocaleCookie,
|
|
41
|
+
useIntlayer,
|
|
42
|
+
useLocale,
|
|
43
|
+
useLocaleCookie,
|
|
44
|
+
useTraduction
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { getTranslation } from './getTranslation';\nexport {\n
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { getTranslation } from './getTranslation';\nexport {\n IntlayerClientProvider,\n type IntlayerClientProviderProps,\n IntlayerClient,\n useIntlayer,\n useLocale,\n useTraduction,\n useLocaleCookie,\n localeCookie,\n setLocaleCookie,\n} from './client/index';\nexport {} from './client/useLocaleCookie';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA+B;AAC/B,oBAUO;","names":[]}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
export { getTranslation } from
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
localeCookie,
|
|
13
|
-
setLocaleCookie,
|
|
14
|
-
useLocaleCookie,
|
|
15
|
-
} from "./client/useLocaleCookie.js";
|
|
16
|
-
import "@intlayer/config/client";
|
|
17
|
-
import "@intlayer/core";
|
|
18
|
-
import "react";
|
|
19
|
-
import "./useIntlayerBase.js";
|
|
20
|
-
import "intlayer";
|
|
1
|
+
export { getTranslation } from './getTranslation.js';
|
|
2
|
+
export { IntlayerClientContext as IntlayerClient, IntlayerClientProvider, IntlayerClientProviderProps } from './client/IntlayerClientProvider.js';
|
|
3
|
+
export { useIntlayer } from './client/useIntlayer.js';
|
|
4
|
+
export { useLocale } from './client/useLocale.js';
|
|
5
|
+
export { useTraduction } from './client/useTraduction.js';
|
|
6
|
+
export { localeCookie, setLocaleCookie, useLocaleCookie } from './client/useLocaleCookie.js';
|
|
7
|
+
import '@intlayer/config/client';
|
|
8
|
+
import '@intlayer/core';
|
|
9
|
+
import 'react';
|
|
10
|
+
import './useIntlayerBase.js';
|
|
11
|
+
import 'intlayer';
|
|
@@ -4,18 +4,14 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
8
|
for (let key of __getOwnPropNames(from))
|
|
9
9
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, {
|
|
11
|
-
get: () => from[key],
|
|
12
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
13
|
-
});
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
11
|
}
|
|
15
12
|
return to;
|
|
16
13
|
};
|
|
17
|
-
var __toCommonJS = (mod) =>
|
|
18
|
-
__copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
15
|
var contentDictionary_d_exports = {};
|
|
20
16
|
module.exports = __toCommonJS(contentDictionary_d_exports);
|
|
21
|
-
//# sourceMappingURL=contentDictionary.d.cjs.map
|
|
17
|
+
//# sourceMappingURL=contentDictionary.d.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TranslationContent } from
|
|
1
|
+
import { TranslationContent } from '@intlayer/core';
|
|
2
2
|
|
|
3
3
|
type ContentValue =
|
|
4
4
|
| string
|
|
@@ -17,16 +17,13 @@ type TransformedContentValue =
|
|
|
17
17
|
| undefined
|
|
18
18
|
| ((quantity: number) => TransformedContentValue);
|
|
19
19
|
|
|
20
|
-
type TransformedContent = Record<
|
|
20
|
+
type TransformedContent = Record<
|
|
21
|
+
string,
|
|
22
|
+
TransformedContentValue | undefined
|
|
23
|
+
>;
|
|
21
24
|
|
|
22
25
|
type ContentDictionary = Content & {
|
|
23
26
|
id: string;
|
|
24
27
|
};
|
|
25
28
|
|
|
26
|
-
export type {
|
|
27
|
-
Content,
|
|
28
|
-
ContentDictionary,
|
|
29
|
-
ContentValue,
|
|
30
|
-
TransformedContent,
|
|
31
|
-
TransformedContentValue,
|
|
32
|
-
};
|
|
29
|
+
export type { Content, ContentDictionary, ContentValue, TransformedContent, TransformedContentValue };
|