Skip to content

fix(testing): renderRoute honours a routed locale prefix in its url - #1330

Open
sebyx07 wants to merge 3 commits into
mainfrom
fix/render-locale
Open

sebyx07 wants to merge 3 commits into
mainfrom
fix/render-locale

Conversation

@sebyx07

@sebyx07 sebyx07 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Problem

renderRoute(module, { url: 'https://x/es/' }) rendered in the default locale: the /<locale>/ prefix the router splits off (routeLocalePrefix) was ignored, and RouteRequest has no other way to say the locale. A localized page could only be tested by wrapping the call in runWithContext(ctxOf({ locale }), …).

Change

  • renderRoute reads the leading segment of url with splitLocalePrefix (@ultimat3/i18n, the rule the router and metaContextFor use). A routed locale renders load, meta (its locale, t, alternates) and the page in that locale, inside one request context that also carries actor when given.
  • Unprefixed, or a first segment that is not a routed locale: unchanged — default locale, and no request context when no actor is given.
  • One way: the URL is how a request names its locale, so no separate locale option is added.
  • Docs: TSDoc on RouteRequest.url, packages/testing/README.md, wiki/Testing.md, CHANGELOG (Fixed).

Tests

render-view.test.ts → renderRoute · the locale prefix (written first, failed before the fix): /es/ renders page and meta in es; the prefix and the actor share one context; /precios and an unrouted /fr/ stay on the default.

🤖 Generated with Claude Code

@developerz-ai

developerz-ai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Reviewed

4 actionable comment(s) · 1 refuted by verification · 1 suppressed (anti-noise) · grounded on your code (related code incomplete)

Grounding was partial: the related-code excerpts were cut at their budget; definitions and call sites past the cut were not shown.

@developerz-ai developerz-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Approved.

Review summary: 5 file(s), 4 finding(s).

Critical 0 · Major 0 · Minor 4 · Nit 0

renderRoute now honors locale prefixes, but prefixed calls can discard the caller’s actor. The docs overstate when context is absent or the default locale is used, and the tests do not pin the locale seen by load.

File Findings
CHANGELOG.md 1 minor
packages/testing/README.md 1 minor
packages/testing/src/render-view.test.ts 2 minor

Comment thread CHANGELOG.md Resolved
Comment thread packages/testing/README.md Resolved
sebyx07 and others added 3 commits November 24, 2026 04:18
A request for /es/… renders in es; renderRoute rendered every URL in the
default locale, so a localized page could only be tested by wrapping the
call in runWithContext(ctxOf({ locale })). The prefix is now split by the
same rule the router uses, and the render runs in a context holding that
locale (and the actor, when given).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…her open entries

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uted locale, no context for a bare URL

Review: load is asserted to read es under /es/; /precios and /fr/ render with no request
context; the docs qualify the default to a standalone call (a caller's own runWithContext
keeps its locale) and the actor row names the routed prefix as the other way a context opens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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