From 57b58cfa600f5398a0d717367e695a774831f891 Mon Sep 17 00:00:00 2001 From: OceanLi <122793010+ohdearquant@users.noreply.github.com> Date: Wed, 3 Jun 2026 14:51:05 -0400 Subject: [PATCH 1/2] feat(studio): establish i18n pipeline with en/zh catalogs (#1225) Wire next-intl end-to-end in apps/studio/frontend (Next.js 16 App Router): - i18n/request.ts getRequestConfig + NextIntlClientProvider in root layout - cookie-based locale (NEXT_LOCALE, no URL prefix/middleware), en fallback - LocaleSwitcher in the header with year-long cookie persistence - next.config.mjs: turbopack.resolveAlias for Next 16 next-intl compat Externalize strings (en baseline + real zh translations, 126/126 keys): - global nav/header (Shell, NavGroup, Breadcrumb, ProjectChip) - runs list (app/runs/page.tsx) and show detail (app/shows/[topic]/page.tsx) Remaining surfaces deferred and documented in SUMMARY.md. Critic gate: APPROVE (CRIT:0 MAJ:0 MIN:3 PASS:5). lint/typecheck/build green. Co-Authored-By: Claude Opus 4.8 --- apps/studio/frontend/app/layout.tsx | 20 +- apps/studio/frontend/app/runs/page.tsx | 82 ++++--- .../frontend/app/shows/[topic]/page.tsx | 138 ++++++------ apps/studio/frontend/components/Shell.tsx | 45 +++- .../frontend/components/nav/Breadcrumb.tsx | 47 +++- .../frontend/components/nav/NavGroup.tsx | 49 ++++- .../frontend/components/nav/ProjectChip.tsx | 14 +- apps/studio/frontend/i18n/request.ts | 18 ++ apps/studio/frontend/messages/en.json | 208 ++++++++++++++++++ apps/studio/frontend/messages/zh.json | 208 ++++++++++++++++++ apps/studio/frontend/next.config.mjs | 13 +- apps/studio/frontend/package.json | 1 + apps/studio/frontend/pnpm-lock.yaml | 97 ++++++++ 13 files changed, 814 insertions(+), 126 deletions(-) create mode 100644 apps/studio/frontend/i18n/request.ts create mode 100644 apps/studio/frontend/messages/en.json create mode 100644 apps/studio/frontend/messages/zh.json diff --git a/apps/studio/frontend/app/layout.tsx b/apps/studio/frontend/app/layout.tsx index 9972a2d09..cb448c400 100644 --- a/apps/studio/frontend/app/layout.tsx +++ b/apps/studio/frontend/app/layout.tsx @@ -1,5 +1,7 @@ import type { Metadata } from "next"; import type { ReactNode } from "react"; +import { NextIntlClientProvider } from "next-intl"; +import { getLocale, getMessages, getTranslations } from "next-intl/server"; import Shell from "@/components/Shell"; import { ToastProvider } from "@/components/Toast"; import "./globals.css"; @@ -9,13 +11,17 @@ export const metadata: Metadata = { description: "Lion Studio orchestration observability", }; -export default function RootLayout({ +export default async function RootLayout({ children, }: Readonly<{ children: ReactNode; }>) { + const locale = await getLocale(); + const messages = await getMessages(); + const t = await getTranslations({ locale, namespace: "common" }); + return ( - + {/* Prevent FOUC: read localStorage before paint, default to light */}