This repository has been archived on 2024-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
wikipedia-game-solver/apps/website/middleware.ts
Théo LUDWIG 33b57bf173
All checks were successful
Chromatic / chromatic (push) Successful in 4m47s
CI / ci (push) Successful in 3m50s
CI / commitlint (push) Successful in 18s
Release / release (push) Successful in 1m0s
refactor: components struture
2024-07-31 15:46:01 +02:00

26 lines
756 B
TypeScript

import { LOCALES, LOCALE_DEFAULT, LOCALE_PREFIX } from "@repo/i18n/config"
import createMiddleware from "next-intl/middleware"
export default createMiddleware({
locales: LOCALES,
defaultLocale: LOCALE_DEFAULT,
localePrefix: LOCALE_PREFIX,
})
export const config = {
matcher: [
// Enable a redirect to a matching locale at the root
"/",
// Set a cookie to remember the previous locale for
// all requests that have a locale prefix
// Next.js issue, middleware matcher should support template literals:
// https://github.com/vercel/next.js/issues/56398
"/(en-US|fr-FR)/:path*",
// Enable redirects that add missing locales
// (e.g. `/pathnames` -> `/en/pathnames`)
"/((?!_next|_vercel|.*\\..*).*)",
],
}