next-intl 4.3.8 → 4.3.10
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/esm/development/navigation/react-client/createNavigation.js +8 -1
- package/dist/esm/development/navigation/shared/BaseLink.js +3 -0
- package/dist/esm/production/navigation/react-client/createNavigation.js +1 -1
- package/dist/types/navigation/react-client/createNavigation.d.ts +6 -4
- package/dist/types/navigation/react-server/createNavigation.d.ts +6 -4
- package/dist/types/navigation/shared/createSharedNavigationFns.d.ts +6 -4
- package/package.json +3 -3
|
@@ -39,7 +39,14 @@ function createNavigation(routing) {
|
|
|
39
39
|
} = options || {};
|
|
40
40
|
const pathname = getPathname({
|
|
41
41
|
href,
|
|
42
|
-
locale: nextLocale || curLocale
|
|
42
|
+
locale: nextLocale || curLocale,
|
|
43
|
+
// Always include a prefix when changing locales. Theoretically,
|
|
44
|
+
// this is only necessary for the case described in #2020. However,
|
|
45
|
+
// the full detection is rather expensive, and this behavior is
|
|
46
|
+
// consistent with the `Link` component. The downside is an
|
|
47
|
+
// additional redirect for users in other situations. Locale
|
|
48
|
+
// changes should be rare though, so this might be fine.
|
|
49
|
+
forcePrefix: nextLocale != null || undefined
|
|
43
50
|
});
|
|
44
51
|
const args = [pathname];
|
|
45
52
|
if (Object.keys(rest).length > 0) {
|
|
@@ -21,6 +21,9 @@ function BaseLink({
|
|
|
21
21
|
// `useParams` can be called, but the return type is `null`.
|
|
22
22
|
const pathname = usePathname();
|
|
23
23
|
function onLinkClick(event) {
|
|
24
|
+
// Even though we force a prefix when changing locales,
|
|
25
|
+
// this could be a cache hit of the client-side router,
|
|
26
|
+
// therefore we sync the cookie to ensure it's up to date.
|
|
24
27
|
syncLocaleCookie(localeCookie, pathname, curLocale, locale);
|
|
25
28
|
if (onClick) onClick(event);
|
|
26
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useRouter as e,usePathname as t}from"next/navigation";import{useMemo as r}from"react";import{useLocale as
|
|
1
|
+
import{useRouter as e,usePathname as t}from"next/navigation";import{useMemo as r}from"react";import{useLocale as o}from"use-intl";import n from"../shared/createSharedNavigationFns.js";import a from"../shared/syncLocaleCookie.js";import{getRoute as s}from"../shared/utils.js";import i from"./useBasePathname.js";function c(c){const{Link:u,config:m,getPathname:f,...h}=n(o,c);return{...h,Link:u,usePathname:function(){const e=i(m),t=o();return r((()=>e&&m.pathnames?s(t,e,m.pathnames):e),[t,e])},useRouter:function(){const n=e(),s=o(),i=t();return r((()=>{function e(e){return function(t,r){const{locale:o,...n}=r||{},c=[f({href:t,locale:o||s,forcePrefix:null!=o||void 0})];Object.keys(n).length>0&&c.push(n),a(m.localeCookie,i,s,o),e(...c)}}return{...n,push:e(n.push),replace:e(n.replace),prefetch:e(n.prefetch)}}),[s,i,n])},getPathname:f}}export{c as default};
|
|
@@ -75,12 +75,14 @@ export default function createNavigation<const AppLocales extends Locales, const
|
|
|
75
75
|
results?: number | undefined | undefined;
|
|
76
76
|
security?: string | undefined | undefined;
|
|
77
77
|
unselectable?: "on" | "off" | undefined | undefined;
|
|
78
|
-
popover?: "" | "auto" | "manual" | undefined | undefined;
|
|
78
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined | undefined;
|
|
79
79
|
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
80
80
|
popoverTarget?: string | undefined | undefined;
|
|
81
81
|
inert?: boolean | undefined | undefined;
|
|
82
82
|
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
83
83
|
is?: string | undefined | undefined;
|
|
84
|
+
exportparts?: string | undefined | undefined;
|
|
85
|
+
part?: string | undefined | undefined;
|
|
84
86
|
tw?: string | undefined;
|
|
85
87
|
"aria-activedescendant"?: string | undefined | undefined;
|
|
86
88
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
@@ -156,7 +158,7 @@ export default function createNavigation<const AppLocales extends Locales, const
|
|
|
156
158
|
onBlurCapture?: import("react").FocusEventHandler<HTMLAnchorElement> | undefined;
|
|
157
159
|
onChange?: import("react").FormEventHandler<HTMLAnchorElement> | undefined;
|
|
158
160
|
onChangeCapture?: import("react").FormEventHandler<HTMLAnchorElement> | undefined;
|
|
159
|
-
onBeforeInput?: import("react").
|
|
161
|
+
onBeforeInput?: import("react").InputEventHandler<HTMLAnchorElement> | undefined;
|
|
160
162
|
onBeforeInputCapture?: import("react").FormEventHandler<HTMLAnchorElement> | undefined;
|
|
161
163
|
onInput?: import("react").FormEventHandler<HTMLAnchorElement> | undefined;
|
|
162
164
|
onInputCapture?: import("react").FormEventHandler<HTMLAnchorElement> | undefined;
|
|
@@ -205,8 +207,6 @@ export default function createNavigation<const AppLocales extends Locales, const
|
|
|
205
207
|
onProgressCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
206
208
|
onRateChange?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
207
209
|
onRateChangeCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
208
|
-
onResize?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
209
|
-
onResizeCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
210
210
|
onSeeked?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
211
211
|
onSeekedCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
212
212
|
onSeeking?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
@@ -284,6 +284,8 @@ export default function createNavigation<const AppLocales extends Locales, const
|
|
|
284
284
|
onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
285
285
|
onScroll?: import("react").UIEventHandler<HTMLAnchorElement> | undefined;
|
|
286
286
|
onScrollCapture?: import("react").UIEventHandler<HTMLAnchorElement> | undefined;
|
|
287
|
+
onScrollEnd?: import("react").UIEventHandler<HTMLAnchorElement> | undefined;
|
|
288
|
+
onScrollEndCapture?: import("react").UIEventHandler<HTMLAnchorElement> | undefined;
|
|
287
289
|
onWheel?: import("react").WheelEventHandler<HTMLAnchorElement> | undefined;
|
|
288
290
|
onWheelCapture?: import("react").WheelEventHandler<HTMLAnchorElement> | undefined;
|
|
289
291
|
onAnimationStart?: import("react").AnimationEventHandler<HTMLAnchorElement> | undefined;
|
|
@@ -76,12 +76,14 @@ export default function createNavigation<const AppLocales extends Locales, const
|
|
|
76
76
|
results?: number | undefined | undefined;
|
|
77
77
|
security?: string | undefined | undefined;
|
|
78
78
|
unselectable?: "on" | "off" | undefined | undefined;
|
|
79
|
-
popover?: "" | "auto" | "manual" | undefined | undefined;
|
|
79
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined | undefined;
|
|
80
80
|
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
81
81
|
popoverTarget?: string | undefined | undefined;
|
|
82
82
|
inert?: boolean | undefined | undefined;
|
|
83
83
|
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
84
84
|
is?: string | undefined | undefined;
|
|
85
|
+
exportparts?: string | undefined | undefined;
|
|
86
|
+
part?: string | undefined | undefined;
|
|
85
87
|
tw?: string | undefined;
|
|
86
88
|
"aria-activedescendant"?: string | undefined | undefined;
|
|
87
89
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
@@ -157,7 +159,7 @@ export default function createNavigation<const AppLocales extends Locales, const
|
|
|
157
159
|
onBlurCapture?: import("react").FocusEventHandler<HTMLAnchorElement> | undefined;
|
|
158
160
|
onChange?: import("react").FormEventHandler<HTMLAnchorElement> | undefined;
|
|
159
161
|
onChangeCapture?: import("react").FormEventHandler<HTMLAnchorElement> | undefined;
|
|
160
|
-
onBeforeInput?: import("react").
|
|
162
|
+
onBeforeInput?: import("react").InputEventHandler<HTMLAnchorElement> | undefined;
|
|
161
163
|
onBeforeInputCapture?: import("react").FormEventHandler<HTMLAnchorElement> | undefined;
|
|
162
164
|
onInput?: import("react").FormEventHandler<HTMLAnchorElement> | undefined;
|
|
163
165
|
onInputCapture?: import("react").FormEventHandler<HTMLAnchorElement> | undefined;
|
|
@@ -206,8 +208,6 @@ export default function createNavigation<const AppLocales extends Locales, const
|
|
|
206
208
|
onProgressCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
207
209
|
onRateChange?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
208
210
|
onRateChangeCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
209
|
-
onResize?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
210
|
-
onResizeCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
211
211
|
onSeeked?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
212
212
|
onSeekedCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
213
213
|
onSeeking?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
@@ -285,6 +285,8 @@ export default function createNavigation<const AppLocales extends Locales, const
|
|
|
285
285
|
onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
286
286
|
onScroll?: import("react").UIEventHandler<HTMLAnchorElement> | undefined;
|
|
287
287
|
onScrollCapture?: import("react").UIEventHandler<HTMLAnchorElement> | undefined;
|
|
288
|
+
onScrollEnd?: import("react").UIEventHandler<HTMLAnchorElement> | undefined;
|
|
289
|
+
onScrollEndCapture?: import("react").UIEventHandler<HTMLAnchorElement> | undefined;
|
|
288
290
|
onWheel?: import("react").WheelEventHandler<HTMLAnchorElement> | undefined;
|
|
289
291
|
onWheelCapture?: import("react").WheelEventHandler<HTMLAnchorElement> | undefined;
|
|
290
292
|
onAnimationStart?: import("react").AnimationEventHandler<HTMLAnchorElement> | undefined;
|
|
@@ -94,12 +94,14 @@ export default function createSharedNavigationFns<const AppLocales extends Local
|
|
|
94
94
|
results?: number | undefined | undefined;
|
|
95
95
|
security?: string | undefined | undefined;
|
|
96
96
|
unselectable?: "on" | "off" | undefined | undefined;
|
|
97
|
-
popover?: "" | "auto" | "manual" | undefined | undefined;
|
|
97
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined | undefined;
|
|
98
98
|
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
99
99
|
popoverTarget?: string | undefined | undefined;
|
|
100
100
|
inert?: boolean | undefined | undefined;
|
|
101
101
|
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
102
102
|
is?: string | undefined | undefined;
|
|
103
|
+
exportparts?: string | undefined | undefined;
|
|
104
|
+
part?: string | undefined | undefined;
|
|
103
105
|
tw?: string | undefined;
|
|
104
106
|
"aria-activedescendant"?: string | undefined | undefined;
|
|
105
107
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
@@ -175,7 +177,7 @@ export default function createSharedNavigationFns<const AppLocales extends Local
|
|
|
175
177
|
onBlurCapture?: import("react").FocusEventHandler<HTMLAnchorElement> | undefined;
|
|
176
178
|
onChange?: import("react").FormEventHandler<HTMLAnchorElement> | undefined;
|
|
177
179
|
onChangeCapture?: import("react").FormEventHandler<HTMLAnchorElement> | undefined;
|
|
178
|
-
onBeforeInput?: import("react").
|
|
180
|
+
onBeforeInput?: import("react").InputEventHandler<HTMLAnchorElement> | undefined;
|
|
179
181
|
onBeforeInputCapture?: import("react").FormEventHandler<HTMLAnchorElement> | undefined;
|
|
180
182
|
onInput?: import("react").FormEventHandler<HTMLAnchorElement> | undefined;
|
|
181
183
|
onInputCapture?: import("react").FormEventHandler<HTMLAnchorElement> | undefined;
|
|
@@ -224,8 +226,6 @@ export default function createSharedNavigationFns<const AppLocales extends Local
|
|
|
224
226
|
onProgressCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
225
227
|
onRateChange?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
226
228
|
onRateChangeCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
227
|
-
onResize?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
228
|
-
onResizeCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
229
229
|
onSeeked?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
230
230
|
onSeekedCapture?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
231
231
|
onSeeking?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
@@ -303,6 +303,8 @@ export default function createSharedNavigationFns<const AppLocales extends Local
|
|
|
303
303
|
onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
304
304
|
onScroll?: import("react").UIEventHandler<HTMLAnchorElement> | undefined;
|
|
305
305
|
onScrollCapture?: import("react").UIEventHandler<HTMLAnchorElement> | undefined;
|
|
306
|
+
onScrollEnd?: import("react").UIEventHandler<HTMLAnchorElement> | undefined;
|
|
307
|
+
onScrollEndCapture?: import("react").UIEventHandler<HTMLAnchorElement> | undefined;
|
|
306
308
|
onWheel?: import("react").WheelEventHandler<HTMLAnchorElement> | undefined;
|
|
307
309
|
onWheelCapture?: import("react").WheelEventHandler<HTMLAnchorElement> | undefined;
|
|
308
310
|
onAnimationStart?: import("react").AnimationEventHandler<HTMLAnchorElement> | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intl",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.10",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "Jan Amann <jan@amann.work>",
|
|
6
6
|
"funding": [
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"dependencies": {
|
|
113
113
|
"@formatjs/intl-localematcher": "^0.5.4",
|
|
114
114
|
"negotiator": "^1.0.0",
|
|
115
|
-
"use-intl": "^4.3.
|
|
115
|
+
"use-intl": "^4.3.10"
|
|
116
116
|
},
|
|
117
117
|
"peerDependencies": {
|
|
118
118
|
"next": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"optional": true
|
|
125
125
|
}
|
|
126
126
|
},
|
|
127
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "9a710db4d122cdd3f99038e33808eae98871c8b6"
|
|
128
128
|
}
|