i18n routing: `locale: false` on rewrites/redirects not implemented
#1.336 geöffnet am 20.05.2026
Repository-Metriken
- Stars
- (8.563 Sterne)
- PR-Merge-Metriken
- (Durchschn. Merge 1T 1h) (462 gemergte PRs in 30 T)
Beschreibung
This issue was created by an agent analysing CI failures from the Next.js Deploy Suite (vinext
mainvs Next.jsv16.2.6, 2026-05-20).
Problem
Several i18n routing features are not properly implemented:
-
locale: falseon rewrite/redirect sources not implemented. When a rewrite or redirect innext.config.jsspecifieslocale: falseon the source, the pattern should match the raw path without locale prefix handling. vinext does not honor this flag, so rewrites/redirects fail to match when they should. -
Locale detection re-runs on every request instead of being sticky. After the initial locale is established, client-side navigations should preserve it. vinext appears to re-detect from
Accept-Languageon each server request, causing the locale to flip unexpectedly. -
Locale prefix not stripped for API routes. Requests like
/fr/api/okneed the locale prefix stripped before API route matching. vinext does not strip it, causing 404s. -
Default locale prefix stripping missing. Requests to
/en/page(whereenis the default locale) should redirect to/page. This redirect is not happening.
Expected: "en"
Received: "id" // locale flipped to browser preference on client nav
Estimated Impact
~24 test failures across the deploy suite.
Affected Test Suites
test/e2e/i18n-ignore-rewrite-source-locale/rewrites.test.ts(8 failures, all 8 tests)test/e2e/i18n-ignore-redirect-source-locale/redirects-with-basepath.test.ts(4 failures)test/e2e/i18n-ignore-redirect-source-locale/redirects.test.ts(4 failures)test/e2e/ignore-invalid-popstateevent/with-i18n.test.ts(3 failures)test/e2e/ignore-invalid-popstateevent/without-i18n.test.ts(2 failures)test/e2e/i18n-preferred-locale-detection/i18n-preferred-locale-detection.test.ts(1 failure)test/e2e/i18n-default-locale-redirect/i18n-default-locale-redirect.test.ts(1 failure)test/e2e/middleware-custom-matchers-i18n/test/index.test.ts(1 failure)
Recommendation
-
Reproduce first in vinext's own test suite. Add tests for: (a) a rewrite with
locale: falsesource matching a non-locale-prefixed path, (b) locale persistence across client navigations, (c) API routes under locale prefixes. Confirm they fail. -
Study Next.js i18n implementation. Search
.nextjs-ref/packages/next/src/server/forlocale: false, locale detection, and locale stripping logic. -
Implement
locale: falseflag. When evaluating rewrite/redirect sources withlocale: false, skip the locale prefix injection and match against the raw path. -
Make locale detection sticky. Once a locale is established (either by URL prefix or initial detection), it should be preserved across navigations. The locale context should be carried in the client-side router state.
-
Strip locale prefix for API routes. Add locale stripping before the API route matching step.