30 lines
941 B
TypeScript
30 lines
941 B
TypeScript
import createMiddleware from "next-intl/middleware";
|
|
import { NextRequest, NextResponse } from "next/server";
|
|
import { locales } from "@/config";
|
|
import { routing } from "./i18n/routing";
|
|
|
|
// export default async function middleware(request: NextRequest) {
|
|
// // Step 1: Use the incoming request (example)
|
|
// const defaultLocale = "in";
|
|
// // const defaultLocale = request.headers.get("dashcode-locale") || "in";
|
|
|
|
// // Step 2: Create and call the next-intl middleware (example)
|
|
// const handleI18nRouting = createMiddleware({
|
|
// locales: ["in", "en"],
|
|
// defaultLocale: "in",
|
|
// });
|
|
// const response = handleI18nRouting(request);
|
|
|
|
// // Step 3: Alter the response (example)
|
|
// response.headers.set("dashcode-locale", defaultLocale);
|
|
|
|
// return response;
|
|
// }
|
|
|
|
export default createMiddleware(routing);
|
|
|
|
export const config = {
|
|
// Match only internationalized pathnames
|
|
matcher: ["/", "/(in|en)/:path*"],
|
|
};
|