I'm using NextJS 14 and next-intl. I'm implementing localized pathnames (https://next-intl-docs.vercel.app/docs/routing#pathnames)
In my NextJS Middleware, I'm checking if I'm in a route like:
request.url.includes(routes.initialize.replace('/', ''))
But with localized pathnames I can't do it, because of course, the pathname is localized.
I've been searching in the documentation (https://next-intl-docs.vercel.app/docs/routing/navigation#apis) of next-intl and I didn't find any method to get the original pathname given a localized pathname.
There is a hook that is named "usePathname" (https://next-intl-docs.vercel.app/docs/routing/navigation#usepathname) but I can't run it in the middleware.
Anyone that have found any solution?
I've tried to build a func to get the original pathname but there are complex paths.