From 290fd50d2758aecfba6dd75ffaab4c2acfa45f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9D=90=93=F0=9D=90=9E=F0=9D=90=9A=F0=9D=90=A4?= =?UTF-8?q?=F0=9D=90=A8=F0=9D=90=B0=F0=9D=90=9A?= <27560638+Teakowa@users.noreply.github.com> Date: Sun, 27 Sep 2026 19:09:02 +0800 Subject: [PATCH] feat: add Simplified Chinese homepage --- README.md | 7 +- scripts/verify-build.mjs | 34 ++++ src/app.html | 2 +- src/hooks.server.ts | 14 ++ src/lib/components/AgentsSection.svelte | 5 +- src/lib/components/CopyButton.svelte | 14 +- src/lib/components/EcosystemSection.svelte | 5 +- src/lib/components/Footer.svelte | 7 +- src/lib/components/Header.svelte | 44 ++++- src/lib/components/Hero.svelte | 9 +- src/lib/components/InstallSection.svelte | 16 +- src/lib/components/LanguagesSection.svelte | 10 +- src/lib/components/Terminal.svelte | 9 +- src/lib/components/ThemeSwitcher.svelte | 15 +- src/lib/components/ToolingSection.svelte | 5 +- src/lib/i18n.ts | 92 ++++++++++ src/lib/site.ts | 3 +- src/lib/site.zh-CN.ts | 197 +++++++++++++++++++++ src/routes/+layout.svelte | 10 +- src/routes/+page.svelte | 20 ++- src/routes/zh-CN/+page.svelte | 36 ++++ 21 files changed, 509 insertions(+), 45 deletions(-) create mode 100644 src/hooks.server.ts create mode 100644 src/lib/i18n.ts create mode 100644 src/lib/site.zh-CN.ts create mode 100644 src/routes/zh-CN/+page.svelte diff --git a/README.md b/README.md index 5f16f13..9184e55 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,11 @@ that a capability ships. Describe direction (for example the intent-driven agent loop) as direction, not as current behavior. Keep internal terms such as WIR, HIR, frontend, and provider out of primary homepage messaging. -All copy, navigation, and support claims live in `src/lib/site.ts`. The hero -terminal shows real `wright` output; refresh it when the CLI output changes. +English copy, navigation, and support claims live in `src/lib/site.ts`; the +Simplified Chinese translation lives in `src/lib/site.zh-CN.ts`. `/` is the +English homepage and `/zh-CN` is the Simplified Chinese homepage. Keep capability +claims aligned across both locales, while commands and CLI output remain literal. +The hero terminal shows real `wright` output; refresh it when the CLI output changes. ## Stack diff --git a/scripts/verify-build.mjs b/scripts/verify-build.mjs index d9e503b..b99c3fd 100644 --- a/scripts/verify-build.mjs +++ b/scripts/verify-build.mjs @@ -41,3 +41,37 @@ for (const installer of installers) { process.exit(1); } } + + +const homepageChecks = [ + { + name: 'English homepage', + paths: [resolve(ROOT_DIR, 'build/index.html')], + lang: 'en', + marker: 'Workshop tooling that shows its work.' + }, + { + name: 'Simplified Chinese homepage', + paths: [resolve(ROOT_DIR, 'build/zh-CN.html'), resolve(ROOT_DIR, 'build/zh-CN/index.html')], + lang: 'zh-CN', + marker: '让判断过程清楚可见的 Workshop 工具。' + } +]; + +for (const page of homepageChecks) { + const path = page.paths.find((candidate) => existsSync(candidate)); + if (!path) { + console.error(`[verify-build] Error: ${page.name} was not prerendered.`); + process.exit(1); + } + + const content = readFileSync(path, 'utf8'); + if (!content.includes(``)) { + console.error(`[verify-build] Error: ${page.name} has the wrong html lang attribute.`); + process.exit(1); + } + if (!content.includes(page.marker)) { + console.error(`[verify-build] Error: ${page.name} is missing localized homepage copy.`); + process.exit(1); + } +} diff --git a/src/app.html b/src/app.html index 91a4496..24199a9 100644 --- a/src/app.html +++ b/src/app.html @@ -1,5 +1,5 @@ - +
diff --git a/src/hooks.server.ts b/src/hooks.server.ts new file mode 100644 index 0000000..5368ac3 --- /dev/null +++ b/src/hooks.server.ts @@ -0,0 +1,14 @@ +import type { Handle } from '@sveltejs/kit'; +import { contentForPath } from '$lib/i18n'; + +export const handle: Handle = ({ event, resolve }) => { + const lang = contentForPath(event.url.pathname).language.htmlLang; + + return resolve(event, { + transformPageChunk: ({ html }) => + html.replace( + '', + `` + ) + }); +}; diff --git a/src/lib/components/AgentsSection.svelte b/src/lib/components/AgentsSection.svelte index 25d30c6..7b2ceaa 100644 --- a/src/lib/components/AgentsSection.svelte +++ b/src/lib/components/AgentsSection.svelte @@ -1,6 +1,9 @@