From 7ea9216f45d891c3640db29cd226ae96eabcdfc6 Mon Sep 17 00:00:00 2001 From: Kiet Ho Date: Sat, 29 Aug 2026 08:52:19 -0700 Subject: [PATCH 1/2] fix(marketing): serve the request's language, and make regressing this a blocked deploy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A production review found 25 pages serving English heroes or whole English bodies to ja/ru/tr visitors, with a hydration mismatch on each: every route entry seeded RSC i18n with a bare initServerI18n(), which activates the default locale no matter what Accept-Language says. Client components then re-localized on hydration, which both masked the bug on some pages and caused the mismatches. None of it reached Sentry: React's recoverable hydration errors are not captured, so the whole class was invisible to monitoring. The point fix: initServerI18n() in the marketing app now resolves Accept-Language per request, preloads that catalog, and activates it; all 31 route entries await it, and the layout writes the resolved locale into html lang instead of a hardcoded "en". The pages are already dynamically rendered for the session-aware nav, so this adds no rendering cost. The systematic guards, so this failure mode cannot ship again: The RSC seeding ratchet now requires the awaited request-aware call — a bare or un-awaited initServerI18n() fails the build, proven by reverting one call site. The deploy smoke test gains a --localized pass, wired into the marketing deploy: every route is also fetched with Accept-Language: ja and fails on served html lang other than ja or on a page with no Japanese text. Both signals read the raw served HTML, so client-side patch-up cannot mask a server regression. Run against production as it is today, it fails on every page — including pages the browser review had passed, because hydration was papering over English server HTML. Verified locally: ja request serves lang="ja" with a Japanese hero (どのチームにも分かりやすい料金), en request unchanged, localized smoke green. Remaining English in a ja page is meta description SEO text, which is English by design. Claude-Session: https://claude.ai/code/session_012U97YWVsDvZwQkBaSGEmor --- .github/workflows/deploy-preview.yml | 2 +- .../marketing/src/app/(legal)/[slug]/page.tsx | 2 +- .../src/app/agent-orchestration/page.tsx | 4 +- apps/marketing/src/app/blog/[slug]/page.tsx | 2 +- apps/marketing/src/app/blog/page.tsx | 2 +- .../src/app/changelog/[slug]/page.tsx | 2 +- apps/marketing/src/app/changelog/page.tsx | 2 +- apps/marketing/src/app/community/page.tsx | 2 +- .../marketing/src/app/compare/[slug]/page.tsx | 2 +- apps/marketing/src/app/compare/page.tsx | 2 +- apps/marketing/src/app/contact/page.tsx | 4 +- apps/marketing/src/app/download/page.tsx | 4 +- apps/marketing/src/app/enterprise/page.tsx | 4 +- apps/marketing/src/app/factory-2026/page.tsx | 4 +- apps/marketing/src/app/i18n-server.ts | 50 +++++++++++++++++-- apps/marketing/src/app/join-us/page.tsx | 4 +- apps/marketing/src/app/layout.tsx | 6 +-- apps/marketing/src/app/leaderboard/page.tsx | 2 +- .../src/app/marketplace/agents/page.tsx | 4 +- apps/marketing/src/app/marketplace/page.tsx | 4 +- .../app/marketplace/themes/[slug]/page.tsx | 2 +- .../src/app/marketplace/themes/page.tsx | 4 +- apps/marketing/src/app/mcp-install/page.tsx | 4 +- apps/marketing/src/app/not-found.tsx | 4 +- apps/marketing/src/app/page.tsx | 4 +- .../src/app/parallel-coding-agents/page.tsx | 4 +- apps/marketing/src/app/pricing/page.tsx | 4 +- apps/marketing/src/app/roadmap/page.tsx | 4 +- apps/marketing/src/app/starchart/page.tsx | 2 +- apps/marketing/src/app/stats/page.tsx | 2 +- apps/marketing/src/app/team/[id]/page.tsx | 2 +- apps/marketing/src/app/team/page.tsx | 4 +- apps/marketing/src/app/user/[handle]/page.tsx | 2 +- packages/i18n/test/rsc-seeding.test.ts | 6 ++- scripts/smoke-routes.ts | 45 +++++++++++++++++ 35 files changed, 147 insertions(+), 54 deletions(-) diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml index d8755f70a6e..a1f214d50df 100644 --- a/.github/workflows/deploy-preview.yml +++ b/.github/workflows/deploy-preview.yml @@ -479,7 +479,7 @@ jobs: # reached production that way. - name: Smoke test marketing routes run: | - bun scripts/smoke-routes.ts "https://${{ env.MARKETING_ALIAS }}" \ + bun scripts/smoke-routes.ts "https://${{ env.MARKETING_ALIAS }}" --localized \ / /pricing /enterprise /download /join-us /community /contact \ /blog /changelog /compare /roadmap /leaderboard /marketplace \ /agent-orchestration /parallel-coding-agents /factory-2026 \ diff --git a/apps/marketing/src/app/(legal)/[slug]/page.tsx b/apps/marketing/src/app/(legal)/[slug]/page.tsx index babdbe4c80b..30911e49891 100644 --- a/apps/marketing/src/app/(legal)/[slug]/page.tsx +++ b/apps/marketing/src/app/(legal)/[slug]/page.tsx @@ -19,7 +19,7 @@ function formatDate(date: string | Date): string { } export default async function LegalPage({ params }: PageProps) { - initServerI18n(); + await initServerI18n(); const { slug } = await params; const page = getLegalPage(slug); diff --git a/apps/marketing/src/app/agent-orchestration/page.tsx b/apps/marketing/src/app/agent-orchestration/page.tsx index 3988af46613..fe58fff7f2b 100644 --- a/apps/marketing/src/app/agent-orchestration/page.tsx +++ b/apps/marketing/src/app/agent-orchestration/page.tsx @@ -7,8 +7,8 @@ import { getCategoryPage } from "@/lib/category"; const SLUG = "agent-orchestration"; -export default function AgentOrchestrationPage() { - initServerI18n(); +export default async function AgentOrchestrationPage() { + await initServerI18n(); const page = getCategoryPage(SLUG); diff --git a/apps/marketing/src/app/blog/[slug]/page.tsx b/apps/marketing/src/app/blog/[slug]/page.tsx index 7d65a968061..76ef2708c1a 100644 --- a/apps/marketing/src/app/blog/[slug]/page.tsx +++ b/apps/marketing/src/app/blog/[slug]/page.tsx @@ -22,7 +22,7 @@ interface PageProps { } export default async function BlogPostPage({ params }: PageProps) { - initServerI18n(); + await initServerI18n(); const { slug } = await params; const post = getBlogPost(slug); diff --git a/apps/marketing/src/app/blog/page.tsx b/apps/marketing/src/app/blog/page.tsx index 7f4a5eddfa7..66c19f27ac7 100644 --- a/apps/marketing/src/app/blog/page.tsx +++ b/apps/marketing/src/app/blog/page.tsx @@ -32,7 +32,7 @@ export const metadata: Metadata = { }; export default async function BlogPage() { - initServerI18n(); + await initServerI18n(); const posts = getBlogPosts(); diff --git a/apps/marketing/src/app/changelog/[slug]/page.tsx b/apps/marketing/src/app/changelog/[slug]/page.tsx index a1d6370ce22..09d75bda6f0 100644 --- a/apps/marketing/src/app/changelog/[slug]/page.tsx +++ b/apps/marketing/src/app/changelog/[slug]/page.tsx @@ -13,7 +13,7 @@ interface PageProps { } export default async function ChangelogEntryPage({ params }: PageProps) { - initServerI18n(); + await initServerI18n(); const { slug } = await params; const entry = getChangelogEntry(slug); diff --git a/apps/marketing/src/app/changelog/page.tsx b/apps/marketing/src/app/changelog/page.tsx index 7f7b09e31ff..26b40ae22c9 100644 --- a/apps/marketing/src/app/changelog/page.tsx +++ b/apps/marketing/src/app/changelog/page.tsx @@ -35,7 +35,7 @@ export const metadata: Metadata = { }; export default async function ChangelogPage() { - initServerI18n(); + await initServerI18n(); const entries = getChangelogEntries(); diff --git a/apps/marketing/src/app/community/page.tsx b/apps/marketing/src/app/community/page.tsx index 83027df374d..ebaacc8ea69 100644 --- a/apps/marketing/src/app/community/page.tsx +++ b/apps/marketing/src/app/community/page.tsx @@ -113,7 +113,7 @@ const COMMUNITY_LINKS = [ ]; export default async function CommunityPage() { - initServerI18n(); + await initServerI18n(); const stars = await getGitHubStars(); diff --git a/apps/marketing/src/app/compare/[slug]/page.tsx b/apps/marketing/src/app/compare/[slug]/page.tsx index d8773226574..083877e82b6 100644 --- a/apps/marketing/src/app/compare/[slug]/page.tsx +++ b/apps/marketing/src/app/compare/[slug]/page.tsx @@ -25,7 +25,7 @@ interface PageProps { } export default async function ComparePageRoute({ params }: PageProps) { - initServerI18n(); + await initServerI18n(); const { slug } = await params; const page = getComparisonPage(slug); diff --git a/apps/marketing/src/app/compare/page.tsx b/apps/marketing/src/app/compare/page.tsx index abc480fcb7a..ee9e7bb9d38 100644 --- a/apps/marketing/src/app/compare/page.tsx +++ b/apps/marketing/src/app/compare/page.tsx @@ -31,7 +31,7 @@ export const metadata: Metadata = { }; export default async function ComparePage() { - initServerI18n(); + await initServerI18n(); const pages = getComparisonPages(); diff --git a/apps/marketing/src/app/contact/page.tsx b/apps/marketing/src/app/contact/page.tsx index c23aafd797c..362d3a34a64 100644 --- a/apps/marketing/src/app/contact/page.tsx +++ b/apps/marketing/src/app/contact/page.tsx @@ -13,8 +13,8 @@ export const metadata: Metadata = { }, }; -export default function ContactPage() { - initServerI18n(); +export default async function ContactPage() { + await initServerI18n(); // Named locals so the paragraph extracts with `{supportEmail}` / // `{foundersEmail}` instead of positional `{0}` / `{1}`. diff --git a/apps/marketing/src/app/download/page.tsx b/apps/marketing/src/app/download/page.tsx index c4b7e709d54..6c60ca52210 100644 --- a/apps/marketing/src/app/download/page.tsx +++ b/apps/marketing/src/app/download/page.tsx @@ -8,8 +8,8 @@ export const metadata: Metadata = { robots: { index: false, follow: true }, }; -export default function DownloadPage() { - initServerI18n(); +export default async function DownloadPage() { + await initServerI18n(); return ; } diff --git a/apps/marketing/src/app/enterprise/page.tsx b/apps/marketing/src/app/enterprise/page.tsx index 8b971daaff7..d1ae037a4f0 100644 --- a/apps/marketing/src/app/enterprise/page.tsx +++ b/apps/marketing/src/app/enterprise/page.tsx @@ -15,8 +15,8 @@ export const metadata: Metadata = { }, }; -export default function EnterprisePage() { - initServerI18n(); +export default async function EnterprisePage() { + await initServerI18n(); const { t } = useLingui(); diff --git a/apps/marketing/src/app/factory-2026/page.tsx b/apps/marketing/src/app/factory-2026/page.tsx index 4160f8e3b2b..1cbbe813cda 100644 --- a/apps/marketing/src/app/factory-2026/page.tsx +++ b/apps/marketing/src/app/factory-2026/page.tsx @@ -36,8 +36,8 @@ export const metadata: Metadata = { }, }; -export default function Factory2026Page() { - initServerI18n(); +export default async function Factory2026Page() { + await initServerI18n(); return (
diff --git a/apps/marketing/src/app/i18n-server.ts b/apps/marketing/src/app/i18n-server.ts index 58b441531a4..34bf3580c53 100644 --- a/apps/marketing/src/app/i18n-server.ts +++ b/apps/marketing/src/app/i18n-server.ts @@ -1,3 +1,47 @@ -// Re-exported so existing imports keep working; the implementation and the -// explanation of why RSC needs it live in @superset/i18n/server. -export { initServerI18n } from "@superset/i18n/server"; +import { + initServerI18n as activateServerI18n, + preloadServerLocale, +} from "@superset/i18n/server"; +import { resolveLocale, type SupportedLocale } from "@superset/i18n"; +import { headers } from "next/headers"; + +// "ja,en-US;q=0.9,en;q=0.8" -> ["ja", "en-US", "en"], ordered by quality. +function parseAcceptLanguage(header: string | null): string[] { + if (!header) return []; + return header + .split(",") + .map((part) => { + const [tag, ...params] = part.trim().split(";"); + const q = params + .map((p) => p.trim()) + .find((p) => p.startsWith("q=")) + ?.slice(2); + const quality = q ? Number.parseFloat(q) : 1; + return { tag: (tag ?? "").trim(), quality }; + }) + .filter((e) => e.tag && e.tag !== "*" && Number.isFinite(e.quality)) + .sort((a, b) => b.quality - a.quality) + .map((e) => e.tag); +} + +/** + * Activates i18n for a React Server Components render, in the language the + * request asked for. + * + * A bare seeding call activates the default locale, which renders the whole + * RSC pass in English no matter what Accept-Language says — client components + * then re-localize on hydration, so visitors saw English heroes above + * localized bodies plus a hydration mismatch on every such page. Every route + * entry must await this (the layout is pruned on client-side navigation, so + * seeding there covers only full document loads — see @superset/i18n/server). + * + * These pages are already dynamically rendered (the nav resolves the session + * per request), so reading headers() adds no new rendering cost. + */ +export async function initServerI18n(): Promise { + const acceptLanguage = (await headers()).get("accept-language"); + const locale = resolveLocale(parseAcceptLanguage(acceptLanguage)); + await preloadServerLocale(locale); + activateServerI18n(locale); + return locale; +} diff --git a/apps/marketing/src/app/join-us/page.tsx b/apps/marketing/src/app/join-us/page.tsx index 3825c530988..caa6a904878 100644 --- a/apps/marketing/src/app/join-us/page.tsx +++ b/apps/marketing/src/app/join-us/page.tsx @@ -36,8 +36,8 @@ export const metadata: Metadata = { }, }; -export default function JoinUsPage() { - initServerI18n(); +export default async function JoinUsPage() { + await initServerI18n(); return (
diff --git a/apps/marketing/src/app/layout.tsx b/apps/marketing/src/app/layout.tsx index 0444c3944b7..a5adf59d2f6 100644 --- a/apps/marketing/src/app/layout.tsx +++ b/apps/marketing/src/app/layout.tsx @@ -103,16 +103,16 @@ export const metadata: Metadata = { manifest: "/manifest.json", }; -export default function RootLayout({ +export default async function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { - initServerI18n(); + const locale = await initServerI18n(); return ( diff --git a/apps/marketing/src/app/leaderboard/page.tsx b/apps/marketing/src/app/leaderboard/page.tsx index e1212e6cc6b..34ade543bdf 100644 --- a/apps/marketing/src/app/leaderboard/page.tsx +++ b/apps/marketing/src/app/leaderboard/page.tsx @@ -41,7 +41,7 @@ export const revalidate = 300; const DEFAULT_PERIOD = "30d" as const; export default async function LeaderboardPage() { - initServerI18n(); + await initServerI18n(); const [standings, stats] = await Promise.all([ fetchStandings({ period: DEFAULT_PERIOD, metric: "tokens", limit: 50 }), diff --git a/apps/marketing/src/app/marketplace/agents/page.tsx b/apps/marketing/src/app/marketplace/agents/page.tsx index ba3e07a1253..08e6371aa46 100644 --- a/apps/marketing/src/app/marketplace/agents/page.tsx +++ b/apps/marketing/src/app/marketplace/agents/page.tsx @@ -15,8 +15,8 @@ export const metadata: Metadata = { }, }; -export default function MarketplaceAgentsPage() { - initServerI18n(); +export default async function MarketplaceAgentsPage() { + await initServerI18n(); return (
diff --git a/apps/marketing/src/app/marketplace/page.tsx b/apps/marketing/src/app/marketplace/page.tsx index bf9a02ac952..1ab4beafde2 100644 --- a/apps/marketing/src/app/marketplace/page.tsx +++ b/apps/marketing/src/app/marketplace/page.tsx @@ -35,8 +35,8 @@ const marketplaceLinks = [ }, ] as const; -export default function MarketplacePage() { - initServerI18n(); +export default async function MarketplacePage() { + await initServerI18n(); const { t } = useLingui(); diff --git a/apps/marketing/src/app/marketplace/themes/[slug]/page.tsx b/apps/marketing/src/app/marketplace/themes/[slug]/page.tsx index 8ab647db710..f0a112e70c2 100644 --- a/apps/marketing/src/app/marketplace/themes/[slug]/page.tsx +++ b/apps/marketing/src/app/marketplace/themes/[slug]/page.tsx @@ -55,7 +55,7 @@ export async function generateMetadata({ } export default async function ThemeDetailPage({ params }: PageProps) { - initServerI18n(); + await initServerI18n(); const { slug } = await params; const theme = getThemeListing(slug); diff --git a/apps/marketing/src/app/marketplace/themes/page.tsx b/apps/marketing/src/app/marketplace/themes/page.tsx index ad0f188e950..e1726e9f46b 100644 --- a/apps/marketing/src/app/marketplace/themes/page.tsx +++ b/apps/marketing/src/app/marketplace/themes/page.tsx @@ -17,8 +17,8 @@ export const metadata: Metadata = { }, }; -export default function MarketplaceThemesPage() { - initServerI18n(); +export default async function MarketplaceThemesPage() { + await initServerI18n(); const { t } = useLingui(); diff --git a/apps/marketing/src/app/mcp-install/page.tsx b/apps/marketing/src/app/mcp-install/page.tsx index 43aa163d56a..f754aa896c5 100644 --- a/apps/marketing/src/app/mcp-install/page.tsx +++ b/apps/marketing/src/app/mcp-install/page.tsx @@ -16,8 +16,8 @@ export const metadata: Metadata = { }, }; -export default function McpPage() { - initServerI18n(); +export default async function McpPage() { + await initServerI18n(); return (
diff --git a/apps/marketing/src/app/not-found.tsx b/apps/marketing/src/app/not-found.tsx index a079e2bca44..044ac97973b 100644 --- a/apps/marketing/src/app/not-found.tsx +++ b/apps/marketing/src/app/not-found.tsx @@ -11,8 +11,8 @@ export const metadata: Metadata = { robots: { index: false }, }; -export default function NotFound() { - initServerI18n(); +export default async function NotFound() { + await initServerI18n(); const { t } = useLingui(); diff --git a/apps/marketing/src/app/page.tsx b/apps/marketing/src/app/page.tsx index 2af0c2e3bdf..bde125e2f08 100644 --- a/apps/marketing/src/app/page.tsx +++ b/apps/marketing/src/app/page.tsx @@ -40,8 +40,8 @@ export const metadata: Metadata = { }, }; -export default function Home() { - initServerI18n(); +export default async function Home() { + await initServerI18n(); return (
diff --git a/apps/marketing/src/app/parallel-coding-agents/page.tsx b/apps/marketing/src/app/parallel-coding-agents/page.tsx index 31bde1571d5..b0b87ea41fd 100644 --- a/apps/marketing/src/app/parallel-coding-agents/page.tsx +++ b/apps/marketing/src/app/parallel-coding-agents/page.tsx @@ -7,8 +7,8 @@ import { getCategoryPage } from "@/lib/category"; const SLUG = "parallel-coding-agents"; -export default function ParallelCodingAgentsPage() { - initServerI18n(); +export default async function ParallelCodingAgentsPage() { + await initServerI18n(); const page = getCategoryPage(SLUG); diff --git a/apps/marketing/src/app/pricing/page.tsx b/apps/marketing/src/app/pricing/page.tsx index c39fdaba18a..0460d4969f4 100644 --- a/apps/marketing/src/app/pricing/page.tsx +++ b/apps/marketing/src/app/pricing/page.tsx @@ -18,8 +18,8 @@ export const metadata: Metadata = { }, }; -export default function PricingPage() { - initServerI18n(); +export default async function PricingPage() { + await initServerI18n(); // JSON-LD is machine-facing, so it gets rendered strings rather than the // message descriptors the UI components resolve through Lingui. diff --git a/apps/marketing/src/app/roadmap/page.tsx b/apps/marketing/src/app/roadmap/page.tsx index dd00b1860c3..96470dcbb17 100644 --- a/apps/marketing/src/app/roadmap/page.tsx +++ b/apps/marketing/src/app/roadmap/page.tsx @@ -28,8 +28,8 @@ export const metadata: Metadata = { }, }; -export default function RoadmapPage() { - initServerI18n(); +export default async function RoadmapPage() { + await initServerI18n(); const company = COMPANY.NAME; diff --git a/apps/marketing/src/app/starchart/page.tsx b/apps/marketing/src/app/starchart/page.tsx index d6d0a372aab..978adc760d1 100644 --- a/apps/marketing/src/app/starchart/page.tsx +++ b/apps/marketing/src/app/starchart/page.tsx @@ -45,7 +45,7 @@ function formatWeekDate(date: string): string { } export default async function StarChartPage() { - initServerI18n(); + await initServerI18n(); const { t } = useLingui(); const history = await getStarHistory(); diff --git a/apps/marketing/src/app/stats/page.tsx b/apps/marketing/src/app/stats/page.tsx index f859bf7ec05..ad06fedaedb 100644 --- a/apps/marketing/src/app/stats/page.tsx +++ b/apps/marketing/src/app/stats/page.tsx @@ -41,7 +41,7 @@ export const metadata: Metadata = { export const revalidate = 3600; export default async function StatsPage() { - initServerI18n(); + await initServerI18n(); const stats = await fetchStats({ period: "all" }); const range = stats?.range ? formatDayRange(stats.range) : null; diff --git a/apps/marketing/src/app/team/[id]/page.tsx b/apps/marketing/src/app/team/[id]/page.tsx index c585a8f4170..de94a167683 100644 --- a/apps/marketing/src/app/team/[id]/page.tsx +++ b/apps/marketing/src/app/team/[id]/page.tsx @@ -64,7 +64,7 @@ function PersonJsonLd({ } export default async function TeamMemberPage({ params }: PageProps) { - initServerI18n(); + await initServerI18n(); const { id } = await params; const person = getPersonById(id); diff --git a/apps/marketing/src/app/team/page.tsx b/apps/marketing/src/app/team/page.tsx index 329d51af7a5..cda436a9e1f 100644 --- a/apps/marketing/src/app/team/page.tsx +++ b/apps/marketing/src/app/team/page.tsx @@ -36,8 +36,8 @@ export const metadata: Metadata = { }, }; -export default function TeamPage() { - initServerI18n(); +export default async function TeamPage() { + await initServerI18n(); const { t } = useLingui(); const people = getAllPeople(); diff --git a/apps/marketing/src/app/user/[handle]/page.tsx b/apps/marketing/src/app/user/[handle]/page.tsx index 7ca374e5fd1..fabf008df9b 100644 --- a/apps/marketing/src/app/user/[handle]/page.tsx +++ b/apps/marketing/src/app/user/[handle]/page.tsx @@ -80,7 +80,7 @@ export async function generateMetadata({ } export default async function UserProfilePage({ params }: PageProps) { - initServerI18n(); + await initServerI18n(); const { t } = useLingui(); const { handle } = await params; diff --git a/packages/i18n/test/rsc-seeding.test.ts b/packages/i18n/test/rsc-seeding.test.ts index 6903048d38b..0a0056ca575 100644 --- a/packages/i18n/test/rsc-seeding.test.ts +++ b/packages/i18n/test/rsc-seeding.test.ts @@ -17,7 +17,11 @@ const ROUTE_ENTRY = /(?:^|\/)(?:page|not-found)\.tsx$/; // Anchored to the start of a line so a mention inside a comment or a string // literal cannot satisfy the check; paired with the import so the call has to // resolve to the real helper. -const SEEDS = /^\s*initServerI18n\(\);/m; +// The call must be awaited: a bare initServerI18n() activates the default +// locale and served every visitor English heroes above localized bodies — +// request-locale resolution is async, so an un-awaited call cannot have +// worked. (Regression guard for the 2026-08-29 production finding.) +const SEEDS = /^\s*(?:const\s+\w+\s*=\s*)?await initServerI18n\(\);/m; const IMPORTS = /^import\s*\{[^}]*\binitServerI18n\b[^}]*\}\s*from\s*["']/m; const USES_I18N = /= 300) return; // redirects and errors are the plain pass's job + const body = await res.text(); + const lang = body.match(/]*\slang="([^"]*)"/)?.[1]; + if (lang !== undefined && lang !== "ja") { + failures.push({ route, mode: "ja", detail: `served lang="${lang}"` }); + return; + } + if ((body.match(CJK)?.length ?? 0) < 10) { + failures.push({ + route, + mode: "ja", + detail: "no Japanese text in served HTML", + }); + } +} + async function hit(route: string, mode: "document" | "rsc") { const url = mode === "document" @@ -88,6 +132,7 @@ await waitForReady(); for (const route of routes) { await hit(route, "document"); await hit(route, "rsc"); + if (localized) await hitLocalized(route); const bad = failures.filter((f) => f.route === route); console.log( `${bad.length === 0 ? "ok " : "FAIL"} ${route}${bad.length ? ` ${bad.map((b) => `${b.mode}: ${b.detail}`).join("; ")}` : ""}`, From 9377cffeeff0f491b2e19276f2d65b2ab1af3805 Mon Sep 17 00:00:00 2001 From: Kiet Ho Date: Sat, 29 Aug 2026 09:05:46 -0700 Subject: [PATCH 2/2] style: sort imports Claude-Session: https://claude.ai/code/session_012U97YWVsDvZwQkBaSGEmor --- apps/marketing/src/app/i18n-server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/marketing/src/app/i18n-server.ts b/apps/marketing/src/app/i18n-server.ts index 34bf3580c53..8051b7c535c 100644 --- a/apps/marketing/src/app/i18n-server.ts +++ b/apps/marketing/src/app/i18n-server.ts @@ -1,8 +1,8 @@ +import { resolveLocale, type SupportedLocale } from "@superset/i18n"; import { initServerI18n as activateServerI18n, preloadServerLocale, } from "@superset/i18n/server"; -import { resolveLocale, type SupportedLocale } from "@superset/i18n"; import { headers } from "next/headers"; // "ja,en-US;q=0.9,en;q=0.8" -> ["ja", "en-US", "en"], ordered by quality.