Communitygithub.com

ComeOnOliver/skillshub

為 Next.js 網站添加多語言支援,並提供適當的 SEO 配置,包括 hreflang 標籤、在地化 Sitemap 以及語言特定內容。適用於新增語言、設定 i18n、優化國際 SEO,或當使用者提及在地化、翻譯、多語言、日文、韓文、中文等情境。

skillshub 是什麼?

此技能提供一個完整的工作流程,讓開發者能為 Next.js 網站新增多語言支援,同時遵循國際 SEO 最佳實務。它涵蓋了從準備基礎語言檔案、新增語言檔案、更新配置、添加翻譯,到設定 hreflang 標籤、本地化 Sitemap 以及驗證測試的完整步驟。此技能特別適用於使用 next-intl 的專案,並支援多種語言(如日文、韓文、中文)以及語言代碼標準(ISO 639-1)。透過自動化腳本(如 i18n-add-languages.mjs)和詳細的檢查清單,它能大幅簡化 i18n 設定流程,確保網站能正確服務不同語言版本,避免重複內容懲罰,並提升多語言搜尋引擎最佳化效果。開發者也可以在 Claude Code、Cursor 或 Codex 等 AI 代理工具中使用此技能,快速完成多語言網站開發。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/aiskillstore/marketplace/zhanlincui/internationalizing-websites

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

網站的國際化

為 Next.js 網站添加多語言支援的完整工作流程,並遵循 SEO 最佳實務。

何時使用此技能

  • 為現有網站新增語言版本
  • 為新網站設定 i18n(國際化)
  • 配置多語言的 SEO
  • 使用者提及:「添加語言」、「翻譯」、「在地化」、「hreflang」、「多語言」

支援的語言

常見目標市場:

  • 🇺🇸 英文 (en) - 全球市場
  • 🇯🇵 日文 (ja) - 亞洲市場
  • 🇨🇳 中文 (zh) - 中國市場

擴展支援:

  • 韓文 (ko)、葡萄牙文 (pt)、西班牙文 (es)、法文 (fr)、德文 (de)
  • 阿拉伯文 (ar)、越南文 (vi)、印地文 (hi)、印尼文 (id)、泰文 (th)
  • 繁體中文 (zh-hk)、義大利文 (it)、俄文 (ru)

國際化工作流程

複製此檢查清單並追蹤你的進度:

i18n 進度:
- [ ] 步驟 1:準備基礎語言檔案
- [ ] 步驟 2:新增語言檔案
- [ ] 步驟 3:更新配置檔案
- [ ] 步驟 4:添加翻譯
- [ ] 步驟 5:配置 SEO 元素
- [ ] 步驟 6:驗證與測試

步驟 1:準備基礎語言檔案

確保英文(en.json)檔案存在,作為範本:

必要目錄:

  • i18n/messages/en.json - 主要翻譯
  • i18n/pages/landing/en.json - 登陸頁面翻譯

驗證結構:

# 檢查基礎檔案是否存在
ls i18n/messages/en.json
ls i18n/pages/landing/en.json

如果缺少,請為你的網站建立包含完整翻譯鍵的檔案。

步驟 2:新增語言檔案

執行語言添加腳本:

node scripts/i18n-add-languages.mjs

此腳本的作用:

  • 將 en.json 複製到所有目標語言檔案
  • 更新 i18n/locale.ts 以包含新的語言環境
  • 更新 i18n/request.ts 的語言映射
  • 更新 public/sitemap.xml 以包含新的語言 URL

腳本配置(在 i18n-add-languages.mjs 中):

  • languages 陣列 - 要添加的語言列表
  • languageNames 物件 - 語言的顯示名稱
  • targetDirs 陣列 - 包含翻譯檔案的目錄

請參閱 WORKFLOW.md 取得詳細的逐步指南。

步驟 3:驗證配置更新

檢查 i18n/locale.ts:

export const locales = ["en", "ja", "zh", "ko", ...];

export const localeNames: any = {
  en: "English",
  ja: "日本語",
  zh: "中文",
  ko: "한국어",
  ...
};

檢查 i18n/request.ts:

  • 已配置語言代碼映射
  • 存在 zh-CN → zh、zh-HK → zh-hk 的映射

檢查 public/sitemap.xml:

  • 列出所有語言版本
  • 每個 URL 都包含 hreflang 標籤

步驟 4:添加翻譯

選項 A:使用 AI 翻譯(較快但需審閱):

# 添加結構化資料和定價翻譯
node scripts/i18n-add-schema.js

在腳本的 translations 物件中配置翻譯。

