Skip to content

Preserve the current docs page in translation links - #8738

Closed
yuncic wants to merge 1 commit into
reactjs:mainfrom
yuncic:codex/preserve-translation-path
Closed

yuncic wants to merge 1 commit into
reactjs:mainfrom
yuncic:codex/preserve-translation-path

Conversation

@yuncic

@yuncic yuncic commented Nov 6, 2026

Copy link
Copy Markdown

Summary

  • Preserve the current Learn or API Reference pathname when opening the dedicated Translations page.
  • Point completed translation links to that pathname. Direct visits to Translations and in-progress language links continue to open language homepages.
  • Ignore invalid from paths instead of placing them in external links.

Why

From https://react.dev/reference/react/useLayoutEffect, choosing Translations and then Korean currently opens the Korean homepage even though https://ko.react.dev/reference/react/useLayoutEffect exists. Readers have to find the same document again.

This keeps the dedicated Translations page, unlike the dropdown approach discussed in #2255. It follows the existing same-path language alternate pattern in Seo.tsx.

Validation

  • yarn tsc — passed
  • yarn lint — passed (existing no-img-element warnings)
  • yarn prettier:diff — passed
  • Local browser: useLayoutEffect → Translations produced a Korean link to the corresponding document. Direct Translations visits and an invalid from=//evil.com kept the Korean homepage link.

Note

A completed translation can still lag behind a newly added document, so a corresponding path is not guaranteed to exist on every language site. The translation site links retain their existing new-tab behavior.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Size changes

Details

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Five Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/404 127.83 KB (🟡 +219 B) 242.98 KB
/500 127.83 KB (🟡 +219 B) 242.98 KB
/[[...markdownPath]] 130.31 KB (🟡 +219 B) 245.46 KB
/errors 128.08 KB (🟡 +219 B) 243.23 KB
/errors/[errorCode] 128.05 KB (🟡 +219 B) 243.2 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

@yuncic yuncic closed this Nov 6, 2026
@yuncic
yuncic deleted the codex/preserve-translation-path branch November 6, 2026 04:04

This branch was successfully deployed

1 active deployment
Preview — 371a337b Deployed Nov 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant