Communitygithub.com

Anhvu1107/all-agent-skill

當請求與國際化(i18n)和本地化(L10n)模式匹配時,請務必使用此技能。

all-agent-skill 是什麼?

這個 AI 代理技能專注於國際化(i18n)和本地化(L10n)的實作最佳實踐。它提供了一個結構化的指南,涵蓋了何時需要 i18n、常見框架(如 React 的 react-i18next、Next.js 的 next-intl 和 Python 的 gettext)的實作模式、建議的檔案結構(如按語言和功能命名空間的 JSON 檔案),以及關鍵的注意事項(如避免硬編碼字串、支援複數形式和 RTL 佈局)。技能還包含一個用於檢測硬編碼字串和遺漏翻譯的 Python 腳本(`scripts/i18n_checker.py`),以及一個詳盡的出貨前檢查清單。此技能支援包括 React、Next.js 和 Python 在內的多種平台,其內容基於一系列參考文件(如 `senior-master-standard.md`、`usage-routing.md` 和 `quality-checklist.md`),開發者可根據實際任務選擇性載入相關文件。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Anhvu1107/all-agent-skill/tree/HEAD/.agent/skills/i18n-localization

在你喜歡的 AI 中提問

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

說明文件

i18n 與本地化

選擇性閱讀規則

從以下文件開始:

  • references/senior-master-standard.md
  • references/usage-routing.md
  • references/quality-checklist.md

然後僅載入符合使用者實際任務的繼承文件、腳本、資產或範例。

國際化(i18n)和本地化(L10n)的最佳實務。


1. 核心概念

術語意義
i18n國際化 - 讓應用程式可翻譯
L10n本地化 - 實際的翻譯
Locale語言 + 地區(en-US、tr-TR)
RTL從右到左的語言(阿拉伯語、希伯來語)

2. 何時使用 i18n

專案類型需要 i18n?
公開網頁應用程式✅ 是
SaaS 產品✅ 是
內部工具⚠️ 可能
單一地區應用程式⚠️ 考慮未來需求
個人專案❌ 選擇性

3. 實作模式

React (react-i18next)

import { useTranslation } from 'react-i18next';

function Welcome() {
  const { t } = useTranslation();
  return <h1>{t('welcome.title')}</h1>;
}

Next.js (next-intl)

import { useTranslations } from 'next-intl';

export default function Page() {
  const t = useTranslations('Home');
  return <h1>{t('title')}</h1>;
}

Python (gettext)

from gettext import gettext as _

print(_("歡迎使用我們的應用程式"))

4. 檔案結構

locales/
├── en/
│   ├── common.json
│   ├── auth.json
│   └── errors.json
├── tr/
│   ├── common.json
│   ├── auth.json
│   └── errors.json
└── ar/          # RTL
    └── ...

5. 最佳實務

應該做 ✅

  • 使用翻譯鍵,而不是原始文字
  • 按功能命名空間來組織翻譯
  • 支援複數形式
  • 根據地區設定處理日期/數字格式
  • 從一開始就規劃 RTL 支援
  • 對於複雜字串使用 ICU 訊息格式

不應該做 ❌

  • 在元件中硬編碼字串
  • 串接已翻譯的字串
  • 假設文字長度(德語長度約增加 30%)
  • 忘記 RTL 版面配置
  • 在同一個檔案中混用語言

6. 常見問題

問題解決方案
缺少翻譯回退到預設語言
硬編碼字串使用 linter/檢查腳本
日期格式使用 Intl.DateTimeFormat
數字格式使用 Intl.NumberFormat
複數形式使用 ICU 訊息格式

7. RTL 支援

/* CSS 邏輯屬性 */
.container {
  margin-inline-start: 1rem;  /* 而非 margin-left */
  padding-inline-end: 1rem;   /* 而非 padding-right */
}

[dir="rtl"] .icon {
  transform: scaleX(-1);
}

8. 檢查清單

出貨前請確認:

  • 所有面向使用者的字串皆使用翻譯鍵
  • 所有支援語言的語言檔均已存在
  • 日期/數字格式使用 Intl API
  • RTL 版面配置已測試(如適用)
  • 已設定回退語言
  • 元件中沒有硬編碼字串

腳本

腳本用途命令
scripts/i18n_checker.py檢測硬編碼字串與遺漏的翻譯python scripts/i18n_checker.py <project_path>

Individual skills in this repo

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

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches 007: Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Agentfolio: Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Animejs Animation: Advanced JavaScript animation library skill for creating complex, high-performance web animations.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Astropy: Astropy is the core Python package for astronomy, providing essential functionality for astronomical research and data analysis.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Astro: Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Emotional ARC Designer: One sentence - what this skill does and when to invoke it

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Fixing Motion Performance: Audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Interactive Portfolio: Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches JQ: Expert jq usage for JSON querying, filtering, transformation, and pipeline integration.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Landing Page Generator: Generates high-converting Next.js/React landing pages with Tailwind CSS.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches LEX: Centralized ''Truth Engine'' for cross-jurisdictional legal context (US, EU, CA) and contract scaffolding.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Magic Animator: AI-powered animation tool for creating motion in logos, UI, icons, and social media assets.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Makepad Animation: CRITICAL: Use for Makepad animation system.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Nextjs APP Router Patterns: Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.

Anhvu1107/all-agent-skill

ALWAYS use this when the user mentions Nextjs Best Practices, asks to build, debug, review, document, automate, test, configure, migrate, or make decisions in this domain, or the task clearly depends on Nextjs Best Practices; scope: Next.js App Router principles. Apply the bundled workflow, references, scripts, Senior Master standard, and Codex strict review gate before final output.

Anhvu1107/all-agent-skill

description: ALWAYS use this when the work is specifically about modern Next.js or React architecture, data flow, rendering strategy, routing, or performance-sensitive frontend behavior.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Nextjs Supabase Auth: Expert integration of Supabase Auth with Next.js App Router

Anhvu1107/all-agent-skill

ALWAYS use this when the task involves reading, extracting, splitting, merging, rotating, creating, validating, OCR-ing, form-filling, or otherwise producing or modifying PDF files.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches React Nextjs Development: React and Next.js 14+ application development with App Router, Server Components, TypeScript, Tailwind CSS, and modern frontend patterns.

Anhvu1107/all-agent-skill

ALWAYS use this when working with Remotion code, video compositions, rendering logic, timing, media assets, or React-based motion workflows.

相關技能