import { createNavigation } from 'next-intl/navigation'
export const { Link, redirect, usePathname, useRouter, getPathname } =
createNavigation({ locales, localePrefix, pathnames });
页面的路由跳转和link 用这里导出的即可。
import createMiddleware from 'next-intl/middleware' import { localePrefix, defaultLocale, locales, pathnames } from './config' import { NextRequest, NextResponse } from 'next/server' import authMiddleware from './lib/auth-middleware' import { getSession, getStoreValue, setSession } from './lib/utils' // export default createMiddleware({ // defaultLocale, // locales, // localePrefix, // pathnames, // }); export async function middleware(request: NextRequest) { const handleI18nRouting = createMiddleware({ defaultLocale, localePrefix, pathnames, locales, }) let response = handleI18nRouting(request) return response
标签:createNavigation,补全,locale,intl,pathnames,localePrefix,import,locales From: https://www.cnblogs.com/xiaoyaoweb/p/18530857