next-intlayer 5.0.1 → 5.0.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/client/useLocale.cjs.map +1 -1
- package/dist/esm/client/useLocale.mjs.map +1 -1
- package/dist/types/client/useLocale.d.ts +6 -6
- package/dist/types/client/useLocale.d.ts.map +1 -1
- package/dist/types/client/useLocalePageRouter.d.ts +5 -5
- package/dist/types/client/useLocalePageRouter.d.ts.map +1 -1
- package/package.json +16 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["'use client';\n\nimport { type
|
|
1
|
+
{"version":3,"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["'use client';\n\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { getLocalizedUrl, getPathWithoutLocale } from '@intlayer/core';\nimport { usePathname, useRouter } from 'next/navigation.js';\nimport { useCallback, useMemo } from 'react';\nimport { useLocale as useLocaleReact } from 'react-intlayer';\n\nexport const useLocale = () => {\n const { push, refresh } = useRouter();\n const pathname = usePathname();\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 refresh();\n },\n [refresh, pathWithoutLocale]\n );\n\n const reactLocaleHook = useLocaleReact({\n onLocaleChange: redirectionFunction,\n });\n\n return {\n ...reactLocaleHook,\n pathWithoutLocale,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAsD;AACtD,wBAAuC;AACvC,mBAAqC;AACrC,4BAA4C;AAErC,MAAM,YAAY,MAAM;AAC7B,QAAM,EAAE,MAAM,QAAQ,QAAI,6BAAU;AACpC,QAAM,eAAW,+BAAY;AAC7B,QAAM,wBAAoB;AAAA,IACxB,UAAM,kCAAqB,QAAQ;AAAA,IACnC,CAAC,QAAQ;AAAA,EACX;AAEA,QAAM,0BAAsB;AAAA,IAC1B,CAAC,WAA0B;AACzB,YAAM,qBAAiB,6BAAgB,mBAAmB,MAAM;AAEhE,WAAK,cAAc;AAEnB,aAAO,QAAQ;AAAA,IACjB;AAAA,IACA,CAAC,SAAS,iBAAiB;AAAA,EAC7B;AAEA,QAAM,sBAAkB,sBAAAA,WAAe;AAAA,IACrC,gBAAgB;AAAA,EAClB,CAAC;AAED,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,EACF;AACF;","names":["useLocaleReact"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["'use client';\n\nimport { type
|
|
1
|
+
{"version":3,"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["'use client';\n\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { getLocalizedUrl, getPathWithoutLocale } from '@intlayer/core';\nimport { usePathname, useRouter } from 'next/navigation.js';\nimport { useCallback, useMemo } from 'react';\nimport { useLocale as useLocaleReact } from 'react-intlayer';\n\nexport const useLocale = () => {\n const { push, refresh } = useRouter();\n const pathname = usePathname();\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 refresh();\n },\n [refresh, pathWithoutLocale]\n );\n\n const reactLocaleHook = useLocaleReact({\n onLocaleChange: redirectionFunction,\n });\n\n return {\n ...reactLocaleHook,\n pathWithoutLocale,\n };\n};\n"],"mappings":";AAGA,SAAS,iBAAiB,4BAA4B;AACtD,SAAS,aAAa,iBAAiB;AACvC,SAAS,aAAa,eAAe;AACrC,SAAS,aAAa,sBAAsB;AAErC,MAAM,YAAY,MAAM;AAC7B,QAAM,EAAE,MAAM,QAAQ,IAAI,UAAU;AACpC,QAAM,WAAW,YAAY;AAC7B,QAAM,oBAAoB;AAAA,IACxB,MAAM,qBAAqB,QAAQ;AAAA,IACnC,CAAC,QAAQ;AAAA,EACX;AAEA,QAAM,sBAAsB;AAAA,IAC1B,CAAC,WAA0B;AACzB,YAAM,iBAAiB,gBAAgB,mBAAmB,MAAM;AAEhE,WAAK,cAAc;AAEnB,aAAO,QAAQ;AAAA,IACjB;AAAA,IACA,CAAC,SAAS,iBAAiB;AAAA,EAC7B;AAEA,QAAM,kBAAkB,eAAe;AAAA,IACrC,gBAAgB;AAAA,EAClB,CAAC;AAED,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type LocalesValues } from '@intlayer/config/client';
|
|
2
2
|
export declare const useLocale: () => {
|
|
3
3
|
pathWithoutLocale: string;
|
|
4
|
-
locale:
|
|
5
|
-
defaultLocale: Locales;
|
|
6
|
-
availableLocales: Locales[];
|
|
7
|
-
localeList: Locales[];
|
|
8
|
-
setLocale: (locale:
|
|
4
|
+
locale: LocalesValues;
|
|
5
|
+
defaultLocale: import("intlayer").Locales;
|
|
6
|
+
availableLocales: import("intlayer").Locales[];
|
|
7
|
+
localeList: import("intlayer").Locales[];
|
|
8
|
+
setLocale: (locale: LocalesValues) => void;
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=useLocale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../../src/client/useLocale.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../../src/client/useLocale.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAM7D,eAAO,MAAM,SAAS;;;0BAClB,UAAU;6BACD,UAAU;uBACG,UAAS;;CAwBlC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type Locales } from '@intlayer/config/client';
|
|
2
2
|
export declare const useLocalePageRouter: () => {
|
|
3
3
|
pathWithoutLocale: string;
|
|
4
|
-
locale: "
|
|
5
|
-
defaultLocale: Locales;
|
|
6
|
-
availableLocales: Locales[];
|
|
7
|
-
localeList: Locales[];
|
|
8
|
-
setLocale: (locale:
|
|
4
|
+
locale: import("intlayer").LocalesValues;
|
|
5
|
+
defaultLocale: import("intlayer").Locales;
|
|
6
|
+
availableLocales: import("intlayer").Locales[];
|
|
7
|
+
localeList: import("intlayer").Locales[];
|
|
8
|
+
setLocale: (locale: import("intlayer").LocalesValues) => void;
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=useLocalePageRouter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocalePageRouter.d.ts","sourceRoot":"","sources":["../../../src/client/useLocalePageRouter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAMvD,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"useLocalePageRouter.d.ts","sourceRoot":"","sources":["../../../src/client/useLocalePageRouter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAMvD,eAAO,MAAM,mBAAmB;;;0BACT,UAAU;6BACV,UAAU;uBACD,UAChC;;CAsBC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intlayer",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Simplify internationalization i18n in Next.js with context providers, hooks, locale detection, and multilingual content integration.",
|
|
6
6
|
"keywords": [
|
|
@@ -67,12 +67,12 @@
|
|
|
67
67
|
],
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"node-loader": "^2.1.0",
|
|
70
|
-
"@intlayer/
|
|
71
|
-
"@intlayer/
|
|
72
|
-
"@intlayer/
|
|
73
|
-
"
|
|
74
|
-
"@intlayer/
|
|
75
|
-
"
|
|
70
|
+
"@intlayer/chokidar": "5.0.3",
|
|
71
|
+
"@intlayer/config": "5.0.3",
|
|
72
|
+
"@intlayer/dictionaries-entry": "5.0.3",
|
|
73
|
+
"@intlayer/core": "5.0.3",
|
|
74
|
+
"@intlayer/webpack": "5.0.3",
|
|
75
|
+
"react-intlayer": "5.0.3"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@types/node": "^22.10.6",
|
|
@@ -85,21 +85,21 @@
|
|
|
85
85
|
"tsc-alias": "^1.8.10",
|
|
86
86
|
"tsup": "^8.3.5",
|
|
87
87
|
"typescript": "^5.7.3",
|
|
88
|
-
"intlayer": "5.0.1",
|
|
89
|
-
"@utils/tsup-config": "1.0.4",
|
|
90
88
|
"@utils/eslint-config": "1.0.4",
|
|
91
89
|
"@utils/ts-config": "1.0.4",
|
|
92
|
-
"@utils/ts-config-types": "1.0.4"
|
|
90
|
+
"@utils/ts-config-types": "1.0.4",
|
|
91
|
+
"@utils/tsup-config": "1.0.4",
|
|
92
|
+
"intlayer": "5.0.3"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
95
|
"next": ">=14.0.0",
|
|
96
96
|
"react": ">=16.0.0",
|
|
97
|
-
"@intlayer/config": "5.0.
|
|
98
|
-
"@intlayer/core": "5.0.
|
|
99
|
-
"@intlayer/dictionaries-entry": "5.0.
|
|
100
|
-
"
|
|
101
|
-
"intlayer": "5.0.
|
|
102
|
-
"
|
|
97
|
+
"@intlayer/config": "5.0.3",
|
|
98
|
+
"@intlayer/core": "5.0.3",
|
|
99
|
+
"@intlayer/dictionaries-entry": "5.0.3",
|
|
100
|
+
"@intlayer/webpack": "5.0.3",
|
|
101
|
+
"intlayer": "5.0.3",
|
|
102
|
+
"react-intlayer": "^5.0.3"
|
|
103
103
|
},
|
|
104
104
|
"engines": {
|
|
105
105
|
"node": ">=14.18"
|