middleware.ts 378 B

12345678910111213
  1. import createMiddleware from "next-intl/middleware";
  2. import { locales } from "./i18n";
  3. export default createMiddleware({
  4. locales: locales,
  5. defaultLocale: locales[0],
  6. });
  7. // const regexString = `/(${locales.join("|")})/:path*`;
  8. // 创建一个正则表达式对象
  9. export const config = {
  10. // todo use this to match the path
  11. matcher: ["/", "/(br|jp)/:path*"],
  12. };