Fix i18n: use localePrefix: never to serve default locale at root

This commit is contained in:
Unchained
2026-03-06 20:59:48 +02:00
parent d88d77b082
commit 236eb628d2
2 changed files with 7 additions and 2 deletions

View File

@@ -3,5 +3,5 @@ import { defineRouting } from 'next-intl/routing';
export const routing = defineRouting({ export const routing = defineRouting({
locales: ['sr', 'en'], locales: ['sr', 'en'],
defaultLocale: 'sr', defaultLocale: 'sr',
localePrefix: 'as-needed' localePrefix: 'never'
}); });

View File

@@ -4,5 +4,10 @@ import { routing } from './i18n/routing';
export default createMiddleware(routing); export default createMiddleware(routing);
export const config = { export const config = {
matcher: ['/((?!api|_next|_vercel|.*\\..*).*)'] // Match all pathnames except for
// - /api routes
// - /_next (Next.js internals)
// - /_vercel (Vercel internals)
// - all root files inside /public (e.g. /favicon.ico)
matcher: ['/((?!api|_next|_vercel|_next/static|_next/image|favicon.ico|robots.txt|sitemap.xml).*)']
}; };