File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -266,7 +266,9 @@ export default function createMiddleware<
266
266
} else {
267
267
const internalHref = formatPathname (
268
268
unprefixedInternalPathname ,
269
- getLocaleAsPrefix ( locale ) ,
269
+ resolvedRouting . optimalRouting
270
+ ? undefined
271
+ : getLocaleAsPrefix ( locale ) ,
270
272
request . nextUrl . search
271
273
) ;
272
274
Original file line number Diff line number Diff line change @@ -66,6 +66,12 @@ export type RoutingConfig<
66
66
**/
67
67
alternateLinks ?: boolean ;
68
68
69
+ /**
70
+ * Allows having the optimal routing for the current request by bypassing middleware
71
+ * and using the default locale when no locale is presented via the URL or domains.
72
+ **/
73
+ optimalRouting ?: boolean ;
74
+
69
75
/**
70
76
* By setting this to `false`, the cookie as well as the `accept-language` header will no longer be used for locale detection.
71
77
* @see https://next-intl.dev/docs/routing/middleware#locale-detection
You can’t perform that action at this time.
0 commit comments