next-intlayer 6.1.6 → 7.0.0-canary.3
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/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/cjs/client/IntlayerClientProvider.cjs +19 -33
- package/dist/cjs/client/IntlayerClientProvider.cjs.map +1 -1
- package/dist/cjs/client/format/index.cjs +50 -41
- package/dist/cjs/client/index.cjs +7 -35
- package/dist/cjs/client/useLocale.cjs +39 -54
- package/dist/cjs/client/useLocale.cjs.map +1 -1
- package/dist/cjs/client/useLocalePageRouter.cjs +26 -52
- package/dist/cjs/client/useLocalePageRouter.cjs.map +1 -1
- package/dist/cjs/generateStaticParams.cjs +9 -39
- package/dist/cjs/generateStaticParams.cjs.map +1 -1
- package/dist/cjs/index.cjs +102 -57
- package/dist/cjs/middleware/index.cjs +7 -27
- package/dist/cjs/middleware/intlayerMiddleware.cjs +206 -188
- package/dist/cjs/middleware/intlayerMiddleware.cjs.map +1 -1
- package/dist/cjs/middleware/localeDetector.cjs +18 -32
- package/dist/cjs/middleware/localeDetector.cjs.map +1 -1
- package/dist/cjs/middleware/multipleMiddlewares.cjs +55 -67
- package/dist/cjs/middleware/multipleMiddlewares.cjs.map +1 -1
- package/dist/cjs/proxy/index.cjs +9 -0
- package/dist/cjs/proxy/intlayerProxy.cjs +252 -0
- package/dist/cjs/proxy/intlayerProxy.cjs.map +1 -0
- package/dist/cjs/proxy/localeDetector.cjs +21 -0
- package/dist/cjs/proxy/localeDetector.cjs.map +1 -0
- package/dist/cjs/proxy/multipleProxies.cjs +60 -0
- package/dist/cjs/proxy/multipleProxies.cjs.map +1 -0
- package/dist/cjs/proxy/multipleProxy.cjs +60 -0
- package/dist/cjs/proxy/multipleProxy.cjs.map +1 -0
- package/dist/cjs/server/compareVersion.cjs +35 -54
- package/dist/cjs/server/compareVersion.cjs.map +1 -1
- package/dist/cjs/server/format/index.cjs +50 -41
- package/dist/cjs/server/getLocale.cjs +31 -53
- package/dist/cjs/server/getLocale.cjs.map +1 -1
- package/dist/cjs/server/index.cjs +69 -53
- package/dist/cjs/server/withIntlayer.cjs +180 -247
- package/dist/cjs/server/withIntlayer.cjs.map +1 -1
- package/dist/cjs/types/NextPage.cjs +0 -17
- package/dist/cjs/types/index.cjs +0 -17
- package/dist/esm/client/IntlayerClientProvider.mjs +15 -8
- package/dist/esm/client/IntlayerClientProvider.mjs.map +1 -1
- package/dist/esm/client/format/index.mjs +3 -21
- package/dist/esm/client/index.mjs +3 -9
- package/dist/esm/client/useLocale.mjs +31 -27
- package/dist/esm/client/useLocale.mjs.map +1 -1
- package/dist/esm/client/useLocalePageRouter.mjs +19 -26
- package/dist/esm/client/useLocalePageRouter.mjs.map +1 -1
- package/dist/esm/generateStaticParams.mjs +5 -3
- package/dist/esm/generateStaticParams.mjs.map +1 -1
- package/dist/esm/index.mjs +6 -34
- package/dist/esm/middleware/index.mjs +5 -4
- package/dist/esm/middleware/intlayerMiddleware.mjs +201 -155
- package/dist/esm/middleware/intlayerMiddleware.mjs.map +1 -1
- package/dist/esm/middleware/localeDetector.mjs +16 -8
- package/dist/esm/middleware/localeDetector.mjs.map +1 -1
- package/dist/esm/middleware/multipleMiddlewares.mjs +53 -45
- package/dist/esm/middleware/multipleMiddlewares.mjs.map +1 -1
- package/dist/esm/proxy/index.mjs +5 -0
- package/dist/esm/proxy/intlayerProxy.mjs +247 -0
- package/dist/esm/proxy/intlayerProxy.mjs.map +1 -0
- package/dist/esm/proxy/localeDetector.mjs +19 -0
- package/dist/esm/proxy/localeDetector.mjs.map +1 -0
- package/dist/esm/proxy/multipleProxies.mjs +57 -0
- package/dist/esm/proxy/multipleProxies.mjs.map +1 -0
- package/dist/esm/proxy/multipleProxy.mjs +57 -0
- package/dist/esm/proxy/multipleProxy.mjs.map +1 -0
- package/dist/esm/server/compareVersion.mjs +34 -30
- package/dist/esm/server/compareVersion.mjs.map +1 -1
- package/dist/esm/server/format/index.mjs +3 -21
- package/dist/esm/server/getLocale.mjs +23 -17
- package/dist/esm/server/getLocale.mjs.map +1 -1
- package/dist/esm/server/index.mjs +4 -28
- package/dist/esm/server/withIntlayer.mjs +165 -214
- package/dist/esm/server/withIntlayer.mjs.map +1 -1
- package/dist/esm/types/NextPage.mjs +0 -1
- package/dist/esm/types/index.mjs +0 -1
- package/dist/types/client/IntlayerClientProvider.d.ts +8 -4
- package/dist/types/client/IntlayerClientProvider.d.ts.map +1 -1
- package/dist/types/client/format/index.d.ts +2 -2
- package/dist/types/client/index.d.ts +4 -4
- package/dist/types/client/useLocale.d.ts +17 -7
- package/dist/types/client/useLocale.d.ts.map +1 -1
- package/dist/types/client/useLocalePageRouter.d.ts +12 -7
- package/dist/types/client/useLocalePageRouter.d.ts.map +1 -1
- package/dist/types/generateStaticParams.d.ts +7 -2
- package/dist/types/generateStaticParams.d.ts.map +1 -1
- package/dist/types/index.d.ts +7 -5
- package/dist/types/middleware/index.d.ts +4 -4
- package/dist/types/middleware/intlayerMiddleware.d.ts +7 -2
- package/dist/types/middleware/intlayerMiddleware.d.ts.map +1 -1
- package/dist/types/middleware/localeDetector.d.ts +8 -3
- package/dist/types/middleware/localeDetector.d.ts.map +1 -1
- package/dist/types/middleware/multipleMiddlewares.d.ts +7 -2
- package/dist/types/middleware/multipleMiddlewares.d.ts.map +1 -1
- package/dist/types/proxy/index.d.ts +4 -0
- package/dist/types/proxy/intlayerProxy.d.ts +55 -0
- package/dist/types/proxy/intlayerProxy.d.ts.map +1 -0
- package/dist/types/proxy/localeDetector.d.ts +14 -0
- package/dist/types/proxy/localeDetector.d.ts.map +1 -0
- package/dist/types/proxy/multipleProxies.d.ts +34 -0
- package/dist/types/proxy/multipleProxies.d.ts.map +1 -0
- package/dist/types/proxy/multipleProxy.d.ts +34 -0
- package/dist/types/proxy/multipleProxy.d.ts.map +1 -0
- package/dist/types/server/compareVersion.d.ts +4 -1
- package/dist/types/server/compareVersion.d.ts.map +1 -1
- package/dist/types/server/format/index.d.ts +2 -2
- package/dist/types/server/getLocale.d.ts +6 -2
- package/dist/types/server/getLocale.d.ts.map +1 -1
- package/dist/types/server/index.d.ts +4 -4
- package/dist/types/server/withIntlayer.d.ts +25 -3
- package/dist/types/server/withIntlayer.d.ts.map +1 -1
- package/dist/types/types/NextPage.d.ts +21 -17
- package/dist/types/types/NextPage.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +2 -2
- package/package.json +52 -51
- package/LICENSE +0 -202
- package/dist/cjs/client/format/index.cjs.map +0 -1
- package/dist/cjs/client/index.cjs.map +0 -1
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/middleware/index.cjs.map +0 -1
- package/dist/cjs/server/format/index.cjs.map +0 -1
- package/dist/cjs/server/getNextVertion.cjs +0 -39
- package/dist/cjs/server/getNextVertion.cjs.map +0 -1
- package/dist/cjs/server/index.cjs.map +0 -1
- package/dist/cjs/types/NextPage.cjs.map +0 -1
- package/dist/cjs/types/index.cjs.map +0 -1
- package/dist/esm/client/format/index.mjs.map +0 -1
- package/dist/esm/client/index.mjs.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/middleware/index.mjs.map +0 -1
- package/dist/esm/server/format/index.mjs.map +0 -1
- package/dist/esm/server/getNextVertion.mjs +0 -15
- package/dist/esm/server/getNextVertion.mjs.map +0 -1
- package/dist/esm/server/index.mjs.map +0 -1
- package/dist/esm/types/NextPage.mjs.map +0 -1
- package/dist/esm/types/index.mjs.map +0 -1
- package/dist/types/client/format/index.d.ts.map +0 -1
- package/dist/types/client/index.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/middleware/index.d.ts.map +0 -1
- package/dist/types/server/format/index.d.ts.map +0 -1
- package/dist/types/server/getNextVertion.d.ts +0 -2
- package/dist/types/server/getNextVertion.d.ts.map +0 -1
- package/dist/types/server/index.d.ts.map +0 -1
- package/dist/types/types/index.d.ts.map +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
exports.__toESM = __toESM;
|
|
@@ -1,36 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var IntlayerClientProvider_exports = {};
|
|
21
|
-
__export(IntlayerClientProvider_exports, {
|
|
22
|
-
IntlayerClientProvider: () => IntlayerClientProvider
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(IntlayerClientProvider_exports);
|
|
25
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
-
var import_react_intlayer = require("react-intlayer");
|
|
27
|
-
var import_useLocale = require('./useLocale.cjs');
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
5
|
+
const require_client_useLocale = require('./useLocale.cjs');
|
|
6
|
+
let react_intlayer = require("react-intlayer");
|
|
7
|
+
react_intlayer = require_rolldown_runtime.__toESM(react_intlayer);
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
10
|
+
|
|
11
|
+
//#region src/client/IntlayerClientProvider.tsx
|
|
28
12
|
const IntlayerClientProvider = (props) => {
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
const { setLocale } = require_client_useLocale.useLocale();
|
|
14
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_intlayer.IntlayerProvider, {
|
|
15
|
+
setLocale,
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
31
18
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.IntlayerClientProvider = IntlayerClientProvider;
|
|
36
22
|
//# sourceMappingURL=IntlayerClientProvider.cjs.map
|
|
@@ -1 +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":"
|
|
1
|
+
{"version":3,"file":"IntlayerClientProvider.cjs","names":["IntlayerClientProvider: FC<IntlayerProviderProps>","useLocale","IntlayerProvider"],"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":";;;;;;;;;;;AAQA,MAAaA,0BAAqD,UAAU;CAC1E,MAAM,EAAE,cAAcC,oCAAW;AACjC,QAAO,2CAACC;EAA4B;EAAW,GAAI;GAAS"}
|
|
@@ -1,43 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var format_exports = {};
|
|
20
|
-
__export(format_exports, {
|
|
21
|
-
useCompact: () => import_format.useCompact,
|
|
22
|
-
useCurrency: () => import_format.useCurrency,
|
|
23
|
-
useDate: () => import_format.useDate,
|
|
24
|
-
useList: () => import_format.useList,
|
|
25
|
-
useNumber: () => import_format.useNumber,
|
|
26
|
-
usePercentage: () => import_format.usePercentage,
|
|
27
|
-
useRelativeTime: () => import_format.useRelativeTime,
|
|
28
|
-
useUnit: () => import_format.useUnit
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let react_intlayer_format = require("react-intlayer/format");
|
|
3
|
+
react_intlayer_format = require_rolldown_runtime.__toESM(react_intlayer_format);
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, 'useCompact', {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function () {
|
|
8
|
+
return react_intlayer_format.useCompact;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, 'useCurrency', {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () {
|
|
14
|
+
return react_intlayer_format.useCurrency;
|
|
15
|
+
}
|
|
29
16
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
useCurrency,
|
|
36
|
-
useDate,
|
|
37
|
-
useList,
|
|
38
|
-
useNumber,
|
|
39
|
-
usePercentage,
|
|
40
|
-
useRelativeTime,
|
|
41
|
-
useUnit
|
|
17
|
+
Object.defineProperty(exports, 'useDate', {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () {
|
|
20
|
+
return react_intlayer_format.useDate;
|
|
21
|
+
}
|
|
42
22
|
});
|
|
43
|
-
|
|
23
|
+
Object.defineProperty(exports, 'useList', {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () {
|
|
26
|
+
return react_intlayer_format.useList;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, 'useNumber', {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return react_intlayer_format.useNumber;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, 'usePercentage', {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () {
|
|
38
|
+
return react_intlayer_format.usePercentage;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(exports, 'useRelativeTime', {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return react_intlayer_format.useRelativeTime;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports, 'useUnit', {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () {
|
|
50
|
+
return react_intlayer_format.useUnit;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
@@ -1,35 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 client_exports = {};
|
|
20
|
-
__export(client_exports, {
|
|
21
|
-
IntlayerClientProvider: () => import_IntlayerClientProvider.IntlayerClientProvider,
|
|
22
|
-
useLocale: () => import_useLocale.useLocale,
|
|
23
|
-
useLocalePageRouter: () => import_useLocalePageRouter.useLocalePageRouter
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(client_exports);
|
|
26
|
-
var import_IntlayerClientProvider = require('./IntlayerClientProvider.cjs');
|
|
27
|
-
var import_useLocale = require('./useLocale.cjs');
|
|
28
|
-
var import_useLocalePageRouter = require('./useLocalePageRouter.cjs');
|
|
29
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
-
0 && (module.exports = {
|
|
31
|
-
IntlayerClientProvider,
|
|
32
|
-
useLocale,
|
|
33
|
-
useLocalePageRouter
|
|
34
|
-
});
|
|
35
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
const require_client_useLocale = require('./useLocale.cjs');
|
|
2
|
+
const require_client_IntlayerClientProvider = require('./IntlayerClientProvider.cjs');
|
|
3
|
+
const require_client_useLocalePageRouter = require('./useLocalePageRouter.cjs');
|
|
4
|
+
|
|
5
|
+
exports.IntlayerClientProvider = require_client_IntlayerClientProvider.IntlayerClientProvider;
|
|
6
|
+
exports.useLocale = require_client_useLocale.useLocale;
|
|
7
|
+
exports.useLocalePageRouter = require_client_useLocalePageRouter.useLocalePageRouter;
|
|
@@ -1,56 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
5
|
+
let react_intlayer = require("react-intlayer");
|
|
6
|
+
react_intlayer = require_rolldown_runtime.__toESM(react_intlayer);
|
|
7
|
+
let __intlayer_core = require("@intlayer/core");
|
|
8
|
+
__intlayer_core = require_rolldown_runtime.__toESM(__intlayer_core);
|
|
9
|
+
let next_navigation_js = require("next/navigation.js");
|
|
10
|
+
next_navigation_js = require_rolldown_runtime.__toESM(next_navigation_js);
|
|
11
|
+
let react = require("react");
|
|
12
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
13
|
+
|
|
14
|
+
//#region src/client/useLocale.ts
|
|
15
|
+
const useLocale = ({ onChange } = {}) => {
|
|
16
|
+
const { replace, push } = (0, next_navigation_js.useRouter)();
|
|
17
|
+
const pathname = (0, next_navigation_js.usePathname)();
|
|
18
|
+
const pathWithoutLocale = (0, react.useMemo)(() => (0, __intlayer_core.getPathWithoutLocale)(pathname), [pathname]);
|
|
19
|
+
return {
|
|
20
|
+
...(0, react_intlayer.useLocale)({ onLocaleChange: (0, react.useCallback)((locale) => {
|
|
21
|
+
if (!onChange) return;
|
|
22
|
+
if (typeof onChange === "function") {
|
|
23
|
+
onChange(locale);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const pathWithLocale = (0, __intlayer_core.getLocalizedUrl)(pathWithoutLocale, locale);
|
|
27
|
+
if (onChange === "replace") replace(pathWithLocale);
|
|
28
|
+
if (onChange === "push") push(pathWithLocale);
|
|
29
|
+
}, [
|
|
30
|
+
replace,
|
|
31
|
+
push,
|
|
32
|
+
pathWithoutLocale,
|
|
33
|
+
onChange
|
|
34
|
+
]) }),
|
|
35
|
+
pathWithoutLocale
|
|
36
|
+
};
|
|
10
37
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var useLocale_exports = {};
|
|
21
|
-
__export(useLocale_exports, {
|
|
22
|
-
useLocale: () => useLocale
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(useLocale_exports);
|
|
25
|
-
var import_core = require("@intlayer/core");
|
|
26
|
-
var import_navigation = require("next/navigation.js");
|
|
27
|
-
var import_react = require("react");
|
|
28
|
-
var import_react_intlayer = require("react-intlayer");
|
|
29
|
-
const useLocale = () => {
|
|
30
|
-
const { push, refresh } = (0, import_navigation.useRouter)();
|
|
31
|
-
const pathname = (0, import_navigation.usePathname)();
|
|
32
|
-
const pathWithoutLocale = (0, import_react.useMemo)(
|
|
33
|
-
() => (0, import_core.getPathWithoutLocale)(pathname),
|
|
34
|
-
[pathname]
|
|
35
|
-
);
|
|
36
|
-
const redirectionFunction = (0, import_react.useCallback)(
|
|
37
|
-
(locale) => {
|
|
38
|
-
const pathWithLocale = (0, import_core.getLocalizedUrl)(pathWithoutLocale, locale);
|
|
39
|
-
push(pathWithLocale);
|
|
40
|
-
return refresh();
|
|
41
|
-
},
|
|
42
|
-
[refresh, pathWithoutLocale]
|
|
43
|
-
);
|
|
44
|
-
const reactLocaleHook = (0, import_react_intlayer.useLocale)({
|
|
45
|
-
onLocaleChange: redirectionFunction
|
|
46
|
-
});
|
|
47
|
-
return {
|
|
48
|
-
...reactLocaleHook,
|
|
49
|
-
pathWithoutLocale
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
-
0 && (module.exports = {
|
|
54
|
-
useLocale
|
|
55
|
-
});
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
exports.useLocale = useLocale;
|
|
56
41
|
//# sourceMappingURL=useLocale.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"file":"useLocale.cjs","names":[],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["'use client';\n\nimport { getLocalizedUrl, getPathWithoutLocale } from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { usePathname, useRouter } from 'next/navigation.js';\nimport { useCallback, useMemo } from 'react';\nimport { useLocale as useLocaleReact } from 'react-intlayer';\n\ntype UseLocaleProps = {\n onChange?: 'replace' | 'push' | ((locale: LocalesValues) => void);\n};\n\nexport const useLocale = ({ onChange }: UseLocaleProps = {}) => {\n const { replace, push } = useRouter();\n const pathname = usePathname();\n const pathWithoutLocale = useMemo(\n () => getPathWithoutLocale(pathname),\n [pathname]\n );\n\n const redirectionFunction = useCallback(\n (locale: LocalesValues) => {\n if (!onChange) return;\n\n if (typeof onChange === 'function') {\n onChange(locale);\n return;\n }\n\n const pathWithLocale = getLocalizedUrl(pathWithoutLocale, locale);\n\n if (onChange === 'replace') {\n replace(pathWithLocale);\n }\n if (onChange === 'push') {\n push(pathWithLocale);\n }\n },\n [replace, push, pathWithoutLocale, onChange]\n );\n\n const reactLocaleHook = useLocaleReact({\n onLocaleChange: redirectionFunction,\n });\n\n return {\n ...reactLocaleHook,\n pathWithoutLocale,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAa,aAAa,EAAE,aAA6B,EAAE,KAAK;CAC9D,MAAM,EAAE,SAAS,4CAAoB;CACrC,MAAM,gDAAwB;CAC9B,MAAM,uFACuB,SAAS,EACpC,CAAC,SAAS,CACX;AA2BD,QAAO;EACL,iCALqC,EACrC,wCArBC,WAA0B;AACzB,OAAI,CAAC,SAAU;AAEf,OAAI,OAAO,aAAa,YAAY;AAClC,aAAS,OAAO;AAChB;;GAGF,MAAM,sDAAiC,mBAAmB,OAAO;AAEjE,OAAI,aAAa,UACf,SAAQ,eAAe;AAEzB,OAAI,aAAa,OACf,MAAK,eAAe;KAGxB;GAAC;GAAS;GAAM;GAAmB;GAAS,CAC7C,EAIA,CAAC;EAIA;EACD"}
|
|
@@ -1,55 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var useLocalePageRouter_exports = {};
|
|
21
|
-
__export(useLocalePageRouter_exports, {
|
|
22
|
-
useLocalePageRouter: () => useLocalePageRouter
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(useLocalePageRouter_exports);
|
|
25
|
-
var import_core = require("@intlayer/core");
|
|
26
|
-
var import_router = require("next/router.js");
|
|
27
|
-
var import_react = require("react");
|
|
28
|
-
var import_react_intlayer = require("react-intlayer");
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
5
|
+
let react_intlayer = require("react-intlayer");
|
|
6
|
+
react_intlayer = require_rolldown_runtime.__toESM(react_intlayer);
|
|
7
|
+
let __intlayer_core = require("@intlayer/core");
|
|
8
|
+
__intlayer_core = require_rolldown_runtime.__toESM(__intlayer_core);
|
|
9
|
+
let react = require("react");
|
|
10
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
11
|
+
let next_router_js = require("next/router.js");
|
|
12
|
+
next_router_js = require_rolldown_runtime.__toESM(next_router_js);
|
|
13
|
+
|
|
14
|
+
//#region src/client/useLocalePageRouter.ts
|
|
29
15
|
const useLocalePageRouter = () => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return reload();
|
|
40
|
-
},
|
|
41
|
-
[pathWithoutLocale]
|
|
42
|
-
);
|
|
43
|
-
const reactLocaleHook = (0, import_react_intlayer.useLocale)({
|
|
44
|
-
onLocaleChange: redirectionFunction
|
|
45
|
-
});
|
|
46
|
-
return {
|
|
47
|
-
...reactLocaleHook,
|
|
48
|
-
pathWithoutLocale
|
|
49
|
-
};
|
|
16
|
+
const { push, pathname, reload } = (0, next_router_js.useRouter)();
|
|
17
|
+
const pathWithoutLocale = (0, react.useMemo)(() => (0, __intlayer_core.getPathWithoutLocale)(pathname), [pathname]);
|
|
18
|
+
return {
|
|
19
|
+
...(0, react_intlayer.useLocale)({ onLocaleChange: (0, react.useCallback)((locale) => {
|
|
20
|
+
push((0, __intlayer_core.getLocalizedUrl)(pathWithoutLocale, locale));
|
|
21
|
+
return reload();
|
|
22
|
+
}, [pathWithoutLocale]) }),
|
|
23
|
+
pathWithoutLocale
|
|
24
|
+
};
|
|
50
25
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
});
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.useLocalePageRouter = useLocalePageRouter;
|
|
55
29
|
//# sourceMappingURL=useLocalePageRouter.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/useLocalePageRouter.ts"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"file":"useLocalePageRouter.cjs","names":[],"sources":["../../../src/client/useLocalePageRouter.ts"],"sourcesContent":["'use client';\n\nimport { getLocalizedUrl, getPathWithoutLocale } from '@intlayer/core';\nimport type { LocalesValues } from '@intlayer/types';\nimport { useRouter } from 'next/router.js';\nimport { useCallback, useMemo } from 'react';\nimport { useLocale as useLocaleReact } from 'react-intlayer';\n\nexport const useLocalePageRouter = () => {\n const { push, pathname, reload } = useRouter();\n const pathWithoutLocale = useMemo(\n () => getPathWithoutLocale(pathname),\n [pathname]\n );\n\n const redirectionFunction = useCallback(\n (locale: LocalesValues) => {\n const pathWithLocale = getLocalizedUrl(pathWithoutLocale, locale);\n\n push(pathWithLocale);\n\n return reload();\n },\n [pathWithoutLocale]\n );\n\n const reactLocaleHook = useLocaleReact({\n onLocaleChange: redirectionFunction,\n });\n\n return {\n ...reactLocaleHook,\n pathWithoutLocale,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;AAQA,MAAa,4BAA4B;CACvC,MAAM,EAAE,MAAM,UAAU,0CAAsB;CAC9C,MAAM,uFACuB,SAAS,EACpC,CAAC,SAAS,CACX;AAiBD,QAAO;EACL,iCALqC,EACrC,wCAXC,WAA0B;AAGzB,6CAFuC,mBAAmB,OAAO,CAE7C;AAEpB,UAAO,QAAQ;KAEjB,CAAC,kBAAkB,CACpB,EAIA,CAAC;EAIA;EACD"}
|
|
@@ -1,41 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var generateStaticParams_exports = {};
|
|
30
|
-
__export(generateStaticParams_exports, {
|
|
31
|
-
generateStaticParams: () => generateStaticParams
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(generateStaticParams_exports);
|
|
34
|
-
var import_built = __toESM(require("@intlayer/config/built"));
|
|
35
|
-
const { locales } = import_built.default.internationalization;
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __intlayer_config_built = require("@intlayer/config/built");
|
|
3
|
+
__intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
|
|
4
|
+
|
|
5
|
+
//#region src/generateStaticParams.ts
|
|
6
|
+
const { locales } = __intlayer_config_built.default.internationalization;
|
|
36
7
|
const generateStaticParams = () => locales.map((locale) => ({ locale }));
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.generateStaticParams = generateStaticParams;
|
|
41
11
|
//# sourceMappingURL=generateStaticParams.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/generateStaticParams.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\n\nconst { locales } = configuration.internationalization;\n\nexport const generateStaticParams = () => locales.map((locale) => ({ locale }));\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"generateStaticParams.cjs","names":["configuration"],"sources":["../../src/generateStaticParams.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\n\nconst { locales } = configuration.internationalization;\n\nexport const generateStaticParams = () => locales.map((locale) => ({ locale }));\n"],"mappings":";;;;;AAEA,MAAM,EAAE,YAAYA,gCAAc;AAElC,MAAa,6BAA6B,QAAQ,KAAK,YAAY,EAAE,QAAQ,EAAE"}
|