Skip to content

fix(landing): fall back to English docs links for untranslated locale pages - #179

Draft
777genius wants to merge 1 commit into
docs/authoring-d4a-switcher-fixfrom
fix/authoring-usedocslinks-locale-fallback
Draft

fix(landing): fall back to English docs links for untranslated locale pages#179
777genius wants to merge 1 commit into
docs/authoring-d4a-switcher-fixfrom
fix/authoring-usedocslinks-locale-fallback

Conversation

@777genius

Copy link
Copy Markdown
Owner

What

useDocsLinks (landing app) built locale-specific docs URLs by blindly
regex-replacing the locale segment (/en/ -> /ru/ etc.) without checking
whether 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 the
whole use/ and build/ sections for non-English locales. Landing links into
those 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 generator
    that derives a minimal per-locale "real content" manifest from the docs
    disposition registry (mirrors the existing build-pages-artifact.mjs
    cross-package script convention). Output is committed
    (landing/data/docsLocaleAvailability.generated.json), consistent with this
    repo's existing pattern of committing generated artifacts under
    website/generated/**.
  • landing/utils/docsLinks.ts: new pure, framework-free helper
    (replaceDocsLocale/resolveDocsLocale/hasRealDocsContent) that consults
    the 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 for
    each link (guide/quickstart, reference/support-boundary,
    guide/build-custom-plugin-logic, and the docs root) through the new helper
    instead of the old blind regex swap.
  • landing/tests/docsLinks.test.ts: covers both the happy path (real content
    keeps 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/generated
checkpoint 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 (pinned
    Node 22.21.1): 6/6 pass.
  • Full 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 the
    agentplugins-registry-mirror step), reproduces identically on the
    unmodified base branch, not something this PR touches or regresses.
  • Isolated tsc --noEmit on the new utils/docsLinks.ts: clean.
  • Currently the 4 existing links all resolve to historical-snapshot content
    in 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 hit
    the fallback case.

No merge/squash from this session - opening for review only, per repo policy.

… 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.
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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
…s fallback-aware docsLinks API

Needed for the follow-up fix to AuthoringJourneysSection.vue's use/build/
legacy-v1 links (see the code comment added in c4ecdbc and the
independent-review finding in PR #180's body).
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).
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