Communitygithub.com

Desesbraker/agentes-vip

国际化与本地化模式:检测硬编码字符串、管理翻译、语言文件及 RTL 支持。

agentes-vip 是什么?

该技能专注于国际化和本地化的最佳实践,帮助开发者确保应用具备多语言支持能力。它覆盖了从核心概念(如 i18n、L10n、区域和 RTL)到具体实现模式的全流程,包括 React (react-i18next)、Next.js (next-intl) 和 Python (gettext) 等主流框架的代码示例。技能还提供了标准的文件结构规划、常见问题解决方案(如缺失翻译回退、日期数字格式使用 Intl API)以及 RTL 布局的 CSS 逻辑属性说明。适用于需要面向全球用户部署的公共 Web 应用、SaaS 产品等场景,通过内置的 `scripts/i18n_checker.py` 脚本可自动检测硬编码字符串和缺失翻译,从而确保代码质量。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Desesbraker/agentes-vip/tree/HEAD/full%20skill/plugins/antigravity-awesome-skills-claude/skills/i18n-localization

在你喜欢的 AI 中提问

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

文档

i18n 与本地化

国际化 (i18n) 和本地化 (L10n) 的最佳实践。


1. 核心概念

术语含义
i18n国际化 - 使应用可翻译
L10n本地化 - 实际翻译
区域语言 + 地区 (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(_("Welcome to our app"))

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 16 individual skills — each has its own dedicated page.

Desesbraker/agentes-vip

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

Desesbraker/agentes-vip

Advanced JavaScript animation library skill for creating complex, high-performance web animations.

Desesbraker/agentes-vip

Audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects. Use when animations stutter, transitions jank, or reviewing CSS/JS animation performance.

Desesbraker/agentes-vip

AI-powered animation tool for creating motion in logos, UI, icons, and social media assets.

Desesbraker/agentes-vip

CRITICAL: Use for Makepad animation system. Triggers on: makepad animation, makepad animator, makepad hover, makepad state, makepad transition, "from: { all: Forward", makepad pressed, makepad 动画, makepad 状态, makepad 过渡, makepad 悬停效果

Desesbraker/agentes-vip

Best practices for Remotion - Video creation in React

Desesbraker/agentes-vip

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

Desesbraker/agentes-vip

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

Desesbraker/agentes-vip

Three.js animation - keyframe animation, skeletal animation, morph targets, animation mixing. Use when animating objects, playing GLTF animations, creating procedural motion, or blending animations.

Desesbraker/agentes-vip

Automate TikTok tasks via Rube MCP (Composio): upload/publish videos, post photos, manage content, and view user profiles/stats. Always search tools first for current schemas.

Desesbraker/agentes-vip

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.

Desesbraker/agentes-vip

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

Desesbraker/agentes-vip

Automate YouTube tasks via Rube MCP (Composio): upload videos, manage playlists, search content, get analytics, and handle comments. Always search tools first for current schemas.

Desesbraker/agentes-vip

Extract transcripts from YouTube videos and generate comprehensive, detailed summaries using intelligent analysis frameworks

Desesbraker/agentes-vip

Generates high-converting Next.js/React landing pages with Tailwind CSS. Uses PAS, AIDA, and BAB frameworks for optimized copy/components (Heroes, Features, Pricing). Focuses on Core Web Vitals/SEO.

Desesbraker/agentes-vip

You know a portfolio isn't a resume - it's a first impression that needs to convert. You balance creativity with usability. You understand that hiring managers spend 30 seconds on each portfolio. You make those 30 seconds count. You help people stand out without being gimmicky.

相关技能