2024-11-09 19:50:22 +01:00
|
|
|
import { routing } from "@repo/i18n/routing"
|
|
|
|
import createIntlMiddleware from "next-intl/middleware"
|
2024-07-30 23:59:06 +02:00
|
|
|
|
2024-11-09 19:50:22 +01:00
|
|
|
const intlMiddleware = createIntlMiddleware(routing)
|
|
|
|
|
|
|
|
export default intlMiddleware
|
2024-07-30 23:59:06 +02:00
|
|
|
|
|
|
|
export const config = {
|
|
|
|
matcher: [
|
|
|
|
// Enable a redirect to a matching locale at the root
|
|
|
|
"/",
|
|
|
|
|
2024-07-31 11:41:39 +02:00
|
|
|
// Next.js issue, middleware matcher should support template literals:
|
|
|
|
// https://github.com/vercel/next.js/issues/56398
|
2024-07-30 23:59:06 +02:00
|
|
|
"/(en-US|fr-FR)/:path*",
|
|
|
|
|
2024-11-09 19:50:22 +01:00
|
|
|
/*
|
|
|
|
* Match all request paths except for the ones starting with:
|
|
|
|
* - api (API routes)
|
|
|
|
* - _next/static (static files)
|
|
|
|
* - _next/image (image optimization files)
|
|
|
|
* - favicon.ico (favicon file)
|
|
|
|
*/
|
|
|
|
"/((?!api|_next/static|_next/image|images|favicon.ico).*)",
|
2024-07-30 23:59:06 +02:00
|
|
|
],
|
|
|
|
}
|