-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmiddleware.ts
More file actions
25 lines (20 loc) · 875 Bytes
/
middleware.ts
File metadata and controls
25 lines (20 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import createMiddleware from 'next-intl/middleware';
import { locales, defaultLocale } from './i18n/config';
export default createMiddleware({
// A list of all locales that are supported
locales,
// Used when no locale matches
defaultLocale,
// Always use locale prefix (including /en/ for English)
// This makes all language choices explicit and unambiguous,
// allowing proper region detection while respecting manual overrides
localePrefix: 'always',
// Enable automatic locale detection for initial visits
// Uses browser language (Accept-Language header) and NEXT_LOCALE cookie
// When users explicitly select a language, their choice is stored and respected
localeDetection: true
});
export const config = {
// Match only internationalized pathnames
matcher: ['/', '/(en|ja|th|ko|ar|sv|zh)/:path*', '/((?!_next|_vercel|.*\\..*).*)']
};