Communitygithub.com

JantonioFC/skillsbank

國際化與本地化模式。偵測硬編碼字串、管理翻譯、語言環境檔案、RTL 支援。

skillsbank 是什麼?

此技能專注於國際化(i18n)與本地化(L10n)的最佳實務,協助開發者建立可翻譯的應用程式。它涵蓋核心概念(如語言環境、RTL 支援)、何時應導入 i18n 的決策指南(從公開網頁應用到個人專案),以及 React、Next.js 和 Python 等主流框架的實作模式。技能也提供完整的檔案結構範例、最佳實踐(例如使用翻譯鍵而非原始文字、按功能組織翻譯命名空間)、RTL 支援的 CSS 邏輯屬性,以及一個內建偵測硬編碼字串與缺失翻譯的檢查腳本。此技能支援 Claude Code、Coder、Codex 等平台,並透過明確的檢查清單與常見問題解決方案,確保開發者能全面控管在地化流程。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/JantonioFC/skillsbank/tree/HEAD/plugins/antigravity-awesome-skills-claude/skills/i18n-localization

在你喜歡的 AI 中提問

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

說明文件

i18n 與在地化

國際化(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.

JantonioFC/skillsbank

AI-powered image editing with style transfer and object removal

JantonioFC/skillsbank

Analise e auditoria de editais de leilao judicial e extrajudicial. Riscos ocultos, clausulas perigosas, debitos, ocupante e classificacao da oportunidade.

JantonioFC/skillsbank

Embed Photopea in web apps using photopea.js. Covers embedding, file I/O, scripting, exporting, layers, text, filters, and the full Photoshop-compatible API.

JantonioFC/skillsbank

Best practices for Remotion - Video creation in React

JantonioFC/skillsbank

Generate walkthrough videos from Stitch projects using Remotion with smooth transitions, zooming, and text overlays

JantonioFC/skillsbank

Seek and analyze video content using Memories.ai Large Visual Memory Model for persistent video intelligence

JantonioFC/skillsbank

Writes complete, structured landing pages optimized for SEO ranking, AEO citation, and visitor conversion. Activate when the user wants to write or generate a landing page for a product, service, or offer.

JantonioFC/skillsbank

Video and audio perception, indexing, and editing. Ingest files/URLs/live streams, build visual/spoken indexes, search with timestamps, edit timelines, add overlays/subtitles, generate media, and create real-time alerts.

JantonioFC/skillsbank

Upload, stream, search, edit, transcribe, and generate AI video and audio using the VideoDB SDK.

JantonioFC/skillsbank

Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

JantonioFC/skillsbank

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

JantonioFC/skillsbank

Tool lifecycle UI components for React/Next.js from ui.inference.sh. Display tool calls: pending, progress, approval required, results. Capabilities: tool status, progress indicators, approval flows, results display. Use for: showing agent tool calls, human-in-the-loop approvals, tool output. Triggers: tool ui, tool calls, tool status, tool approval, tool results, agent tools, mcp tools ui, function calling ui, tool lifecycle, tool pending

JantonioFC/skillsbank

Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

JantonioFC/skillsbank

When the user wants help with paid advertising campaigns on Google Ads, Meta (Facebook/Instagram), LinkedIn, Twitter/X, or other ad platforms. Also use when the user mentions 'PPC,' 'paid media,' 'ROAS,' 'CPA,' 'ad campaign,' 'retargeting,' 'audience targeting,' 'Google Ads,' 'Facebook ads,'...

JantonioFC/skillsbank

Create AI avatar and talking head videos with OmniHuman, Fabric, PixVerse via inference.sh CLI. Models: OmniHuman 1.5, OmniHuman 1.0, Fabric 1.0, PixVerse Lipsync. Capabilities: audio-driven avatars, lipsync videos, talking head generation, virtual presenters. Use for: AI presenters, expla...

JantonioFC/skillsbank

Create AI marketing videos for ads, promos, product launches, and brand content. Models: Veo, Seedance, Wan, FLUX for visuals, Kokoro for voiceover. Types: product demos, testimonials, explainers, social ads, brand videos. Use for: Facebook ads, YouTube ads, product launches, brand awarene...

JantonioFC/skillsbank

Generate AI videos with Google Veo, Seedance, Wan, Grok and 40+ models via inference.sh CLI. Models: Veo 3.1, Veo 3, Seedance 1.5 Pro, Wan 2.5, Grok Imagine Video, OmniHuman, Fabric, HunyuanVideo. Capabilities: text-to-video, image-to-video, lipsync, avatar animation, video upscaling, fole...

JantonioFC/skillsbank

Production-ready CI/CD configurations for Playwright — GitHub Actions, GitLab CI, CircleCI, Azure DevOps, Jenkins, Docker, parallel sharding, reporting, code coverage, and global setup/teardown.

JantonioFC/skillsbank

Next.js 16+ and Turbopack — incremental bundling, FS caching, dev speed, and when to use Turbopack vs webpack.

JantonioFC/skillsbank

You are an expert copy editor specializing in marketing and conversion copy. Your goal is to systematically improve existing copy through focused editing passes while preserving the core message.

相關技能