File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,10 @@ const Navbar: React.FC<INavbar> = ({ locale }) => {
4141 >
4242 < div className = "max-w-6xl mx-auto" >
4343 < div className = "flex items-center justify-between" >
44- < Link href = "/" className = "flex items-center space-x-4 cursor-pointer" >
44+ < Link
45+ href = { `/${ locale } ` }
46+ className = "flex items-center space-x-4 cursor-pointer"
47+ >
4548 < img
4649 src = "/kleros.svg"
4750 alt = "Kleros"
Original file line number Diff line number Diff line change 11import { createNavigation } from "next-intl/navigation" ;
22import { defineRouting } from "next-intl/routing" ;
33
4- export const locales = [ "en " , "es " , "ar" ] ;
4+ export const locales = [ "es " , "en " , "ar" ] ;
55
66export const routing = defineRouting ( {
77 // A list of all locales that are supported
88 locales,
99
1010 // Used when no locale matches
11- defaultLocale : "en " ,
11+ defaultLocale : "es " ,
1212} ) ;
1313
1414// Lightweight wrappers around Next.js' navigation APIs
Original file line number Diff line number Diff line change 11import createMiddleware from "next-intl/middleware" ;
2- import { NextRequest } from "next/server" ;
2+ import { NextRequest , NextResponse } from "next/server" ;
33
44import { locales , routing } from "@/i18n/routing" ;
55
@@ -13,5 +13,10 @@ export default function middleware(request: NextRequest) {
1313 new RegExp ( `^/(${ locales . join ( "|" ) } )(/.*)?$` ) . test ( pathname ) ;
1414 if ( ! shouldHandle ) return ;
1515
16+ // Redirect root path to Spanish locale
17+ if ( pathname === "/" ) {
18+ return NextResponse . redirect ( new URL ( "/es" , request . url ) ) ;
19+ }
20+
1621 return handleI18nRouting ( request ) ;
1722}
You can’t perform that action at this time.
0 commit comments