mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #471] [MERGED] feat: Add Pages Router i18n domain routing #598
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#598
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/471
Author: @NathanDrake2406
Created: 3/11/2026
Status: ✅ Merged
Merged: 3/12/2026
Merged by: @james-elicx
Base:
main← Head:feat/i18n-domains-pages-router📝 Commits (10+)
3db1ba5Add Pages Router domain locale routingb0c16e9Add coverage for Pages Router domain locale behavior401d1d3Format Pages Router i18n domain routing changesf9d9883Handle basePath in Pages Router i18n domains0ac02beRefactor Pages Router i18n domain fixtures7d51853Update Pages Router entry snapshot after rebase96bfee9Align domain locale redirects with Next.js836745bClarify Pages Router domain locale helpers22bf599Fix case-insensitive locale prefixes43b679fSimplify same-domain locale URL handling📊 Changes
23 files changed (+1306 additions, -163 deletions)
View changed files
📝
packages/vinext/src/check.ts(+5 -2)📝
packages/vinext/src/entries/pages-server-entry.ts(+33 -21)📝
packages/vinext/src/global.d.ts(+18 -0)📝
packages/vinext/src/index.ts(+2 -0)📝
packages/vinext/src/server/dev-server.ts(+45 -90)➕
packages/vinext/src/server/pages-i18n.ts(+233 -0)📝
packages/vinext/src/shims/internal/utils.ts(+1 -0)📝
packages/vinext/src/shims/link.tsx(+27 -11)📝
packages/vinext/src/shims/router.ts(+35 -8)➕
packages/vinext/src/utils/domain-locale.ts(+95 -0)📝
tests/__snapshots__/entry-templates.test.ts.snap(+28 -21)📝
tests/check.test.ts(+2 -2)📝
tests/features.test.ts(+227 -6)➕
tests/fixtures/pages-i18n-domains-basepath/next.config.mjs(+12 -0)➕
tests/fixtures/pages-i18n-domains-basepath/pages/about.tsx(+17 -0)➕
tests/fixtures/pages-i18n-domains-basepath/pages/index.tsx(+3 -0)➕
tests/fixtures/pages-i18n-domains/next.config.mjs(+10 -0)➕
tests/fixtures/pages-i18n-domains/pages/about.tsx(+17 -0)➕
tests/fixtures/pages-i18n-domains/pages/index.tsx(+3 -0)📝
tests/helpers.ts(+77 -2)...and 3 more files
📄 Description
Summary
Add Pages Router support for
i18n.domains, including domain-aware redirects, request context, and client/server locale links.What Changed
pages-i18nhelper to resolve domain locales, root locale-detection redirects, and per-domain default localeslocale,defaultLocale, anddomainLocalesstay in syncdomainLocalesin__NEXT_DATA__and teach the router/link shims to build cross-domain locale URLsnext/linkrenders the correct domain href before hydrationi18n.domainsas partial support for Pages RouterWhy It Matters
Pages Router apps with locale domains can now route
/to the preferred locale domain, use the matched domain default locale in data fetching, and render locale switcher links that point at the right domain from the first HTML response.Risks Or Limits
Verification
pnpm test tests/link.test.ts tests/pages-i18n.test.tspnpm test tests/features.test.ts tests/pages-i18n-prod.test.ts -t "i18n domain routing"🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.