since i’ve added the middleware which i will provide to you,
i cannot enter the urls manually and it errors out.
i’m using “next-intl” internationalization and i created a middleware to handle language change routes for the “baseUrl”.
i don’t know what to do!
i tried different kind of middleware handling but all of them seemed to not be working properly either.
any suggestions ?
here’s the middleware :
import createMiddleware from 'next-intl/middleware';
export default createMiddleware({
// A list of all locales that are supported
locales: ['en', 'fa'],
// Used when no locale matches
defaultLocale: 'en'
});
export const config = {
// Match only internationalized pathnames
matcher: ['/', '/(fa|en)/:path*' , '/((?!api|_next|_vercel|.*\..*).*)' , '/([\w-]+)?/api/(.+)']
};
and here’s the next.config.mjs :
import createNextIntlPlugin from "next-intl/plugin";
const withNextIntl = createNextIntlPlugin();
/** @type {import('next').NextConfig} */
const nextConfig = {
trailingSlash: true,
images: {
domains: ["utfs.io"],
},
};
export default withNextIntl(nextConfig);
Nima Moradi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.