next-intlayer 3.5.0 → 3.5.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/client/IntlayerClientProvider.cjs +36 -0
- package/dist/cjs/client/IntlayerClientProvider.cjs.map +1 -0
- package/dist/cjs/client/index.cjs +46 -0
- package/dist/cjs/client/index.cjs.map +1 -0
- package/dist/cjs/client/useLocale.cjs +101 -0
- package/dist/cjs/client/useLocale.cjs.map +1 -0
- package/dist/cjs/client/useLocalePageRouter.cjs +100 -0
- package/dist/cjs/client/useLocalePageRouter.cjs.map +1 -0
- package/dist/cjs/generateStaticParams.cjs +31 -0
- package/dist/cjs/generateStaticParams.cjs.map +1 -0
- package/dist/cjs/index.cjs +51 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/middleware/index.cjs +23 -0
- package/dist/cjs/middleware/index.cjs.map +1 -0
- package/dist/cjs/middleware/intlayerMiddleware.cjs +177 -0
- package/dist/cjs/middleware/intlayerMiddleware.cjs.map +1 -0
- package/dist/cjs/middleware/localeDetector.cjs +35 -0
- package/dist/cjs/middleware/localeDetector.cjs.map +1 -0
- package/dist/cjs/server/index.cjs +46 -0
- package/dist/cjs/server/index.cjs.map +1 -0
- package/dist/cjs/server/withIntlayer.cjs +91 -0
- package/dist/cjs/server/withIntlayer.cjs.map +1 -0
- package/dist/cjs/types/NextPage.cjs +17 -0
- package/dist/cjs/types/NextPage.cjs.map +1 -0
- package/dist/cjs/types/index.cjs +17 -0
- package/dist/cjs/types/index.cjs.map +1 -0
- package/dist/esm/client/IntlayerClientProvider.mjs +12 -0
- package/dist/esm/client/IntlayerClientProvider.mjs.map +1 -0
- package/dist/esm/client/index.mjs +23 -0
- package/dist/esm/client/index.mjs.map +1 -0
- package/dist/esm/client/useLocale.mjs +77 -0
- package/dist/esm/client/useLocale.mjs.map +1 -0
- package/dist/esm/client/useLocalePageRouter.mjs +76 -0
- package/dist/esm/client/useLocalePageRouter.mjs.map +1 -0
- package/dist/esm/generateStaticParams.mjs +7 -0
- package/dist/esm/generateStaticParams.mjs.map +1 -0
- package/dist/esm/index.mjs +29 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/middleware/index.mjs +2 -0
- package/dist/esm/middleware/index.mjs.map +1 -0
- package/dist/esm/middleware/intlayerMiddleware.mjs +155 -0
- package/dist/esm/middleware/intlayerMiddleware.mjs.map +1 -0
- package/dist/esm/middleware/localeDetector.mjs +11 -0
- package/dist/esm/middleware/localeDetector.mjs.map +1 -0
- package/dist/esm/server/index.mjs +23 -0
- package/dist/esm/server/index.mjs.map +1 -0
- package/dist/esm/server/withIntlayer.mjs +67 -0
- package/dist/esm/server/withIntlayer.mjs.map +1 -0
- package/dist/esm/types/NextPage.mjs +1 -0
- package/dist/esm/types/NextPage.mjs.map +1 -0
- package/dist/esm/types/index.mjs +1 -0
- package/dist/esm/types/index.mjs.map +1 -0
- package/dist/types/client/IntlayerClientProvider.d.ts +5 -0
- package/dist/types/client/IntlayerClientProvider.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +5 -0
- package/dist/types/client/index.d.ts.map +1 -0
- package/dist/types/client/useLocale.d.ts +10 -0
- package/dist/types/client/useLocale.d.ts.map +1 -0
- package/dist/types/client/useLocalePageRouter.d.ts +10 -0
- package/dist/types/client/useLocalePageRouter.d.ts.map +1 -0
- package/dist/types/generateStaticParams.d.ts +4 -0
- package/dist/types/generateStaticParams.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/middleware/index.d.ts +2 -0
- package/dist/types/middleware/index.d.ts.map +1 -0
- package/dist/types/middleware/intlayerMiddleware.d.ts +26 -0
- package/dist/types/middleware/intlayerMiddleware.d.ts.map +1 -0
- package/dist/types/middleware/localeDetector.d.ts +9 -0
- package/dist/types/middleware/localeDetector.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +3 -0
- package/dist/types/server/index.d.ts.map +1 -0
- package/dist/types/server/withIntlayer.d.ts +15 -0
- package/dist/types/server/withIntlayer.d.ts.map +1 -0
- package/dist/types/types/NextPage.d.ts +20 -0
- package/dist/types/types/NextPage.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/package.json +15 -15
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var localeDetector_exports = {};
|
|
20
|
+
__export(localeDetector_exports, {
|
|
21
|
+
localeDetector: () => localeDetector
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(localeDetector_exports);
|
|
24
|
+
var import_core = require("@intlayer/core");
|
|
25
|
+
const localeDetector = (request) => {
|
|
26
|
+
const negotiatorHeaders = {};
|
|
27
|
+
request.headers.forEach((value, key) => negotiatorHeaders[key] = value);
|
|
28
|
+
const locale = (0, import_core.localeDetector)(negotiatorHeaders);
|
|
29
|
+
return locale;
|
|
30
|
+
};
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
localeDetector
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=localeDetector.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/middleware/localeDetector.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config';\nimport { localeDetector as localeDetectorCore } from '@intlayer/core';\nimport type { NextRequest } from 'next/server.js';\n\n/**\n * Detects the locale from the request headers\n *\n * Headers are provided by the browser and can be used to determine the user's preferred language\n */\nexport const localeDetector = (request: NextRequest): Locales => {\n const negotiatorHeaders: Record<string, string> = {};\n\n request.headers.forEach((value, key) => (negotiatorHeaders[key] = value));\n\n const locale = localeDetectorCore(negotiatorHeaders);\n\n return locale;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAqD;AAQ9C,MAAM,iBAAiB,CAAC,YAAkC;AAC/D,QAAM,oBAA4C,CAAC;AAEnD,UAAQ,QAAQ,QAAQ,CAAC,OAAO,QAAS,kBAAkB,GAAG,IAAI,KAAM;AAExE,QAAM,aAAS,YAAAA,gBAAmB,iBAAiB;AAEnD,SAAO;AACT;","names":["localeDetectorCore"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var server_exports = {};
|
|
20
|
+
__export(server_exports, {
|
|
21
|
+
IntlayerServer: () => import_server.IntlayerServer,
|
|
22
|
+
IntlayerServerProvider: () => import_server.IntlayerServerProvider,
|
|
23
|
+
getLocaleContent: () => import_server.getLocaleContent,
|
|
24
|
+
locale: () => import_server.locale,
|
|
25
|
+
t: () => import_server.t,
|
|
26
|
+
useDictionary: () => import_server.useDictionary,
|
|
27
|
+
useIntlayer: () => import_server.useIntlayer,
|
|
28
|
+
useTraduction: () => import_server.useTraduction,
|
|
29
|
+
withIntlayer: () => import_withIntlayer.withIntlayer
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(server_exports);
|
|
32
|
+
var import_server = require("react-intlayer/server");
|
|
33
|
+
var import_withIntlayer = require('./withIntlayer.cjs');
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
IntlayerServer,
|
|
37
|
+
IntlayerServerProvider,
|
|
38
|
+
getLocaleContent,
|
|
39
|
+
locale,
|
|
40
|
+
t,
|
|
41
|
+
useDictionary,
|
|
42
|
+
useIntlayer,
|
|
43
|
+
useTraduction,
|
|
44
|
+
withIntlayer
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["export {\n getLocaleContent,\n useDictionary,\n useTraduction,\n IntlayerServer,\n IntlayerServerProvider,\n locale,\n useIntlayer,\n t,\n} from 'react-intlayer/server';\nexport { withIntlayer } from './withIntlayer';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBASO;AACP,0BAA6B;","names":[]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var withIntlayer_exports = {};
|
|
20
|
+
__export(withIntlayer_exports, {
|
|
21
|
+
withIntlayer: () => withIntlayer
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(withIntlayer_exports);
|
|
24
|
+
var import_path = require("path");
|
|
25
|
+
var import_config = require("@intlayer/config");
|
|
26
|
+
var import_webpack = require("@intlayer/webpack");
|
|
27
|
+
const withIntlayer = (nextConfig = {}) => {
|
|
28
|
+
if (typeof nextConfig !== "object") nextConfig = {};
|
|
29
|
+
const intlayerConfig = (0, import_config.getConfiguration)();
|
|
30
|
+
const env = (0, import_config.formatEnvVariable)("next");
|
|
31
|
+
const { mainDir, baseDir } = intlayerConfig.content;
|
|
32
|
+
const dictionariesPath = (0, import_path.join)(mainDir, "dictionaries.mjs");
|
|
33
|
+
const relativeDictionariesPath = (0, import_path.relative)(baseDir, dictionariesPath);
|
|
34
|
+
return Object.assign({}, nextConfig, {
|
|
35
|
+
env: { ...nextConfig.env, ...env },
|
|
36
|
+
serverExternalPackages: [
|
|
37
|
+
...nextConfig.serverExternalPackages ?? [],
|
|
38
|
+
"esbuild",
|
|
39
|
+
"module",
|
|
40
|
+
"fs",
|
|
41
|
+
"chokidar",
|
|
42
|
+
"fsevents"
|
|
43
|
+
],
|
|
44
|
+
experimental: {
|
|
45
|
+
...nextConfig.experimental ?? {},
|
|
46
|
+
// Using Intlayer with Turbopack is not supported as long external modules can't be resolved (such as esbuild or fs)
|
|
47
|
+
turbo: {
|
|
48
|
+
...nextConfig.experimental?.turbo ?? {},
|
|
49
|
+
resolveAlias: {
|
|
50
|
+
...nextConfig.experimental?.turbo?.resolveAlias ?? {},
|
|
51
|
+
"@intlayer/dictionaries-entry": (0, import_path.resolve)(relativeDictionariesPath)
|
|
52
|
+
},
|
|
53
|
+
rules: {
|
|
54
|
+
"*.node": {
|
|
55
|
+
as: "*.node",
|
|
56
|
+
loaders: ["node-loader"]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
webpack: (config, options) => {
|
|
62
|
+
if (nextConfig.webpack) {
|
|
63
|
+
config = nextConfig.webpack(config, options);
|
|
64
|
+
}
|
|
65
|
+
config.resolve.alias["@intlayer/dictionaries-entry"] = (0, import_path.resolve)(
|
|
66
|
+
relativeDictionariesPath
|
|
67
|
+
);
|
|
68
|
+
config.externals.push({
|
|
69
|
+
esbuild: "esbuild",
|
|
70
|
+
module: "module",
|
|
71
|
+
fs: "fs",
|
|
72
|
+
chokidar: "chokidar",
|
|
73
|
+
fsevents: "fsevents"
|
|
74
|
+
});
|
|
75
|
+
config.module.rules.push({
|
|
76
|
+
test: /\.node$/,
|
|
77
|
+
loader: "node-loader"
|
|
78
|
+
});
|
|
79
|
+
const { isServer, nextRuntime } = options;
|
|
80
|
+
if (isServer && nextRuntime === "nodejs") {
|
|
81
|
+
config.plugins.push(new import_webpack.IntLayerPlugin());
|
|
82
|
+
}
|
|
83
|
+
return config;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {
|
|
89
|
+
withIntlayer
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=withIntlayer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { resolve, relative, join } from 'path';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\nimport { IntLayerPlugin } from '@intlayer/webpack';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\n\ntype WebpackParams = Parameters<NextJsWebpackConfig>;\n\n/**\n * A Next.js plugin that adds the intlayer configuration to the webpack configuration\n * and sets the environment variables\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayer(nextConfig)\n * ```\n *\n */\nexport const withIntlayer = (\n nextConfig: Partial<NextConfig> = {}\n): Partial<NextConfig> => {\n if (typeof nextConfig !== 'object') nextConfig = {};\n\n const intlayerConfig = getConfiguration();\n\n // Set all configuration values as environment variables\n const env = formatEnvVariable('next');\n\n const { mainDir, baseDir } = intlayerConfig.content;\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n return Object.assign({}, nextConfig, {\n env: { ...nextConfig.env, ...env },\n\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages ?? []),\n 'esbuild',\n 'module',\n 'fs',\n 'chokidar',\n 'fsevents',\n ],\n\n experimental: {\n ...(nextConfig.experimental ?? {}),\n // Using Intlayer with Turbopack is not supported as long external modules can't be resolved (such as esbuild or fs)\n turbo: {\n ...(nextConfig.experimental?.turbo ?? {}),\n resolveAlias: {\n ...(nextConfig.experimental?.turbo?.resolveAlias ?? {}),\n '@intlayer/dictionaries-entry': resolve(relativeDictionariesPath),\n },\n\n rules: {\n '*.node': {\n as: '*.node',\n loaders: ['node-loader'],\n },\n },\n },\n },\n\n webpack: (config: WebpackParams['0'], options: WebpackParams[1]) => {\n if (nextConfig.webpack) {\n // Invoke the existing webpack config if it exists\n config = nextConfig.webpack(config, options);\n }\n\n config.resolve.alias['@intlayer/dictionaries-entry'] = resolve(\n relativeDictionariesPath\n );\n\n config.externals.push({\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n chokidar: 'chokidar',\n fsevents: 'fsevents',\n });\n config.module.rules.push({\n test: /\\.node$/,\n loader: 'node-loader',\n });\n\n const { isServer, nextRuntime } = options;\n\n // Apply IntLayerPlugin only on the server-side\n if (isServer && nextRuntime === 'nodejs') {\n config.plugins.push(new IntLayerPlugin());\n }\n\n return config;\n },\n } satisfies Partial<NextConfig>);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwC;AACxC,oBAAoD;AACpD,qBAA+B;AAkBxB,MAAM,eAAe,CAC1B,aAAkC,CAAC,MACX;AACxB,MAAI,OAAO,eAAe,SAAU,cAAa,CAAC;AAElD,QAAM,qBAAiB,gCAAiB;AAGxC,QAAM,UAAM,iCAAkB,MAAM;AAEpC,QAAM,EAAE,SAAS,QAAQ,IAAI,eAAe;AAC5C,QAAM,uBAAmB,kBAAK,SAAS,kBAAkB;AACzD,QAAM,+BAA2B,sBAAS,SAAS,gBAAgB;AAEnE,SAAO,OAAO,OAAO,CAAC,GAAG,YAAY;AAAA,IACnC,KAAK,EAAE,GAAG,WAAW,KAAK,GAAG,IAAI;AAAA,IAEjC,wBAAwB;AAAA,MACtB,GAAI,WAAW,0BAA0B,CAAC;AAAA,MAC1C;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IAEA,cAAc;AAAA,MACZ,GAAI,WAAW,gBAAgB,CAAC;AAAA;AAAA,MAEhC,OAAO;AAAA,QACL,GAAI,WAAW,cAAc,SAAS,CAAC;AAAA,QACvC,cAAc;AAAA,UACZ,GAAI,WAAW,cAAc,OAAO,gBAAgB,CAAC;AAAA,UACrD,oCAAgC,qBAAQ,wBAAwB;AAAA,QAClE;AAAA,QAEA,OAAO;AAAA,UACL,UAAU;AAAA,YACR,IAAI;AAAA,YACJ,SAAS,CAAC,aAAa;AAAA,UACzB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IAEA,SAAS,CAAC,QAA4B,YAA8B;AAClE,UAAI,WAAW,SAAS;AAEtB,iBAAS,WAAW,QAAQ,QAAQ,OAAO;AAAA,MAC7C;AAEA,aAAO,QAAQ,MAAM,8BAA8B,QAAI;AAAA,QACrD;AAAA,MACF;AAEA,aAAO,UAAU,KAAK;AAAA,QACpB,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,IAAI;AAAA,QACJ,UAAU;AAAA,QACV,UAAU;AAAA,MACZ,CAAC;AACD,aAAO,OAAO,MAAM,KAAK;AAAA,QACvB,MAAM;AAAA,QACN,QAAQ;AAAA,MACV,CAAC;AAED,YAAM,EAAE,UAAU,YAAY,IAAI;AAGlC,UAAI,YAAY,gBAAgB,UAAU;AACxC,eAAO,QAAQ,KAAK,IAAI,8BAAe,CAAC;AAAA,MAC1C;AAEA,aAAO;AAAA,IACT;AAAA,EACF,CAA+B;AACjC;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var NextPage_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(NextPage_exports);
|
|
17
|
+
//# sourceMappingURL=NextPage.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/types/NextPage.ts"],"sourcesContent":["import type { Locales } from 'intlayer';\nimport type { NextPage } from 'next';\nimport type { PropsWithChildren, ReactNode } from 'react';\n\nexport type LocalParams<T = undefined> = {\n params: { locale: Locales } & T;\n};\n\nexport type LocalPromiseParams<T = undefined> = {\n params: Promise<{ locale: Locales } & T>;\n};\n\nexport type Next14PageIntlayer<T = undefined> = NextPage<LocalParams<T>>;\nexport type Next15PageIntlayer<T = undefined> = (\n props: LocalPromiseParams<T>\n) => ReactNode | Promise<ReactNode>;\nexport type NextPageIntlayer<T = undefined> = Next15PageIntlayer<T>;\n\nexport type Next14LayoutIntlayer<T = undefined> = NextPage<\n PropsWithChildren<LocalParams<T>>\n>;\nexport type Next15LayoutIntlayer<T = undefined> = (\n props: PropsWithChildren<LocalPromiseParams<T>>\n) => ReactNode | Promise<ReactNode>;\nexport type NextLayoutIntlayer<T = undefined> = Next15LayoutIntlayer<T>;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/types/index.ts"],"sourcesContent":["export type {\n LocalParams,\n Next14PageIntlayer,\n Next15PageIntlayer,\n NextPageIntlayer,\n Next14LayoutIntlayer,\n Next15LayoutIntlayer,\n NextLayoutIntlayer,\n LocalPromiseParams,\n} from './NextPage';\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { IntlayerProvider } from "react-intlayer";
|
|
4
|
+
import { useLocale } from './useLocale.mjs';
|
|
5
|
+
const IntlayerClientProvider = (props) => {
|
|
6
|
+
const { setLocale } = useLocale();
|
|
7
|
+
return /* @__PURE__ */ jsx(IntlayerProvider, { setLocale, ...props });
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
IntlayerClientProvider
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=IntlayerClientProvider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/client/IntlayerClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport type { FC } from 'react';\nimport { IntlayerProvider, type IntlayerProviderProps } from 'react-intlayer';\nimport { useLocale } from './useLocale';\n\nexport type IntlayerClientProviderProps = IntlayerProviderProps;\n\nexport const IntlayerClientProvider: FC<IntlayerProviderProps> = (props) => {\n const { setLocale } = useLocale();\n return <IntlayerProvider setLocale={setLocale} {...props} />;\n};\n"],"mappings":";AAUS;AAPT,SAAS,wBAAoD;AAC7D,SAAS,iBAAiB;AAInB,MAAM,yBAAoD,CAAC,UAAU;AAC1E,QAAM,EAAE,UAAU,IAAI,UAAU;AAChC,SAAO,oBAAC,oBAAiB,WAAuB,GAAG,OAAO;AAC5D;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getTranslation,
|
|
3
|
+
IntlayerClientContext,
|
|
4
|
+
useIntlayer,
|
|
5
|
+
useTraduction,
|
|
6
|
+
useLocaleCookie
|
|
7
|
+
} from "react-intlayer";
|
|
8
|
+
import { useLocale } from './useLocale.mjs';
|
|
9
|
+
import { useLocalePageRouter } from './useLocalePageRouter.mjs';
|
|
10
|
+
import {
|
|
11
|
+
IntlayerClientProvider
|
|
12
|
+
} from './IntlayerClientProvider.mjs';
|
|
13
|
+
export {
|
|
14
|
+
IntlayerClientContext,
|
|
15
|
+
IntlayerClientProvider,
|
|
16
|
+
getTranslation,
|
|
17
|
+
useIntlayer,
|
|
18
|
+
useLocale,
|
|
19
|
+
useLocaleCookie,
|
|
20
|
+
useLocalePageRouter,
|
|
21
|
+
useTraduction
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export {\n getTranslation,\n IntlayerClientContext,\n useIntlayer,\n useTraduction,\n useLocaleCookie,\n} from 'react-intlayer';\nexport { useLocale } from './useLocale';\nexport { useLocalePageRouter } from './useLocalePageRouter';\nexport {\n IntlayerClientProvider,\n type IntlayerClientProviderProps,\n} from './IntlayerClientProvider';\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B,SAAS,2BAA2B;AACpC;AAAA,EACE;AAAA,OAEK;","names":[]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { getConfiguration } from "@intlayer/config/client";
|
|
2
|
+
import { usePathname, useRouter } from "next/navigation.js";
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { useLocaleCookie, useLocaleBase } from "react-intlayer";
|
|
5
|
+
const useLocale = () => {
|
|
6
|
+
const {
|
|
7
|
+
/**
|
|
8
|
+
* Prefix default prefix the default locale to the path as other locales.
|
|
9
|
+
*
|
|
10
|
+
* Example with prefixDefault = true and defaultLocale = 'en':
|
|
11
|
+
* path = /en/dashboard or /fr/dashboard
|
|
12
|
+
*
|
|
13
|
+
* Example with prefixDefault = false and defaultLocale = 'en':
|
|
14
|
+
* path = /dashboard or /fr/dashboard
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
prefixDefault
|
|
18
|
+
} = getConfiguration().middleware;
|
|
19
|
+
const { setLocaleCookie } = useLocaleCookie();
|
|
20
|
+
const reactLocaleHook = useLocaleBase();
|
|
21
|
+
const { push, refresh } = useRouter();
|
|
22
|
+
const pathname = usePathname();
|
|
23
|
+
const {
|
|
24
|
+
defaultLocale,
|
|
25
|
+
availableLocales,
|
|
26
|
+
locale: currentLocale,
|
|
27
|
+
setLocale: setLocaleState
|
|
28
|
+
} = reactLocaleHook;
|
|
29
|
+
const getPathWithoutLocale = () => {
|
|
30
|
+
if (
|
|
31
|
+
// If the locale is the default one and the prefixDefault is false, we don't need to add the locale to the path
|
|
32
|
+
!prefixDefault && currentLocale.toString() === defaultLocale.toString()
|
|
33
|
+
) {
|
|
34
|
+
return pathname;
|
|
35
|
+
}
|
|
36
|
+
const slicedPath = pathname.slice(`/${currentLocale}`.length);
|
|
37
|
+
if (slicedPath) {
|
|
38
|
+
return slicedPath;
|
|
39
|
+
}
|
|
40
|
+
return "/";
|
|
41
|
+
};
|
|
42
|
+
const pathWithoutLocale = getPathWithoutLocale();
|
|
43
|
+
const setLocale = useCallback(
|
|
44
|
+
(locale) => {
|
|
45
|
+
if (!availableLocales.includes(locale)) {
|
|
46
|
+
console.error(`Locale ${locale} is not available`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
setLocaleCookie(locale);
|
|
50
|
+
setLocaleState(locale);
|
|
51
|
+
if (!prefixDefault && locale.toString() === defaultLocale.toString()) {
|
|
52
|
+
push(pathWithoutLocale);
|
|
53
|
+
} else {
|
|
54
|
+
push(`/${locale}${pathWithoutLocale}`);
|
|
55
|
+
}
|
|
56
|
+
return refresh();
|
|
57
|
+
},
|
|
58
|
+
[
|
|
59
|
+
currentLocale,
|
|
60
|
+
availableLocales,
|
|
61
|
+
setLocaleCookie,
|
|
62
|
+
setLocaleState,
|
|
63
|
+
prefixDefault,
|
|
64
|
+
defaultLocale,
|
|
65
|
+
pathWithoutLocale
|
|
66
|
+
]
|
|
67
|
+
);
|
|
68
|
+
return {
|
|
69
|
+
...reactLocaleHook,
|
|
70
|
+
setLocale,
|
|
71
|
+
pathWithoutLocale
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
useLocale
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=useLocale.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["import { type Locales, getConfiguration } from '@intlayer/config/client';\nimport { usePathname, useRouter } from 'next/navigation.js';\nimport { useCallback } from 'react';\nimport { useLocaleCookie, useLocaleBase } from 'react-intlayer';\n\nexport const useLocale = () => {\n const {\n /**\n * Prefix default prefix the default locale to the path as other locales.\n *\n * Example with prefixDefault = true and defaultLocale = 'en':\n * path = /en/dashboard or /fr/dashboard\n *\n * Example with prefixDefault = false and defaultLocale = 'en':\n * path = /dashboard or /fr/dashboard\n *\n */\n prefixDefault,\n } = getConfiguration().middleware;\n const { setLocaleCookie } = useLocaleCookie();\n const reactLocaleHook = useLocaleBase();\n const { push, refresh } = useRouter();\n const pathname = usePathname();\n\n const {\n defaultLocale,\n availableLocales,\n locale: currentLocale,\n setLocale: setLocaleState,\n } = reactLocaleHook;\n\n const getPathWithoutLocale = () => {\n if (\n // If the locale is the default one and the prefixDefault is false, we don't need to add the locale to the path\n !prefixDefault &&\n currentLocale.toString() === defaultLocale.toString()\n ) {\n return pathname;\n }\n\n const slicedPath = pathname.slice(`/${currentLocale}`.length);\n\n // If the path without locale is not empty, we return it\n if (slicedPath) {\n return slicedPath;\n }\n\n // If the path without locale is empty, we return the root path\n return '/';\n };\n\n const pathWithoutLocale = getPathWithoutLocale();\n\n const setLocale = useCallback(\n (locale: Locales) => {\n if (!availableLocales.includes(locale)) {\n console.error(`Locale ${locale} is not available`);\n return;\n }\n\n setLocaleCookie(locale);\n setLocaleState(locale);\n\n if (!prefixDefault && locale.toString() === defaultLocale.toString()) {\n push(pathWithoutLocale);\n } else {\n push(`/${locale}${pathWithoutLocale}`);\n }\n\n return refresh();\n },\n [\n currentLocale,\n availableLocales,\n setLocaleCookie,\n setLocaleState,\n prefixDefault,\n defaultLocale,\n pathWithoutLocale,\n ]\n );\n\n return {\n ...reactLocaleHook,\n setLocale,\n pathWithoutLocale,\n };\n};\n"],"mappings":"AAAA,SAAuB,wBAAwB;AAC/C,SAAS,aAAa,iBAAiB;AACvC,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB,qBAAqB;AAExC,MAAM,YAAY,MAAM;AAC7B,QAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAWJ;AAAA,EACF,IAAI,iBAAiB,EAAE;AACvB,QAAM,EAAE,gBAAgB,IAAI,gBAAgB;AAC5C,QAAM,kBAAkB,cAAc;AACtC,QAAM,EAAE,MAAM,QAAQ,IAAI,UAAU;AACpC,QAAM,WAAW,YAAY;AAE7B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,WAAW;AAAA,EACb,IAAI;AAEJ,QAAM,uBAAuB,MAAM;AACjC;AAAA;AAAA,MAEE,CAAC,iBACD,cAAc,SAAS,MAAM,cAAc,SAAS;AAAA,MACpD;AACA,aAAO;AAAA,IACT;AAEA,UAAM,aAAa,SAAS,MAAM,IAAI,aAAa,GAAG,MAAM;AAG5D,QAAI,YAAY;AACd,aAAO;AAAA,IACT;AAGA,WAAO;AAAA,EACT;AAEA,QAAM,oBAAoB,qBAAqB;AAE/C,QAAM,YAAY;AAAA,IAChB,CAAC,WAAoB;AACnB,UAAI,CAAC,iBAAiB,SAAS,MAAM,GAAG;AACtC,gBAAQ,MAAM,UAAU,MAAM,mBAAmB;AACjD;AAAA,MACF;AAEA,sBAAgB,MAAM;AACtB,qBAAe,MAAM;AAErB,UAAI,CAAC,iBAAiB,OAAO,SAAS,MAAM,cAAc,SAAS,GAAG;AACpE,aAAK,iBAAiB;AAAA,MACxB,OAAO;AACL,aAAK,IAAI,MAAM,GAAG,iBAAiB,EAAE;AAAA,MACvC;AAEA,aAAO,QAAQ;AAAA,IACjB;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { getConfiguration } from "@intlayer/config/client";
|
|
2
|
+
import { useRouter } from "next/router.js";
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { useLocaleCookie, useLocaleBase } from "react-intlayer";
|
|
5
|
+
const useLocalePageRouter = () => {
|
|
6
|
+
const {
|
|
7
|
+
/**
|
|
8
|
+
* Prefix default prefix the default locale to the path as other locales.
|
|
9
|
+
*
|
|
10
|
+
* Example with prefixDefault = true and defaultLocale = 'en':
|
|
11
|
+
* path = /en/dashboard or /fr/dashboard
|
|
12
|
+
*
|
|
13
|
+
* Example with prefixDefault = false and defaultLocale = 'en':
|
|
14
|
+
* path = /dashboard or /fr/dashboard
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
prefixDefault
|
|
18
|
+
} = getConfiguration().middleware;
|
|
19
|
+
const { setLocaleCookie } = useLocaleCookie();
|
|
20
|
+
const reactLocaleHook = useLocaleBase();
|
|
21
|
+
const { push, pathname, reload } = useRouter();
|
|
22
|
+
const {
|
|
23
|
+
defaultLocale,
|
|
24
|
+
availableLocales,
|
|
25
|
+
locale: currentLocale,
|
|
26
|
+
setLocale: setLocaleState
|
|
27
|
+
} = reactLocaleHook;
|
|
28
|
+
const getPathWithoutLocale = () => {
|
|
29
|
+
if (
|
|
30
|
+
// If the locale is the default one and the prefixDefault is false, we don't need to add the locale to the path
|
|
31
|
+
!prefixDefault && currentLocale.toString() === defaultLocale.toString()
|
|
32
|
+
) {
|
|
33
|
+
return pathname;
|
|
34
|
+
}
|
|
35
|
+
const slicedPath = pathname.slice(`/${currentLocale}`.length);
|
|
36
|
+
if (slicedPath) {
|
|
37
|
+
return slicedPath;
|
|
38
|
+
}
|
|
39
|
+
return "/";
|
|
40
|
+
};
|
|
41
|
+
const pathWithoutLocale = getPathWithoutLocale();
|
|
42
|
+
const setLocale = useCallback(
|
|
43
|
+
(locale) => {
|
|
44
|
+
if (!availableLocales.includes(locale)) {
|
|
45
|
+
console.error(`Locale ${locale} is not available`);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
setLocaleCookie(locale);
|
|
49
|
+
setLocaleState(locale);
|
|
50
|
+
if (!prefixDefault && locale.toString() === defaultLocale.toString()) {
|
|
51
|
+
push(pathWithoutLocale);
|
|
52
|
+
} else {
|
|
53
|
+
push(`/${locale}${pathWithoutLocale}`);
|
|
54
|
+
}
|
|
55
|
+
return reload();
|
|
56
|
+
},
|
|
57
|
+
[
|
|
58
|
+
currentLocale,
|
|
59
|
+
availableLocales,
|
|
60
|
+
setLocaleCookie,
|
|
61
|
+
setLocaleState,
|
|
62
|
+
prefixDefault,
|
|
63
|
+
defaultLocale,
|
|
64
|
+
pathWithoutLocale
|
|
65
|
+
]
|
|
66
|
+
);
|
|
67
|
+
return {
|
|
68
|
+
...reactLocaleHook,
|
|
69
|
+
setLocale,
|
|
70
|
+
pathWithoutLocale
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export {
|
|
74
|
+
useLocalePageRouter
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=useLocalePageRouter.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/client/useLocalePageRouter.ts"],"sourcesContent":["import { type Locales, getConfiguration } from '@intlayer/config/client';\nimport { useRouter } from 'next/router.js';\nimport { useCallback } from 'react';\nimport { useLocaleCookie, useLocaleBase } from 'react-intlayer';\n\nexport const useLocalePageRouter = () => {\n const {\n /**\n * Prefix default prefix the default locale to the path as other locales.\n *\n * Example with prefixDefault = true and defaultLocale = 'en':\n * path = /en/dashboard or /fr/dashboard\n *\n * Example with prefixDefault = false and defaultLocale = 'en':\n * path = /dashboard or /fr/dashboard\n *\n */\n prefixDefault,\n } = getConfiguration().middleware;\n const { setLocaleCookie } = useLocaleCookie();\n const reactLocaleHook = useLocaleBase();\n const { push, pathname, reload } = useRouter();\n\n const {\n defaultLocale,\n availableLocales,\n locale: currentLocale,\n setLocale: setLocaleState,\n } = reactLocaleHook;\n\n const getPathWithoutLocale = () => {\n if (\n // If the locale is the default one and the prefixDefault is false, we don't need to add the locale to the path\n !prefixDefault &&\n currentLocale.toString() === defaultLocale.toString()\n ) {\n return pathname;\n }\n\n const slicedPath = pathname.slice(`/${currentLocale}`.length);\n\n // If the path without locale is not empty, we return it\n if (slicedPath) {\n return slicedPath;\n }\n\n // If the path without locale is empty, we return the root path\n return '/';\n };\n\n const pathWithoutLocale = getPathWithoutLocale();\n\n const setLocale = useCallback(\n (locale: Locales) => {\n if (!availableLocales.includes(locale)) {\n console.error(`Locale ${locale} is not available`);\n return;\n }\n\n setLocaleCookie(locale);\n setLocaleState(locale);\n\n if (!prefixDefault && locale.toString() === defaultLocale.toString()) {\n push(pathWithoutLocale);\n } else {\n push(`/${locale}${pathWithoutLocale}`);\n }\n\n return reload();\n },\n [\n currentLocale,\n availableLocales,\n setLocaleCookie,\n setLocaleState,\n prefixDefault,\n defaultLocale,\n pathWithoutLocale,\n ]\n );\n\n return {\n ...reactLocaleHook,\n setLocale,\n pathWithoutLocale,\n };\n};\n"],"mappings":"AAAA,SAAuB,wBAAwB;AAC/C,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB,qBAAqB;AAExC,MAAM,sBAAsB,MAAM;AACvC,QAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAWJ;AAAA,EACF,IAAI,iBAAiB,EAAE;AACvB,QAAM,EAAE,gBAAgB,IAAI,gBAAgB;AAC5C,QAAM,kBAAkB,cAAc;AACtC,QAAM,EAAE,MAAM,UAAU,OAAO,IAAI,UAAU;AAE7C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,WAAW;AAAA,EACb,IAAI;AAEJ,QAAM,uBAAuB,MAAM;AACjC;AAAA;AAAA,MAEE,CAAC,iBACD,cAAc,SAAS,MAAM,cAAc,SAAS;AAAA,MACpD;AACA,aAAO;AAAA,IACT;AAEA,UAAM,aAAa,SAAS,MAAM,IAAI,aAAa,GAAG,MAAM;AAG5D,QAAI,YAAY;AACd,aAAO;AAAA,IACT;AAGA,WAAO;AAAA,EACT;AAEA,QAAM,oBAAoB,qBAAqB;AAE/C,QAAM,YAAY;AAAA,IAChB,CAAC,WAAoB;AACnB,UAAI,CAAC,iBAAiB,SAAS,MAAM,GAAG;AACtC,gBAAQ,MAAM,UAAU,MAAM,mBAAmB;AACjD;AAAA,MACF;AAEA,sBAAgB,MAAM;AACtB,qBAAe,MAAM;AAErB,UAAI,CAAC,iBAAiB,OAAO,SAAS,MAAM,cAAc,SAAS,GAAG;AACpE,aAAK,iBAAiB;AAAA,MACxB,OAAO;AACL,aAAK,IAAI,MAAM,GAAG,iBAAiB,EAAE;AAAA,MACvC;AAEA,aAAO,OAAO;AAAA,IAChB;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getConfiguration } from "@intlayer/config/client";
|
|
2
|
+
const { locales } = getConfiguration().internationalization;
|
|
3
|
+
const generateStaticParams = () => locales.map((locale) => ({ locale }));
|
|
4
|
+
export {
|
|
5
|
+
generateStaticParams
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=generateStaticParams.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/generateStaticParams.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config/client';\n\nconst { locales } = getConfiguration().internationalization;\n\nexport const generateStaticParams = () => locales.map((locale) => ({ locale }));\n"],"mappings":"AAAA,SAAS,wBAAwB;AAEjC,MAAM,EAAE,QAAQ,IAAI,iBAAiB,EAAE;AAEhC,MAAM,uBAAuB,MAAM,QAAQ,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE;","names":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getTranslation,
|
|
3
|
+
IntlayerClientContext,
|
|
4
|
+
useIntlayer,
|
|
5
|
+
useTraduction,
|
|
6
|
+
useDictionary,
|
|
7
|
+
useLocaleCookie,
|
|
8
|
+
t
|
|
9
|
+
} from "react-intlayer";
|
|
10
|
+
import { generateStaticParams } from './generateStaticParams.mjs';
|
|
11
|
+
import {
|
|
12
|
+
useLocale,
|
|
13
|
+
useLocalePageRouter,
|
|
14
|
+
IntlayerClientProvider
|
|
15
|
+
} from './client/index.mjs';
|
|
16
|
+
export {
|
|
17
|
+
IntlayerClientContext,
|
|
18
|
+
IntlayerClientProvider,
|
|
19
|
+
generateStaticParams,
|
|
20
|
+
getTranslation,
|
|
21
|
+
t,
|
|
22
|
+
useDictionary,
|
|
23
|
+
useIntlayer,
|
|
24
|
+
useLocale,
|
|
25
|
+
useLocaleCookie,
|
|
26
|
+
useLocalePageRouter,
|
|
27
|
+
useTraduction
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export {\n getTranslation,\n IntlayerClientContext,\n useIntlayer,\n useTraduction,\n useDictionary,\n useLocaleCookie,\n type IntlayerNode,\n t,\n} from 'react-intlayer';\nexport { generateStaticParams } from './generateStaticParams';\nexport type {\n LocalParams,\n LocalPromiseParams,\n Next14PageIntlayer,\n Next15PageIntlayer,\n NextPageIntlayer,\n Next14LayoutIntlayer,\n Next15LayoutIntlayer,\n NextLayoutIntlayer,\n} from './types/index';\nexport {\n useLocale,\n useLocalePageRouter,\n IntlayerClientProvider,\n type IntlayerClientProviderProps,\n} from './client/index';\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AACP,SAAS,4BAA4B;AAWrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/middleware/index.ts"],"sourcesContent":["export * from './intlayerMiddleware';\n"],"mappings":"AAAA,cAAc;","names":[]}
|