Communitygithub.com

ComeOnOliver/skillshub

Next.js 多語言處理、語言路由與語言偵測策略的最佳實務。適用於在 Next.js 中新增 i18n、語言路由或語言偵測功能時使用。(觸發條件: middleware.ts, app/[lang]/**, pages/[locale]/**, messages/*.json, next.config.js, i18n, locale, translation, next-intl, react-intl, next-translate)

skillshub 是什麼?

此技能提供在 Next.js 專案中實作國際化 (i18n) 的一套完整最佳實務指南。它主要聚焦於維護單一事實來源 (single source of truth) 管理語言代碼,並採用對 SEO 友善的子路徑 (sub-path) 路由策略。技能涵蓋了 App Router 與 Pages Router 的設定,包含使用動態路徑區段 (dynamic segments) 進行語言路由、透過中介軟體 (middleware) 偵測使用者語言偏好、以及在伺服器端載入翻譯字典以避免客戶端臃腫。此外,它還提供了 hreflang 標籤的 SEO 設定指引、靜態頁面的語言預渲染,並指定了 next-intl、react-intl 等現代與傳統函式庫的使用建議,同時也明確指出應避免的反模式,例如在 JSX 中寫死字串或混合不同的語言路由模式。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/HoangNguyen0403/agent-skills-standard/nextjs-i18n

在你喜歡的 AI 中提問

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

說明文件

國際化 (i18n)

優先級:P2 (中等)

維護語言代碼的單一事實來源,並確保 SEO 友善的子路徑路由。

實作指南

  • 語言路由:遵循以 URL 優先的方法以利 SEO。在 App Router 中使用動態區段 (例如 app/[lang]/page.tsx),並在 Pages Router 中使用 next.config.js 中的 i18n 設定。
  • 函式庫選擇:對 App Router (現代) 使用 next-intl,對舊版應用程式使用 react-intl 或 next-translate。
  • 語言偵測:實作中介軟體本地化 (位於 middleware.ts),從 Accept-Language 標頭或 Cookie 偵測使用者語言,並執行重新導向。
  • 伺服器端:在伺服器元件中載入翻譯**messages/*.json** 字典,以保持客戶端套件小巧。使用 getMessages() 或 requestConfig 模式。
  • SEO:確保透過 metadata API 為所有已翻譯路由正確產生 hreflang 標籤。
  • 靜態生成:使用 generateStaticParams 在建置時預先渲染靜態頁面的本地化版本。
    module.exports = {
      i18n: {
        locales: ['en', 'fr', 'vi'],
        defaultLocale: 'en',
      },
    };
    

3. 函式庫細節

如需常用函式庫的詳細設定,請參閱:

反模式

  • 不要在 JSX 中寫死字串:使用翻譯鍵;絕不提交原始文字。
  • 不要使用客戶端翻譯套件:使用 getMessages() 在伺服器端載入字典。
  • 不要混合使用不同的 URL 語言模式:一致地使用子路徑或子網域。

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

相關技能