react-intlayer 1.0.0 → 1.0.1
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/LocaleContextProvider.cjs +14 -26
- package/dist/cjs/LocaleContextProvider.d.ts +5 -6
- package/dist/cjs/client/LocaleClientContextProvider.cjs +14 -26
- package/dist/cjs/client/LocaleClientContextProvider.d.ts +6 -11
- package/dist/cjs/client/index.cjs +23 -30
- package/dist/cjs/client/index.d.ts +10 -19
- package/dist/cjs/client/useContent.cjs +11 -16
- package/dist/cjs/client/useContent.d.ts +7 -8
- package/dist/cjs/client/useIntlayer.cjs +11 -18
- package/dist/cjs/client/useIntlayer.d.ts +3 -3
- package/dist/cjs/client/useLocale.cjs +12 -20
- package/dist/cjs/client/useLocale.d.ts +5 -5
- package/dist/cjs/client/useLocaleCookie.cjs +20 -30
- package/dist/cjs/client/useLocaleCookie.d.ts +3 -3
- package/dist/cjs/client/useTraduction.cjs +11 -18
- package/dist/cjs/client/useTraduction.d.ts +2 -4
- package/dist/cjs/getEnumeration.cjs +9 -14
- package/dist/cjs/getEnumeration.d.ts +2 -5
- package/dist/cjs/getTranslation.cjs +9 -14
- package/dist/cjs/getTranslation.d.ts +3 -6
- package/dist/cjs/index.cjs +19 -24
- 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.d.ts +5 -16
- package/dist/cjs/server/LocaleServerContextProvider.cjs +12 -21
- package/dist/cjs/server/LocaleServerContextProvider.d.ts +16 -26
- package/dist/cjs/server/getLocaleTranslation.cjs +12 -19
- package/dist/cjs/server/getLocaleTranslation.d.ts +5 -7
- package/dist/cjs/server/index.cjs +19 -26
- package/dist/cjs/server/index.d.ts +9 -13
- package/dist/cjs/server/serverContext.cjs +25 -31
- package/dist/cjs/server/serverContext.d.ts +12 -20
- package/dist/cjs/server/useIntlayer.cjs +12 -21
- package/dist/cjs/server/useIntlayer.d.ts +3 -3
- package/dist/cjs/server/useTraduction.cjs +12 -19
- package/dist/cjs/server/useTraduction.d.ts +2 -4
- package/dist/cjs/useIntlayerBase.cjs +22 -31
- package/dist/cjs/useIntlayerBase.d.ts +4 -12
- 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/LocaleContextProvider.d.mts +5 -6
- package/dist/esm/LocaleContextProvider.mjs +14 -12
- package/dist/esm/client/LocaleClientContextProvider.d.mts +6 -11
- package/dist/esm/client/LocaleClientContextProvider.mjs +16 -11
- package/dist/esm/client/index.d.mts +10 -19
- package/dist/esm/client/index.mjs +9 -9
- package/dist/esm/client/useContent.d.mts +7 -8
- package/dist/esm/client/useContent.mjs +7 -5
- package/dist/esm/client/useIntlayer.d.mts +3 -3
- package/dist/esm/client/useIntlayer.mjs +8 -4
- package/dist/esm/client/useLocale.d.mts +5 -5
- package/dist/esm/client/useLocale.mjs +6 -4
- package/dist/esm/client/useLocaleCookie.d.mts +3 -3
- package/dist/esm/client/useLocaleCookie.mjs +11 -5
- package/dist/esm/client/useTraduction.d.mts +2 -4
- package/dist/esm/client/useTraduction.mjs +6 -4
- package/dist/esm/getEnumeration.d.mts +2 -5
- package/dist/esm/getEnumeration.mjs +9 -4
- package/dist/esm/getTranslation.d.mts +3 -6
- package/dist/esm/getTranslation.mjs +8 -4
- package/dist/esm/index.d.mts +11 -20
- package/dist/esm/index.mjs +5 -5
- 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 +5 -16
- package/dist/esm/processDictionary/index.mjs +25 -9
- package/dist/esm/server/LocaleServerContextProvider.d.mts +16 -26
- package/dist/esm/server/LocaleServerContextProvider.mjs +11 -9
- package/dist/esm/server/getLocaleTranslation.d.mts +5 -7
- package/dist/esm/server/getLocaleTranslation.mjs +7 -5
- package/dist/esm/server/index.d.mts +9 -13
- package/dist/esm/server/index.mjs +7 -7
- package/dist/esm/server/serverContext.d.mts +12 -20
- package/dist/esm/server/serverContext.mjs +13 -6
- package/dist/esm/server/useIntlayer.d.mts +3 -3
- package/dist/esm/server/useIntlayer.mjs +9 -5
- package/dist/esm/server/useTraduction.d.mts +2 -4
- package/dist/esm/server/useTraduction.mjs +7 -5
- package/dist/esm/useIntlayerBase.d.mts +4 -12
- package/dist/esm/useIntlayerBase.mjs +9 -4
- package/package.json +8 -8
|
@@ -1,34 +1,24 @@
|
|
|
1
|
-
import * as react from
|
|
2
|
-
import { PropsWithChildren, FC } from
|
|
3
|
-
import { Locales } from
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { PropsWithChildren, FC } from 'react';
|
|
3
|
+
import { Locales } from '@intlayer/config/client';
|
|
4
4
|
|
|
5
5
|
declare const LocaleServerContext: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
children:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}) => react.ReactNode;
|
|
18
|
-
_storage: () => {
|
|
19
|
-
value: Locales | undefined;
|
|
20
|
-
};
|
|
21
|
-
_defaultValue: Locales | undefined;
|
|
6
|
+
Provider: ({ children, value, }: {
|
|
7
|
+
children: react.ReactNode;
|
|
8
|
+
value: Locales;
|
|
9
|
+
}) => react.ReactNode;
|
|
10
|
+
Consumer: ({ children, }: {
|
|
11
|
+
children: (context: Locales | undefined) => react.ReactNode;
|
|
12
|
+
}) => react.ReactNode;
|
|
13
|
+
_storage: () => {
|
|
14
|
+
value: Locales | undefined;
|
|
15
|
+
};
|
|
16
|
+
_defaultValue: Locales | undefined;
|
|
22
17
|
};
|
|
23
18
|
declare const locale: Locales | undefined;
|
|
24
19
|
type LocaleServerContextProviderProps = PropsWithChildren & {
|
|
25
|
-
|
|
20
|
+
locale: Locales;
|
|
26
21
|
};
|
|
27
22
|
declare const LocaleServerContextProvider: FC<LocaleServerContextProviderProps>;
|
|
28
23
|
|
|
29
|
-
export {
|
|
30
|
-
LocaleServerContext,
|
|
31
|
-
LocaleServerContextProvider,
|
|
32
|
-
type LocaleServerContextProviderProps,
|
|
33
|
-
locale,
|
|
34
|
-
};
|
|
24
|
+
export { LocaleServerContext, LocaleServerContextProvider, type LocaleServerContextProviderProps, locale };
|
|
@@ -8,43 +8,36 @@ 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 getLocaleTranslation_exports = {};
|
|
24
20
|
__export(getLocaleTranslation_exports, {
|
|
25
|
-
getLocaleTranslation: () => getLocaleTranslation
|
|
21
|
+
getLocaleTranslation: () => getLocaleTranslation
|
|
26
22
|
});
|
|
27
23
|
module.exports = __toCommonJS(getLocaleTranslation_exports);
|
|
28
24
|
var import_client = require("@intlayer/config/client");
|
|
29
25
|
var import_core = require("@intlayer/core");
|
|
30
|
-
var import_LocaleServerContextProvider = require(
|
|
31
|
-
var import_serverContext = require(
|
|
26
|
+
var import_LocaleServerContextProvider = require('./LocaleServerContextProvider.cjs');
|
|
27
|
+
var import_serverContext = require('./serverContext.cjs');
|
|
32
28
|
const getLocaleTranslation = (languageContent) => {
|
|
33
|
-
const locale = (0, import_serverContext.getServerContext)(
|
|
34
|
-
import_LocaleServerContextProvider.LocaleServerContext
|
|
35
|
-
);
|
|
29
|
+
const locale = (0, import_serverContext.getServerContext)(import_LocaleServerContextProvider.LocaleServerContext);
|
|
36
30
|
const content = (0, import_core.getTranslationContent)(
|
|
37
31
|
languageContent,
|
|
38
32
|
locale ?? import_client.intlayerIntlConfiguration.defaultLocale
|
|
39
33
|
);
|
|
40
34
|
return {
|
|
41
35
|
locale,
|
|
42
|
-
content
|
|
36
|
+
content
|
|
43
37
|
};
|
|
44
38
|
};
|
|
45
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
-
0 &&
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=getLocaleTranslation.cjs.map
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
getLocaleTranslation
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=getLocaleTranslation.cjs.map
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import * as _intlayer_config_client from
|
|
2
|
-
import { LanguageContent } from
|
|
1
|
+
import * as _intlayer_config_client from '@intlayer/config/client';
|
|
2
|
+
import { LanguageContent } from '@intlayer/core';
|
|
3
3
|
|
|
4
|
-
declare const getLocaleTranslation: <Content>(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
locale: _intlayer_config_client.Locales | undefined;
|
|
8
|
-
content: Content;
|
|
4
|
+
declare const getLocaleTranslation: <Content>(languageContent: LanguageContent<Content>) => {
|
|
5
|
+
locale: _intlayer_config_client.Locales | undefined;
|
|
6
|
+
content: Content;
|
|
9
7
|
};
|
|
10
8
|
|
|
11
9
|
export { getLocaleTranslation };
|
|
@@ -8,42 +8,35 @@ 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 server_exports = {};
|
|
24
20
|
__export(server_exports, {
|
|
25
|
-
LocaleServerContext: () =>
|
|
26
|
-
|
|
27
|
-
LocaleServerContextProvider: () =>
|
|
28
|
-
import_LocaleServerContextProvider.LocaleServerContextProvider,
|
|
21
|
+
LocaleServerContext: () => import_LocaleServerContextProvider.LocaleServerContext,
|
|
22
|
+
LocaleServerContextProvider: () => import_LocaleServerContextProvider.LocaleServerContextProvider,
|
|
29
23
|
getLocaleContent: () => import_getLocaleTranslation.getLocaleTranslation,
|
|
30
24
|
locale: () => import_LocaleServerContextProvider.locale,
|
|
31
25
|
useIntlayer: () => import_useIntlayer.useIntlayer,
|
|
32
|
-
useTraduction: () => import_useTraduction.useTraduction
|
|
26
|
+
useTraduction: () => import_useTraduction.useTraduction
|
|
33
27
|
});
|
|
34
28
|
module.exports = __toCommonJS(server_exports);
|
|
35
|
-
var import_getLocaleTranslation = require(
|
|
36
|
-
var import_useTraduction = require(
|
|
37
|
-
var import_LocaleServerContextProvider = require(
|
|
38
|
-
var import_useIntlayer = require(
|
|
29
|
+
var import_getLocaleTranslation = require('./getLocaleTranslation.cjs');
|
|
30
|
+
var import_useTraduction = require('./useTraduction.cjs');
|
|
31
|
+
var import_LocaleServerContextProvider = require('./LocaleServerContextProvider.cjs');
|
|
32
|
+
var import_useIntlayer = require('./useIntlayer.cjs');
|
|
39
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
-
0 &&
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
//# sourceMappingURL=index.cjs.map
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
LocaleServerContext,
|
|
36
|
+
LocaleServerContextProvider,
|
|
37
|
+
getLocaleContent,
|
|
38
|
+
locale,
|
|
39
|
+
useIntlayer,
|
|
40
|
+
useTraduction
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
export { getLocaleTranslation as getLocaleContent } from
|
|
2
|
-
export { useTraduction } from
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import "@intlayer/core";
|
|
11
|
-
import "react";
|
|
12
|
-
import "../useIntlayerBase.js";
|
|
13
|
-
import "intlayer";
|
|
1
|
+
export { getLocaleTranslation as getLocaleContent } from './getLocaleTranslation.js';
|
|
2
|
+
export { useTraduction } from './useTraduction.js';
|
|
3
|
+
export { LocaleServerContext, LocaleServerContextProvider, locale } from './LocaleServerContextProvider.js';
|
|
4
|
+
export { useIntlayer } from './useIntlayer.js';
|
|
5
|
+
import '@intlayer/config/client';
|
|
6
|
+
import '@intlayer/core';
|
|
7
|
+
import 'react';
|
|
8
|
+
import '../useIntlayerBase.js';
|
|
9
|
+
import 'intlayer';
|
|
@@ -10,35 +10,26 @@ 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 serverContext_exports = {};
|
|
39
30
|
__export(serverContext_exports, {
|
|
40
31
|
createServerContext: () => createServerContext,
|
|
41
|
-
getServerContext: () => getServerContext
|
|
32
|
+
getServerContext: () => getServerContext
|
|
42
33
|
});
|
|
43
34
|
module.exports = __toCommonJS(serverContext_exports);
|
|
44
35
|
var import_react = __toESM(require("react"));
|
|
@@ -47,7 +38,7 @@ const createServerContext = (defaultValue) => {
|
|
|
47
38
|
throwInClient();
|
|
48
39
|
const cache = import_react.default.cache ?? cacheFallback;
|
|
49
40
|
const getCache = cache(() => ({
|
|
50
|
-
value: void 0
|
|
41
|
+
value: void 0
|
|
51
42
|
}));
|
|
52
43
|
return {
|
|
53
44
|
Provider: ({ children, value }) => {
|
|
@@ -59,12 +50,16 @@ const createServerContext = (defaultValue) => {
|
|
|
59
50
|
return children(store ? store.value : defaultValue);
|
|
60
51
|
},
|
|
61
52
|
_storage: getCache,
|
|
62
|
-
_defaultValue: defaultValue
|
|
53
|
+
_defaultValue: defaultValue
|
|
63
54
|
};
|
|
64
55
|
};
|
|
65
|
-
const getServerContext = ({
|
|
56
|
+
const getServerContext = ({
|
|
57
|
+
_storage,
|
|
58
|
+
_defaultValue
|
|
59
|
+
}) => {
|
|
66
60
|
const store = _storage();
|
|
67
|
-
if (!store)
|
|
61
|
+
if (!store)
|
|
62
|
+
return _defaultValue;
|
|
68
63
|
return store.value;
|
|
69
64
|
};
|
|
70
65
|
const throwInClient = () => {
|
|
@@ -73,9 +68,8 @@ const throwInClient = () => {
|
|
|
73
68
|
}
|
|
74
69
|
};
|
|
75
70
|
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
-
0 &&
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
//# sourceMappingURL=serverContext.cjs.map
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
createServerContext,
|
|
73
|
+
getServerContext
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=serverContext.cjs.map
|
|
@@ -17,27 +17,19 @@ declare const createServerContext: <T>(defaultValue?: T) => ServerContext<T>;
|
|
|
17
17
|
* @example
|
|
18
18
|
* getServerContext(LocaleServerContext);
|
|
19
19
|
*/
|
|
20
|
-
declare const getServerContext: <T>({
|
|
21
|
-
_storage,
|
|
22
|
-
_defaultValue,
|
|
23
|
-
}: ServerContext<T>) => T | undefined;
|
|
20
|
+
declare const getServerContext: <T>({ _storage, _defaultValue, }: ServerContext<T>) => T | undefined;
|
|
24
21
|
type ServerContext<T> = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
children:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}) => React.ReactNode;
|
|
37
|
-
_storage: () => {
|
|
38
|
-
value: T | undefined;
|
|
39
|
-
};
|
|
40
|
-
_defaultValue: T | undefined;
|
|
22
|
+
Provider: ({ children, value, }: {
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
value: T;
|
|
25
|
+
}) => React.ReactNode;
|
|
26
|
+
Consumer: ({ children, }: {
|
|
27
|
+
children: (context: T | undefined) => React.ReactNode;
|
|
28
|
+
}) => React.ReactNode;
|
|
29
|
+
_storage: () => {
|
|
30
|
+
value: T | undefined;
|
|
31
|
+
};
|
|
32
|
+
_defaultValue: T | undefined;
|
|
41
33
|
};
|
|
42
34
|
|
|
43
35
|
export { createServerContext, getServerContext };
|
|
@@ -8,37 +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 useIntlayer_exports = {};
|
|
24
20
|
__export(useIntlayer_exports, {
|
|
25
|
-
useIntlayer: () => useIntlayer
|
|
21
|
+
useIntlayer: () => useIntlayer
|
|
26
22
|
});
|
|
27
23
|
module.exports = __toCommonJS(useIntlayer_exports);
|
|
28
|
-
var import_useIntlayerBase = require(
|
|
29
|
-
var import_LocaleServerContextProvider = require(
|
|
30
|
-
var import_serverContext = require(
|
|
24
|
+
var import_useIntlayerBase = require('../useIntlayerBase.cjs');
|
|
25
|
+
var import_LocaleServerContextProvider = require('./LocaleServerContextProvider.cjs');
|
|
26
|
+
var import_serverContext = require('./serverContext.cjs');
|
|
31
27
|
const useIntlayer = (id, locale) => {
|
|
32
|
-
const localeTarget =
|
|
33
|
-
locale ??
|
|
34
|
-
(0, import_serverContext.getServerContext)(
|
|
35
|
-
import_LocaleServerContextProvider.LocaleServerContext
|
|
36
|
-
);
|
|
28
|
+
const localeTarget = locale ?? (0, import_serverContext.getServerContext)(import_LocaleServerContextProvider.LocaleServerContext);
|
|
37
29
|
return (0, import_useIntlayerBase.useIntlayerBase)(id, localeTarget);
|
|
38
30
|
};
|
|
39
31
|
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
-
0 &&
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
//# sourceMappingURL=useIntlayer.cjs.map
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
useIntlayer
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=useIntlayer.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UseIntlayer } from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { UseIntlayer } from '../useIntlayerBase.js';
|
|
2
|
+
import '@intlayer/config/client';
|
|
3
|
+
import 'intlayer';
|
|
4
4
|
|
|
5
5
|
declare const useIntlayer: UseIntlayer;
|
|
6
6
|
|
|
@@ -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
|
-
var import_getTranslation = require(
|
|
29
|
-
var import_LocaleServerContextProvider = require(
|
|
30
|
-
var import_serverContext = require(
|
|
24
|
+
var import_getTranslation = require('../getTranslation.cjs');
|
|
25
|
+
var import_LocaleServerContextProvider = require('./LocaleServerContextProvider.cjs');
|
|
26
|
+
var import_serverContext = require('./serverContext.cjs');
|
|
31
27
|
const useTraduction = (languageContent) => {
|
|
32
|
-
const locale = (0, import_serverContext.getServerContext)(
|
|
33
|
-
import_LocaleServerContextProvider.LocaleServerContext
|
|
34
|
-
);
|
|
28
|
+
const locale = (0, import_serverContext.getServerContext)(import_LocaleServerContextProvider.LocaleServerContext);
|
|
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,7 +1,5 @@
|
|
|
1
|
-
import { LanguageContent } from
|
|
1
|
+
import { LanguageContent } from '@intlayer/core';
|
|
2
2
|
|
|
3
|
-
declare const useTraduction: <Content>(
|
|
4
|
-
languageContent: LanguageContent<Content>
|
|
5
|
-
) => Content;
|
|
3
|
+
declare const useTraduction: <Content>(languageContent: LanguageContent<Content>) => Content;
|
|
6
4
|
|
|
7
5
|
export { useTraduction };
|
|
@@ -10,47 +10,38 @@ 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 useIntlayerBase_exports = {};
|
|
39
30
|
__export(useIntlayerBase_exports, {
|
|
40
|
-
useIntlayerBase: () => useIntlayerBase
|
|
31
|
+
useIntlayerBase: () => useIntlayerBase
|
|
41
32
|
});
|
|
42
33
|
module.exports = __toCommonJS(useIntlayerBase_exports);
|
|
43
|
-
var import_dictionaries_entry = __toESM(
|
|
44
|
-
|
|
45
|
-
);
|
|
46
|
-
var import_processDictionary = require("./processDictionary/index.cjs");
|
|
34
|
+
var import_dictionaries_entry = __toESM(require("@intlayer/dictionaries-entry"));
|
|
35
|
+
var import_processDictionary = require('./processDictionary/index.cjs');
|
|
47
36
|
const useIntlayerBase = (id, locale) => {
|
|
48
37
|
const dictionary = import_dictionaries_entry.default[id];
|
|
49
|
-
return (0, import_processDictionary.processDictionary)(
|
|
38
|
+
return (0, import_processDictionary.processDictionary)(
|
|
39
|
+
dictionary,
|
|
40
|
+
locale
|
|
41
|
+
);
|
|
50
42
|
};
|
|
51
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
-
0 &&
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
//# sourceMappingURL=useIntlayerBase.cjs.map
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
useIntlayerBase
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=useIntlayerBase.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Locales } from
|
|
2
|
-
import { IntlayerDictionaryTypesConnector } from
|
|
1
|
+
import { Locales } from '@intlayer/config/client';
|
|
2
|
+
import { IntlayerDictionaryTypesConnector } from 'intlayer';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.
|
|
@@ -9,15 +9,7 @@ import { IntlayerDictionaryTypesConnector } from "intlayer";
|
|
|
9
9
|
|
|
10
10
|
type StringFallback<T> = T extends never ? string : T;
|
|
11
11
|
type DictionaryKeys = StringFallback<keyof IntlayerDictionaryTypesConnector>;
|
|
12
|
-
type UseIntlayer = <T extends DictionaryKeys>(
|
|
13
|
-
id: T,
|
|
14
|
-
locale?: Locales
|
|
15
|
-
) => IntlayerDictionaryTypesConnector[T];
|
|
12
|
+
type UseIntlayer = <T extends DictionaryKeys>(id: T, locale?: Locales) => IntlayerDictionaryTypesConnector[T];
|
|
16
13
|
declare const useIntlayerBase: UseIntlayer;
|
|
17
14
|
|
|
18
|
-
export {
|
|
19
|
-
type DictionaryKeys,
|
|
20
|
-
type StringFallback,
|
|
21
|
-
type UseIntlayer,
|
|
22
|
-
useIntlayerBase,
|
|
23
|
-
};
|
|
15
|
+
export { type DictionaryKeys, type StringFallback, type UseIntlayer, useIntlayerBase };
|