選項 B:手動翻譯(建議以確保品質):

使用適當的翻譯編輯每個語言檔案:

# 開啟語言檔案
code i18n/messages/ja.json

翻譯最佳實務:

  • 盡可能使用母語者
  • 維持目標語言的 SEO 關鍵字
  • 根據當地文化調整內容,不要只是翻譯
  • 保持格式一致(佔位符、變數)

請參閱 reference/locale-codes.md 取得語言代碼參考。

步驟 5:配置 SEO 元素

hreflang 標籤 - 透過 Sitemap 自動產生,但請驗證:

請參閱 reference/hreflang-guide.md 取得完整指南。

本地化的 meta 標籤 - 在每個語言檔案中翻譯:

{
  "metadata": {
    "title": "你的網站標題",
    "description": "你的 SEO 描述"
  }
}

URL 結構 - 驗證正確格式:

  • 英文:https://example.com/ 或 https://example.com/en/
  • 日文:https://example.com/ja/
  • 中文:https://example.com/zh/

步驟 6:驗證與測試

建置專案:

npm run build

關鍵:在繼續之前修正所有錯誤。

手動測試:

  1. 語言切換器:

    • 造訪每個語言版本
    • 確認語言切換器顯示所有語言
    • 點擊每個語言連結,確認載入正確頁面
  2. 內容顯示:

    • 檢查所有頁面在每個語言中正確呈現
    • 確認沒有未翻譯的文字(在非英文頁面中檢查是否有英文)
    • 測試特殊字元是否正確顯示(日文、中文、阿拉伯文)
  3. SEO 元素:

    • 檢查 <html lang="..."> 屬性是否與頁面語言相符
    • 確認 <link rel="alternate" hreflang="..."> 標籤存在
    • 檢查 meta 標籤是否使用正確語言

自動化驗證:

# 檢查 Sitemap
curl https://your-site.com/sitemap.xml | grep hreflang

# 驗證 hreflang(使用線上工具)
# Google Search Console > 國際化 > hreflang

SEO 檢查清單 - 請參閱 reference/seo-checklist.md。

如果驗證失敗:

  • 仔細查看錯誤訊息
  • 檢查配置檔案是否有錯字
  • 確認語言代碼是否正確
  • 回到步驟 3 並修正問題

只在所有驗證通過後才繼續。

重要說明

語言代碼標準

使用 ISO 639-1(兩個字母的代碼),並可選用區域變體:

  • en - 英文
  • ja - 日文
  • zh - 簡體中文
  • zh-hk - 繁體中文(香港)
  • pt - 葡萄牙文
  • pt-br - 巴西葡萄牙文

請參閱 reference/locale-codes.md 取得完整列表。

SEO 影響

正確的 i18n 可改善 SEO,因為:

  • 以使用者的母語為目標
  • 避免重複內容懲罰
  • 協助搜尋引擎提供正確的語言版本

常見的 SEO 錯誤(應避免):

  • ❌ 根據 IP 自動重新導向(會阻止搜尋引擎爬取所有版本)
  • ❌ 缺少 hreflang 標籤(會導致重複內容問題)
  • ❌ 不同語言之間的 URL 結構不一致
  • ❌ 未翻譯的 meta 標籤

翻譯品質

AI 翻譯 vs 人類翻譯:

  • ✅ AI:快速、成本效益高,適用於初稿
  • ⚠️ AI:可能忽略文化細微差別,需要審閱
  • ✅ 人類:品質較佳、能適應文化
  • ⚠️ 人類:較慢、費用較高

建議方法:

  1. 使用 AI 產生初始翻譯
  2. 請母語者審閱並潤飾
  3. 與目標市場使用者測試
  4. 根據回饋迭代

Next.js i18n 路由

系統使用 next-intl 進行路由:

  • 從 URL 自動偵測語言環境
  • 語言切換器元件
  • 在地化的導航

配置位於 i18n/locale.ts 和 i18n/request.ts。

國際化後續任務

在添加語言之後:

  1. 將更新後的 Sitemap 提交至 Google Search Console
  2. 為每個語言/區域建立獨立的 Search Console 資源
  3. 在 Analytics 中監控國際自然流量
  4. 如果不同語言的轉換率有差異,進行 A/B 測試翻譯
  5. 設定國際爬取錯誤的警示

腳本位置

所有 i18n 腳本都位於 scripts/ 目錄中:

  • i18n-add-languages.mjs - 新增語言檔案
  • i18n-add-schema.js - 新增結構化資料翻譯

參考資料

如需疑難排解,請參閱 WORKFLOW.md 的疑難排解章節。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

相關技能