Skip to content

Commit

Permalink
Remove stripDefaultLocale from docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kamerat committed Apr 6, 2022
1 parent 2f99429 commit e2b3f51
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions docs/advanced-features/i18n-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,6 @@ import { NextRequest, NextResponse } from 'next/server'

const PUBLIC_FILE = /\.(.*)$/

const stripDefaultLocale = (str: string): string => {
const stripped = str.replace('/default', '')
return stripped
}

export function middleware(request: NextRequest) {
const shouldHandleLocale =
!PUBLIC_FILE.test(request.nextUrl.pathname) &&
Expand All @@ -183,7 +178,7 @@ export function middleware(request: NextRequest) {

if (shouldHandleLocale) {
const url = request.nextUrl.clone()
url.pathname = `/en${stripDefaultLocale(request.nextUrl.pathname)}`
url.pathname = `/en${request.nextUrl.pathname}`
return NextResponse.redirect(url)
}

Expand Down

0 comments on commit e2b3f51

Please sign in to comment.