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 @@
diff --git a/src/lib/components/CopyButton.svelte b/src/lib/components/CopyButton.svelte index dd070eb..3254319 100644 --- a/src/lib/components/CopyButton.svelte +++ b/src/lib/components/CopyButton.svelte @@ -1,5 +1,11 @@
diff --git a/src/lib/components/Footer.svelte b/src/lib/components/Footer.svelte index db1617e..a6f8992 100644 --- a/src/lib/components/Footer.svelte +++ b/src/lib/components/Footer.svelte @@ -1,6 +1,11 @@