translate-i18n
This Claude Code skill automatically fills missing translations in the viewer's i18n JSON file by detecting keys present in English and Chinese but absent in Japanese, Korean, French, Arabic, German, and Russian, then calling OpenRouter's translation API to generate them. Use this after adding or modifying UI strings in the English or Chinese sections of claude_tap/viewer_i18n.json to keep all supported languages in sync without manual translation work.
git clone --depth 1 https://github.com/liaohch3/claude-tap /tmp/translate-i18n && cp -r /tmp/translate-i18n/.agents/skills/translate-i18n ~/.claude/skills/translate-i18nSKILL.md
# 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:
```bash
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
```bash
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:
```bash
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.Generate demo assets (GIF/MP4) from real tmux E2E runs and viewer screenshots using asciinema and Playwright
Test JS logic embedded in HTML using two-layer strategy - Python unit tests + Playwright browser integration tests
Validate maintainer docs structure, standards freshness, manifest paths, and plan state. Run this after modifying any file under .agents/docs/standards/, .agents/docs/plans/, .agents/docs/architecture/, or AGENTS.md — it catches stale metadata, broken manifest paths, and plan state drift before CI does.
Record browser test videos with Playwright for PR review and bug fix verification
Full pre-PR merge-readiness check. Run this before opening or merging a pull request — it validates local gates (lint, format, tests), CI status, screenshot evidence, and PR metadata in one pass. Also useful for reviewing an existing PR's readiness.
Push to GitHub and optionally bump version to trigger PyPI release
Validate screenshot and viewer HTML quality for PR evidence. Run this after adding or modifying images under .agents/evidence/pr/ or .agents/recordings/, or after generating a new viewer HTML file. Combines image quality checks (resolution, blankness, file size) with Playwright-based viewer rendering verification.