fix(console): send localized changelog URLs to the changelog worker (#56531)

This commit is contained in:
Kit Langton
2026-10-17 14:37:05 -07:00
committed by GitHub
Unverified
parent 53cd745959
commit 9d97a5beec
4 changed files with 17 additions and 2 deletions
+2
View File
@@ -209,6 +209,8 @@ export function route(locale: Locale, pathname: string) {
if (next.startsWith("/docs")) return docs(locale, next)
if (next.startsWith("/auth")) return next
if (next.startsWith("/workspace")) return next
// The changelog worker owns /changelog and only publishes English release notes.
if (next === "/changelog" || next.startsWith("/changelog/")) return next
if (locale === "en") return next
if (next === "/") return `/${locale}`
return `/${locale}${next}`
+2
View File
@@ -11,6 +11,8 @@ export default createMiddleware({
const locale = fromPathname(url.pathname)
if (locale) {
url.pathname = strip(url.pathname)
if (/^\/changelog\/?$/.test(url.pathname))
return new Response(null, { status: 301, headers: { Location: "/changelog" } })
const request = new Request(url, event.request)
request.headers.set(LOCALE_HEADER, locale)
event.request = request
@@ -9,7 +9,6 @@ import type { HighlightGroup } from "~/lib/changelog"
import { For, Show, createSignal } from "solid-js"
import { useI18n } from "~/context/i18n"
import { useLanguage } from "~/context/language"
import { LocaleLinks } from "~/component/locale-links"
function formatDate(dateString: string, locale: string) {
const date = new Date(dateString)
@@ -107,7 +106,6 @@ export default function Changelog() {
return (
<main data-page="changelog">
<Title>{i18n.t("changelog.title")}</Title>
<LocaleLinks path="/changelog" />
<Meta name="description" content={i18n.t("changelog.meta.description")} />
<div data-component="container">
@@ -0,0 +1,13 @@
import { describe, expect, test } from "bun:test"
import { route } from "../src/lib/language"
describe("language.route", () => {
test("keeps the changelog unprefixed for every locale", () => {
expect(route("de", "/changelog")).toBe("/changelog")
expect(route("zh", "/zh/changelog")).toBe("/changelog")
})
test("prefixes other marketing pages", () => {
expect(route("de", "/download")).toBe("/de/download")
})
})