Skip to content

feat: add Traditional Chinese (zh-tw) locale#219

Open
MakiDevelop wants to merge 6 commits intoshareAI-lab:mainfrom
MakiDevelop:feat/traditional-chinese
Open

feat: add Traditional Chinese (zh-tw) locale#219
MakiDevelop wants to merge 6 commits intoshareAI-lab:mainfrom
MakiDevelop:feat/traditional-chinese

Conversation

@MakiDevelop
Copy link
Copy Markdown

Summary

Add Traditional Chinese with Taiwan phrasing (zh-tw) as a new locale, sitting alongside existing en / zh / ja.

All doc content is converted from existing Simplified Chinese (docs/zh/) via OpenCC's s2twp profile, which produces Traditional Chinese with Taiwan vocabulary (e.g. 智能体→智慧體, 循环→迴圈, 代码→程式碼, 内存→記憶體, 数据库→資料庫).

Why

Readers in Taiwan and Hong Kong generally prefer Traditional characters plus localised tech vocabulary over direct Simplified→Traditional character conversion. s2twp handles both in one pass.

Changes

  • docs/zh-tw/ — 36 files converted from docs/zh/ via opencc -c s2twp.json
  • web/src/i18n/messages/zh-tw.json — UI string catalogue
  • Register zh-tw in:
    • web/src/lib/i18n.tsx (I18nProvider message map)
    • web/src/app/[locale]/layout.tsx (generateStaticParams + metadata)
    • web/src/components/layout/header.tsx (locale switcher, label 繁中)
    • web/src/app/[locale]/(learn)/docs/[slug]/page.tsx (SUPPORTED_LOCALES)
  • web/scripts/extract-content.ts — detect zh-tw/ subdirectory (ordered before zh/ check)
  • web/src/types/agent-data.ts — widen DocContent.locale union
  • web/src/data/generated/docs.json — regenerated build artefact

Notes

Some page-level inline copy objects (e.g. the s01 agent loop page's COPY record) still use narrow "en" | "zh" | "ja" keys. For those pages, zh-tw readers will see English chrome copy, the same fallback behaviour that ja currently hits in a few places. Main article body content is fully Traditional Chinese. Filling in the per-page zh-tw copy can be a follow-up.

Test plan

  • pnpm build succeeds (static export passes)
  • /zh-tw route generates for all 36 docs
  • Locale switcher shows 繁中 and routes correctly between en ↔ zh ↔ zh-tw ↔ ja
  • OpenCC conversion spot-checked for Taiwan phrasing

🤖 Generated with Claude Code

CrazyBoyM and others added 3 commits April 8, 2026 05:45
Add Traditional Chinese with Taiwan phrasing as a new locale alongside
existing en/zh/ja. All docs are converted from Simplified Chinese via
OpenCC s2twp (智能体→智慧體, 循环→迴圈, 代码→程式碼, 内存→記憶體, etc).

Changes:
- Add docs/zh-tw/ (36 files, converted from docs/zh/ via opencc -c s2twp.json)
- Add web/src/i18n/messages/zh-tw.json (UI strings)
- Register zh-tw in i18n provider, root layout, locale switcher, and
  static params generator
- Update extract-content.ts to detect zh-tw subdirectory
- Widen DocContent.locale union to include "zh-tw"

UI chrome for zh-tw falls back to English where inline literal copy
objects aren't yet translated (same behaviour as ja currently). Main
doc body content is fully Traditional Chinese.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 14, 2026

@MakiDevelop is attempting to deploy a commit to the crazyboym's projects Team on Vercel.

A member of the Team first needs to authorize it.

- 四語系 OG 圖(en/zh/zh-tw/ja,Gemini 3 Pro 生成,1200x630)
- layout.tsx 按 locale 對應 og:image,補 metadataBase / openGraph / twitter card
- 字體大小切換小/中/大(html font-size 14/16/18px,整站 rem 連動)
- Header desktop + mobile menu 各加一組「A A A」選擇器
- localStorage 持久化 + <head> inline script 避免 FOUC

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@CrazyBoyM CrazyBoyM force-pushed the main branch 2 times, most recently from 36897b1 to d882d01 Compare April 14, 2026 16:11
MakiDevelop and others added 2 commits April 27, 2026 11:18
- 加 web/public/hero-claude.webp(1536x1024 JPEG → 1280 寬 webp q85, 125K)
- [locale]/page.tsx hero 區塊頂部插入 img,max-w-3xl、rounded-2xl、fetchPriority=high
KV.{jpeg,png,webp} 為處理前源檔,最終版以 web/public/hero-*.webp
形式入版(已存在)。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants