Agent Skillsliaohch3/claude-tap › translate-i18n

translate-i18n

GitHub

自动补全 viewer_i18n.json 中缺失的多语言翻译。基于英文和中文源,通过 OpenRouter 生成日、韩、法、阿、德、俄文译文。支持干运行预览及模型覆盖。

.agents/skills/translate-i18n/SKILL.md liaohch3/claude-tap

Trigger Scenarios

新增或修改了 viewer_i18n.json 中的英文或中文 UI 字符串 需要为其他六种目标语言自动填充缺失的翻译键值

Install

npx skills add liaohch3/claude-tap --skill translate-i18n -g -y
More Options

Non-standard path

npx skills add https://github.com/liaohch3/claude-tap/tree/main/.agents/skills/translate-i18n -g -y

Use without installing

npx skills use liaohch3/claude-tap@translate-i18n

指定 Agent (Claude Code)

npx skills add liaohch3/claude-tap --skill translate-i18n -a claude-code -g -y

安装 repo 全部 skill

npx skills add liaohch3/claude-tap --all -g -y

预览 repo 内 skill

npx skills add liaohch3/claude-tap --list

SKILL.md

Frontmatter
{
    "name": "translate-i18n",
    "description": "Fill missing i18n translations in the viewer source JSON. Run this after adding or modifying English or Chinese UI strings in claude_tap\/viewer_i18n.json — it auto-translates to ja, ko, fr, ar, de, ru via OpenRouter.",
    "user_invocable": true
}

Translate i18n

Automatically fill missing translations for the viewer's claude_tap/viewer_i18n.json source file. The script uses English and Chinese as source languages and translates to Japanese, Korean, French, Arabic, German, and Russian.

Prerequisites

  • OPENROUTER_API_KEY must be set in the environment (it is in the user's .zshrc)
  • Default model: google/gemini-2.5-flash

Workflow

1. Check what's missing (dry run)

Always preview first to confirm which keys need translation:

uv run python scripts/translate_i18n.py --dry-run

This parses claude_tap/viewer_i18n.json, finds keys present in both en and zh-CN but missing in other languages, and lists them without modifying the file.

2. Run the translation

uv run python scripts/translate_i18n.py

The script calls OpenRouter once per target language, then writes the translations back into viewer_i18n.json in-place.

3. Verify the result

After translation, run the formatter and tests to make sure nothing broke:

uv run python -m json.tool claude_tap/viewer_i18n.json >/dev/null
uv run pytest tests/test_translate_i18n.py -v

Options

Flag Purpose
--dry-run Show missing keys only, no file changes
--model MODEL Override the OpenRouter model (default: google/gemini-2.5-flash)
--target {viewer,cli} Translation target preset (default: viewer)
--file PATH Override target file path
--object-name NAME Override the legacy JS/Python i18n object name

How it works

The script:

  1. Loads the viewer i18n JSON source file
  2. Validates that every language block is a string-to-string map
  3. Identifies keys present in en + zh-CN but missing in target languages
  4. Sends a structured prompt to OpenRouter with existing translations for consistency
  5. Normalizes fullwidth punctuation for CJK languages (matching zh-CN style)
  6. Inserts new entries after the existing keys in each target language

Common scenarios

Added a new UI string: Add the key to both en and zh-CN blocks in claude_tap/viewer_i18n.json, then run this skill. The other 6 languages will be filled automatically.

Changed an existing string: The script only fills missing keys. To re-translate an existing key, first delete it from the target language blocks, then run the script.

Version History

  • 7170ab3 Current 2026-07-05 15:20

Same Skill Collection

.agents/skills/codex-e2e-test/SKILL.md
.agents/skills/demo-video/SKILL.md
.agents/skills/js-in-html-testing/SKILL.md
.agents/skills/legibility-check/SKILL.md
.agents/skills/playwright-screen-recording/SKILL.md
.agents/skills/pr-preflight/SKILL.md
.agents/skills/push-release/SKILL.md
.agents/skills/real-e2e-test/SKILL.md
.agents/skills/screenshot-validation/SKILL.md
.agents/skills/e2e-test/SKILL.md

Metadata

Files
0
Version
7170ab3
Hash
0fbece09
Indexed
2026-07-05 15:20

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-09 05:38
浙ICP备14020137号-1 $Carte des visiteurs$