localize
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWhen this skill is invoked:
-
Parse the subcommand from the argument:
- — Scan for localization issues (hardcoded strings, missing keys)
scan - — Extract new strings and generate/update string tables
extract - — Validate existing translations for completeness and format
validate - — Report overall localization status
status
-
For:
scan- Search for hardcoded user-facing strings:
src/- String literals in UI code that are not wrapped in a localization function
- Concatenated strings that should be parameterized
- Strings with positional placeholders (,
%s) instead of named ones (%d){playerName}
- Search for localization anti-patterns:
- Date/time formatting not using locale-aware functions
- Number formatting without locale awareness
- Text embedded in images or textures (flag asset files)
- Strings that assume left-to-right text direction
- Report all findings with file paths and line numbers
- Search
-
For:
extract- Scan all source files for localized string references
- Compare against the existing string table (if any) in
assets/data/ - Generate new entries for strings that don't have keys yet
- Suggest key names following the convention:
[category].[subcategory].[description] - Output a diff of new strings to add to the string table
-
For:
validate- Read all string table files in
assets/data/ - Check each entry for:
- Missing translations (key exists but no translation for a locale)
- Placeholder mismatches (source has but translation is missing it)
{name} - String length violations (exceeds character limits for UI elements)
- Orphaned keys (translation exists but nothing references the key in code)
- Report validation results grouped by locale and severity
- Read all string table files in
-
For:
status- Count total localizable strings
- Per locale: count translated, untranslated, and stale (source changed since translation)
- Generate a coverage matrix:
markdown## Localization Status Generated: [Date] | Locale | Total | Translated | Missing | Stale | Coverage | |--------|-------|-----------|---------|-------|----------| | en (source) | [N] | [N] | 0 | 0 | 100% | | [locale] | [N] | [N] | [N] | [N] | [X]% | ### Issues - [N] hardcoded strings found in source code - [N] strings exceeding character limits - [N] placeholder mismatches - [N] orphaned keys (can be cleaned up)
当此skill被调用时:
-
从参数中解析子命令:
- — 扫描本地化问题(硬编码字符串、缺失的key)
scan - — 提取新字符串并生成/更新字符串表
extract - — 验证现有翻译的完整性和格式
validate - — 上报整体本地化状态
status
-
命令说明:
scan- 搜索目录下面向用户的硬编码字符串:
src/- UI代码中未被本地化函数包裹的字符串字面量
- 应该参数化的拼接字符串
- 使用位置占位符(、
%s)而非命名占位符(%d)的字符串{playerName}
- 搜索本地化反模式:
- 未使用区域感知函数的日期/时间格式化
- 未考虑区域特性的数字格式化
- 嵌入在图片或纹理中的文本(标记资产文件)
- 假设文本为从左到右书写方向的字符串
- 上报所有发现的问题,附带文件路径和行号
- 搜索
-
命令说明:
extract- 扫描所有源文件中的本地化字符串引用
- 和目录下现有的字符串表(如果存在)做对比
assets/data/ - 为还没有key的字符串生成新条目
- 按照 规范建议key名称
[category].[subcategory].[description] - 输出需要添加到字符串表的新字符串的diff内容
-
命令说明:
validate- 读取目录下的所有字符串表文件
assets/data/ - 检查每个条目:
- 缺失的翻译(key存在但对应语言没有翻译)
- 占位符不匹配(源文本有但翻译中缺失)
{name} - 字符串长度违规(超出UI元素的字符限制)
- 孤立key(翻译存在但代码中没有任何地方引用该key)
- 按语言和严重程度分组上报验证结果
- 读取
-
命令说明:
status- 统计可本地化的字符串总数
- 按语言统计:已翻译、未翻译、过时(翻译后源文本发生了变更)的数量
- 生成覆盖度矩阵:
markdown## Localization Status Generated: [Date] | Locale | Total | Translated | Missing | Stale | Coverage | |--------|-------|-----------|---------|-------|----------| | en (source) | [N] | [N] | 0 | 0 | 100% | | [locale] | [N] | [N] | [N] | [N] | [X]% | ### Issues - [N] hardcoded strings found in source code - [N] strings exceeding character limits - [N] placeholder mismatches - [N] orphaned keys (can be cleaned up)
Rules
规则
- English (en) is always the source locale
- Every string table entry must include a translator comment explaining context
- Never modify translation files directly — generate diffs for review
- Character limits must be defined per-UI-element and enforced automatically
- Right-to-left (RTL) language support should be considered from the start, not bolted on later
- 英语(en)始终是源语言
- 每个字符串表条目都必须包含译者注释,说明上下文语境
- 永远不要直接修改翻译文件——生成diff供审核使用
- 必须为每个UI元素定义字符限制并自动执行校验
- 从一开始就应该考虑从右到左(RTL)语言的支持,不要后续临时增补