Implement complete multi-language support with Romanian/English
- Added next-intl for internationalization with Romanian as default locale - Restructured app directory with [locale] routing (/ro, /en) - Created comprehensive translation files for both languages - Fixed Next.js 15 async params compatibility in layout components - Updated all components to use proper i18n hooks and translations - Configured middleware for locale routing and fallbacks - Fixed FloatingChat component translation array handling - Restored complete home page with internationalized content - Fixed Material-UI Slide component prop error (mountOnExit → unmountOnExit) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,13 @@ import { NextResponse } from 'next/server'
|
||||
import type { NextRequest } from 'next/server'
|
||||
import { verifyToken } from '@/lib/auth'
|
||||
import { prisma } from '@/lib/db'
|
||||
import createIntlMiddleware from 'next-intl/middleware'
|
||||
|
||||
// Internationalization configuration
|
||||
const intlMiddleware = createIntlMiddleware({
|
||||
locales: ['ro', 'en'],
|
||||
defaultLocale: 'ro'
|
||||
})
|
||||
|
||||
// Rate limiting configuration
|
||||
const RATE_LIMIT_WINDOW = 60 * 1000 // 1 minute
|
||||
@@ -58,6 +65,11 @@ async function checkRateLimit(request: NextRequest, endpoint: string, limit: num
|
||||
}
|
||||
|
||||
export async function middleware(request: NextRequest) {
|
||||
// Handle internationalization for non-API routes
|
||||
if (!request.nextUrl.pathname.startsWith('/api')) {
|
||||
return intlMiddleware(request)
|
||||
}
|
||||
|
||||
// Determine endpoint type for rate limiting
|
||||
let endpoint = 'general'
|
||||
let limit = RATE_LIMITS.general
|
||||
@@ -155,6 +167,12 @@ export async function middleware(request: NextRequest) {
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
// Match all pathnames except for
|
||||
// - api routes
|
||||
// - _next (Next.js internals)
|
||||
// - static files (images, etc.)
|
||||
'/((?!api|_next|_vercel|.*\\..*).*)',
|
||||
// However, match all pathnames within `/api`, except for the Middleware to run there
|
||||
'/api/:path*',
|
||||
'/dashboard/:path*'
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user