Communitygithub.com

ComeOnOliver/skillshub

提取硬编码字符串以实现国际化,管理翻译文件,并确保语言覆盖范围。适用于多语言应用、翻译或当用户提及国际化、本地化或语言时使用。

skillshub 是什么?

此技能旨在帮助开发者有效管理应用程序的国际化(i18n)和本地化(l10n)需求。它涵盖从检测项目中使用的国际化框架(如 react-i18next、vue-i18n 或 Django i18n)到提取硬编码字符串并生成相应翻译文件的完整工作流程。技能的核心价值在于自动化地识别未翻译的 UI 文本,确保所有用户可见的文本都通过翻译函数引用,从而避免硬编码。此外,它还提供检查翻译覆盖率、处理复数规则、日期/数字格式以及支持从右到左(RTL)语言的最佳实践指导。该技能支持 JavaScript、Vue、Python 和 Ruby 等主流框架,并通过模板文件(如 `templates/locale-file.json`)帮助团队标准化翻译文件结构,最终显著提升多语言应用的开发效率和翻译质量。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/aiskillstore/marketplace/crazydubya/internationalization-helper

在你喜欢的 AI 中提问

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

文档

国际化助手

帮助管理多语言应用程序中的国际化(i18n)和本地化(l10n)。

何时使用

  • 用户请求国际化支持
  • 添加新语言
  • 查找未翻译的字符串
  • 管理翻译文件
  • 用户提到“翻译”、“i18n”、“l10n”、“locale”

说明

1. 检测国际化框架

JavaScript/React:

  • react-i18next
  • react-intl (FormatJS)
  • i18next
  • LinguiJS

Vue:

  • vue-i18n

Python:

  • gettext
  • Django i18n
  • Flask-Babel

Ruby/Rails:

  • I18n gem (内置)

查找导入语句、配置文件或翻译目录。

2. 查找硬编码字符串

搜索未翻译的文本:

// 错误:硬编码
<button>提交</button>
<p>欢迎,{user.name}!</p>

// 正确:已翻译
<button>{t('common.submit')}</button>
<p>{t('welcome.message', { name: user.name })}</p>

搜索模式:

  • JSX/模板标签中的字符串
  • 提示/错误消息
  • 表单标签和占位符
  • 按钮文本
  • 验证消息

排除项:代码注释、console.log、测试字符串

3. 提取到翻译文件

React-i18next 格式 (JSON):

{
  "common": {
    "submit": "提交",
    "cancel": "取消"
  },
  "welcome": {
    "message": "欢迎,{{name}}!"
  }
}

Gettext 格式 (.po):

msgid "submit_button"
msgstr "提交"

msgid "welcome_message"
msgstr "欢迎,%(name)s!"

4. 组织翻译键

最佳实践:

  • 按功能命名空间:users.profile.title
  • 分组公共字符串:common.buttons.save
  • 描述上下文而非内容:errors.login.invalid 不是 errors.wrong_password
  • 一致的命名约定

5. 检查翻译覆盖率

比较语言文件以查找缺失的翻译:

en.json: 150 个键
 es.json: 142 个键(缺失 8 个)
 fr.json: 150 个键 ✓

es.json 中缺失:
- users.profile.bio
- settings.privacy.title
[...]

6. 处理复数形式

不同语言有不同的复数规则:

// react-i18next
t('items', { count: 0 })  // "0 个项目"
t('items', { count: 1 })  // "1 个项目"
t('items', { count: 5 })  // "5 个项目"

// 翻译文件
{
  "items_zero": "{{count}} 个项目",
  "items_one": "{{count}} 个项目",
  "items_other": "{{count}} 个项目"
}

7. 日期、时间、数字格式化

使用区域感知的格式化:

// 数字
const price = new Intl.NumberFormat('en-US', {
  style: 'currency',
  currency: 'USD'
}).format(29.99);

// 日期
const date = new Intl.DateTimeFormat('fr-FR').format(new Date());

8. 从右到左(RTL)支持

适用于阿拉伯语、希伯来语:

  • CSS:direction: rtl;
  • HTML:<html dir="rtl">
  • 逻辑属性:使用 margin-inline-start 代替 margin-left

9. 生成翻译模板

为新语言环境创建模板:

# 从基础语言复制键值,并清空值
cp locales/en.json locales/de.json
# 标记为待翻译

10. 最佳实践

  • 将翻译文件分开存放
  • 使用键,而非源文本作为键
  • 为翻译人员提供上下文
  • 用长字符串进行测试(德语通常更长)
  • 对复杂字符串使用 ICU MessageFormat
  • 避免拼接已翻译的字符串
  • 提取所有面向用户的文本

支持文件

  • templates/i18n-config.js:配置示例
  • templates/locale-file.json:翻译文件模板

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

相关技能