fix(landing): fall back to English docs links for untranslated locale pages - #179
Draft
777genius wants to merge 1 commit into
Draft
Conversation
… pages useDocsLinks blindly swapped the locale segment in docs URLs without checking whether the target-locale page actually has real content, silently pointing users at pages that only exist as English fallback. Generate a locale-availability manifest from the docs disposition registry and consult it before switching locales.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
777genius
added a commit
that referenced
this pull request
Sep 7, 2026
Independent review found that these three links bypass useDocsLinks()'s new fallback-aware resolution (PR #179) since they suffix docsUrl directly instead of resolving their own docPath. No live effect today (landing has no locale-aware routing yet), but whoever enables it needs to route through the fallback-aware API here instead of concatenating a suffix onto the always-'en'-today root URL.
777genius
added a commit
that referenced
this pull request
Sep 7, 2026
…ck API Now that #179's landing/utils/docsLinks.ts API is stable, use replaceDocsLocale(url, locale, docPath) directly for the use/build/ legacy-v1 links instead of suffixing the docs root, closing the gap independent review found: string concatenation on top of docsUrl only fallback-checks the docs root docPath, so once landing gets locale-aware routing these three links would have silently served untranslated pages to non-English visitors instead of falling back to English like every other docs link on the site. No behavior change today (landing has no locale-aware routing yet, so currentLocale is always 'en' and both approaches produce the same URL).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
useDocsLinks(landing app) built locale-specific docs URLs by blindlyregex-replacing the locale segment (
/en/->/ru/etc.) without checkingwhether the target-locale page actually has real translated content. Per the
D3 locale disposition registry (
website/tools/quality/locale-dispositions.json),52 of 244 pages are
english-fallback(no real translation yet) - notably thewhole
use/andbuild/sections for non-English locales. Landing links intothose sections would have silently pointed non-English users at pages that
only exist in English, guessed as if they were localized.
Fix
landing/scripts/generate-docs-locale-availability.mjs: build-time generatorthat derives a minimal per-locale "real content" manifest from the docs
disposition registry (mirrors the existing
build-pages-artifact.mjscross-package script convention). Output is committed
(
landing/data/docsLocaleAvailability.generated.json), consistent with thisrepo's existing pattern of committing generated artifacts under
website/generated/**.landing/utils/docsLinks.ts: new pure, framework-free helper(
replaceDocsLocale/resolveDocsLocale/hasRealDocsContent) that consultsthe manifest and falls back to the English URL explicitly when the target
locale has no real content for that page.
landing/composables/useDocsLinks.ts: now passes the doc-relative path foreach link (
guide/quickstart,reference/support-boundary,guide/build-custom-plugin-logic, and the docs root) through the new helperinstead of the old blind regex swap.
landing/tests/docsLinks.test.ts: covers both the happy path (real contentkeeps the requested locale) and the fallback path (no real content ->
English), plus the untouched-URL and unknown-locale-segment cases.
Scope note
Stacked on #178 (base
docs/authoring-d4a-switcher-fix, same D2b/D3/generatedcheckpoint chain) so this stays a small, independently reviewable slice ahead
of the larger Phase6 D4 landing implementation (Use/Build frontdoor,
header/footer, 5-locale SEO parity), which is tracked separately.
Verification
node --test --experimental-strip-types tests/docsLinks.test.ts(pinnedNode 22.21.1): 6/6 pass.
pnpm run test:registry: 23/24 pass; the one pre-existing failure(
registry.test.ts) is an unrelated missing local fixture(
public/registry/schemas/1/latest.json, produced by theagentplugins-registry-mirrorstep), reproduces identically on theunmodified base branch, not something this PR touches or regresses.
tsc --noEmiton the newutils/docsLinks.ts: clean.historical-snapshotcontentin every locale, so there is no visible behavior change today - this closes
the gap before the D4 landing PR adds new
use//build/links that do hitthe fallback case.
No merge/squash from this session - opening for review only, per repo policy.