Communitygithub.com

JantonioFC/skillsbank

用于在UI代码库(React/TS、i18next或类似框架、JSON locale)中设置、审计或强制执行国际化/本地化,包括安装/配置i18n框架、替换硬编码字符串、确保en-US/zh-CN覆盖。

skillsbank 是什么?

这是一个全面的i18n(国际化)专家技能,专为开发者工具(如Claude Code)设计。其主要功能是自动化UI代码库的国际化设置、审计和强制执行过程。该技能支持React、Next.js和Vue等主流框架,默认目标语言为en-US和zh-CN。工作流程包括:确认范围并设置i18n基线(安装库、配置Provider、设置语言切换器)、审计键值使用和语言文件一致性、查找并替换原始用户可见字符串为翻译键、本地化错误处理、更新语言文件,最后验证直到无缺失或差异。它还提供了严格的防护规则(如不暴露原始错误消息)、性能建议(懒加载捆绑包)和验证清单。通过集成审计脚本和清晰的交付物定义,确保国际化过程高效且无遗漏。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/JantonioFC/skillsbank/tree/HEAD/skills/localization-toolkit

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

I18n 专家

概述

完成完整的 i18n 设置 + 审计流程:配置 i18n 框架、将用户可见字符串替换为键、确保语言文件一致性、验证 en-US 和 zh-CN 的复数/格式化规则。

核心能力

  • 库的选择和设置(React、Next.js、Vue)。
  • 键架构和语言文件组织。
  • 翻译生成和质量策略(AI、专业、手动)。
  • 路由和语言检测/切换。
  • SEO 和元数据本地化(适用时)。
  • RTL 支持(仅当 RTL 语言在范围内)。

范围输入(如果不明确请询问)

  • 框架和路由风格。
  • 现有 i18n 状态(无、部分、遗留)。
  • 目标语言(默认:en-US + zh-CN)。
  • 翻译质量需求(AI vs 专业 vs 手动)。
  • 使用的语言格式(JSON、YAML、PO、XLIFF)。
  • 形式/文化要求(如有)。

工作流程(审计 -> 修复 -> 验证)

  1. 确认范围和语言目标
  • 确定 i18n 框架和语言文件位置。
  • 确认语言;当指定时默认使用 en-US + zh-CN。
  1. 设置 i18n 基线(如果缺失)
  • 选择适合框架的库(例如,React:react-i18next;Next.js:next-intl;Vue:vue-i18n)。
  • 安装包并创建 i18n 入口/配置文件。
  • 在应用根节点中连接 Provider 并加载语言资源。
  • 添加语言切换器和持久化机制(路由/参数/localStorage 视情况而定)。
  • 建立语言文件布局和键命名空间。
  • 如果路由是语言感知的,尽早定义语言段策略(子路径、子域名、查询参数)。
  • 如果元数据对用户可见,包括标题/描述的翻译。
  1. 审计键使用和语言文件一致性
  • 运行:
    python scripts/i18n_audit.py --src <src-root> --locale <path/to/en-US.json> --locale <path/to/zh-CN.json>
    
  • 将缺失键/一致性差距视为阻碍项。
  • 手动验证动态键(t(var))。
  1. 查找原始用户可见字符串
  • 搜索:
    rg -n --glob '<src>/**/*.{ts,tsx,js,jsx}' "<[^>]+>[^<{]*[A-Za-z][^<{]*<"
    rg -n --glob '<src>/**/*.{ts,tsx,js,jsx}' "aria-label=\"[^\"]+\"|title=\"[^\"]+\"|placeholder=\"[^\"]+\""
    
  • 本地化无障碍标签。
  1. 将字符串替换为键
  • 对 UI 文本使用 t('namespace.key')。
  • 对于复数使用 t('key', { count }) + _one/_other 键。
  • 对时间/日期/数字使用 Intl/应用格式化器。
  1. 本地化错误处理(关键)
  • 将错误代码映射到本地化键;仅显示本地化 UI。
  • 仅记录原始错误详细信息。
  • 对未知代码提供本地化后备。
  1. 更新语言文件
  • 在两种语言中添加缺失的键。
  • 保持占位符一致;除非请求,否则避免重命名。
  • 使用商定的方法生成翻译;保留占位符和复数规则。
  1. 验证
  • 重新运行审计直到缺失/一致性问题为零。
  • 验证 JSON(例如,python -m json.tool <file>)。
  • 更新断言可见文本的测试。

防护规则

  • 切勿将原始 error.message 暴露给 UI;仅显示本地化字符串。
  • 除非明确请求,否则不要添加额外的语言。
  • 首选结构化命名空间(例如,errors.*、buttons.*、workspace.*)。
  • 保持翻译简洁一致。
  • 某些技术/品牌术语应保留不翻译(例如,产品名称、API、MCP、Bash)。

交付物(预期输出)

  • i18n 配置/提供者连接。
  • 每种目标语言的语言文件。
  • 将 UI 字符串替换为稳定的键。
  • 语言切换器和持久化机制(如适用)。
  • 更新用于可见文本的测试。

架构指南(保持简洁)

  • 键结构:按区域优先使用嵌套命名空间(例如,common.buttons.save、pricing.tier.pro)。
  • 文件布局:每种语言一个文件或每种语言一个命名空间;保持键在语言之间同步。
  • 占位符:精确保留 {name}/{{name}};根据语言规则验证复数。
  • 格式化:对日期、时间、数字和列表格式化使用 Intl/应用辅助函数。
  • SEO/元数据:如果应用暴露它们,则本地化标题和描述。
  • RTL:仅 RTL 语言需要;使用逻辑 CSS 属性并测试布局。
  • 非 Web 界面(Electron 主进程对话框、CLI 提示、原生菜单)也需要本地化。

性能说明(简短)

  • 当应用支持时,惰性加载语言包。
  • 按命名空间拆分大型语言文件。

失败模式(观察列表)

  • 缺少翻译:回退到默认语言并记录警告。
  • RTL 布局问题:验证逻辑 CSS 并测试页面。
  • SEO 缺失:确保在适用时本地化 alternative 链接和元数据。

验证清单(简短)

  • 没有缺失的键,没有原始 UI 字符串。
  • 语言切换有效且持久。
  • 在两种语言中验证复数和格式化。
  • 配置了回退语言。

资源

scripts/

  • scripts/i18n_audit.py:提取 t('key') 的使用情况并与语言 JSON 文件进行比较。

激活触发器

将错误代码映射到本地化消息,并验证键一致性、复数和格式化。

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

Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.

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

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.

相关技能