File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
packages/nextjs/src/config/manifest Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -99,13 +99,20 @@ function buildRegexForDynamicRoute(routePath: string): {
9999 pattern = `^/${ regexSegments . join ( '/' ) } $` ;
100100 }
101101
102- // Detect if the first parameter is a common i18n prefix segment
103- // Common patterns: locale, lang, language
102+ return { regex : pattern , paramNames, hasOptionalPrefix : hasOptionalPrefix ( paramNames ) } ;
103+ }
104+
105+ /**
106+ * Detect if the first parameter is a common i18n prefix segment
107+ * Common patterns: locale, lang, language
108+ */
109+ function hasOptionalPrefix ( paramNames : string [ ] ) : boolean {
104110 const firstParam = paramNames [ 0 ] ;
105- const hasOptionalPrefix =
106- firstParam !== undefined && ( firstParam === 'locale' || firstParam === 'lang' || firstParam === 'language' ) ;
111+ if ( firstParam === undefined ) {
112+ return false ;
113+ }
107114
108- return { regex : pattern , paramNames , hasOptionalPrefix } ;
115+ return firstParam === 'locale' || firstParam === 'lang' || firstParam === 'language' ;
109116}
110117
111118function scanAppDirectory (
You can’t perform that action at this time.
0 commit comments