localize

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
When this skill is invoked:
  1. Parse the subcommand from the argument:
    • scan
      — Scan for localization issues (hardcoded strings, missing keys)
    • extract
      — Extract new strings and generate/update string tables
    • validate
      — Validate existing translations for completeness and format
    • status
      — Report overall localization status
  2. For
    scan
    :
    • Search
      src/
      for hardcoded user-facing strings:
      • String literals in UI code that are not wrapped in a localization function
      • Concatenated strings that should be parameterized
      • Strings with positional placeholders (
        %s
        ,
        %d
        ) instead of named ones (
        {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
  3. 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
  4. 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
        {name}
        but translation is missing it)
      • 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
  5. 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被调用时:
  1. 从参数中解析子命令
    • scan
      — 扫描本地化问题(硬编码字符串、缺失的key)
    • extract
      — 提取新字符串并生成/更新字符串表
    • validate
      — 验证现有翻译的完整性和格式
    • status
      — 上报整体本地化状态
  2. scan
    命令说明
    • 搜索
      src/
      目录下面向用户的硬编码字符串:
      • UI代码中未被本地化函数包裹的字符串字面量
      • 应该参数化的拼接字符串
      • 使用位置占位符(
        %s
        %d
        )而非命名占位符(
        {playerName}
        )的字符串
    • 搜索本地化反模式:
      • 未使用区域感知函数的日期/时间格式化
      • 未考虑区域特性的数字格式化
      • 嵌入在图片或纹理中的文本(标记资产文件)
      • 假设文本为从左到右书写方向的字符串
    • 上报所有发现的问题,附带文件路径和行号
  3. extract
    命令说明
    • 扫描所有源文件中的本地化字符串引用
    • assets/data/
      目录下现有的字符串表(如果存在)做对比
    • 为还没有key的字符串生成新条目
    • 按照
      [category].[subcategory].[description]
      规范建议key名称
    • 输出需要添加到字符串表的新字符串的diff内容
  4. validate
    命令说明
    • 读取
      assets/data/
      目录下的所有字符串表文件
    • 检查每个条目:
      • 缺失的翻译(key存在但对应语言没有翻译)
      • 占位符不匹配(源文本有
        {name}
        但翻译中缺失)
      • 字符串长度违规(超出UI元素的字符限制)
      • 孤立key(翻译存在但代码中没有任何地方引用该key)
    • 按语言和严重程度分组上报验证结果
  5. 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)语言的支持,不要后续临时增补