# Check if current directory contains SKILL.mdif [ ! -f SKILL.md ]; thenecho"Error: SKILL.md not found in current directory"exit 1
fi
Load configuration
# Read config file
CONFIG=$(cat ~/.claude/skill-i18n-config.json 2>/dev/null || echo'{}')
# Get skill name from directory
SKILL_NAME=$(basename"$(pwd)")
# Check for skill-specific config
SKILL_CONFIG=$(echo"$CONFIG" | jq -r ".skills_config[\"$SKILL_NAME\"] // null")
First-run selection (if no config)
If no configuration exists for this skill, show TUI selection:
{"questions":[{"question":"Which languages should be generated?","header":"Languages","multiSelect":true,"options":[{"label":"简体中文 (zh-CN)","description":"Simplified Chinese"},{"label":"日本語 (ja)","description":"Japanese"},{"label":"한국어 (ko)","description":"Korean"},{"label":"Español (es)","description":"Spanish"}]},{"question":"Which files should be translated?","header":"Files","multiSelect":true,"options":[{"label":"SKILL.md","description":"Skill documentation (recommended)"},{"label":"README.md","description":"Repository readme"}]}]}
Save configuration
# Save selection to config for future runs
jq --arg skill "$SKILL_NAME" \
--argjson langs '["zh-CN", "ja"]' \
--argjson files '["SKILL.md"]' \
'.skills_config[$skill] = {"languages": $langs, "files": $files}' \
~/.claude/skill-i18n-config.json > tmp.json && mv tmp.json ~/.claude/skill-i18n-config.json
Execute translation
For each selected file and language, generate translation
See "Translation Rules" section below
Command: /skill-i18n <skill-name>
Translate files for specified skill:
Search skill location
# Search in common locations
SKILL_PATH=""# Check ~/.claude/skills/if [ -d ~/.claude/skills/"$SKILL_NAME" ]; then
SKILL_PATH=~/.claude/skills/"$SKILL_NAME"fi# Check code repository (if configured)if [ -z "$SKILL_PATH" ] && [ -d ~/Codes/skills/"$SKILL_NAME" ]; then
SKILL_PATH=~/Codes/skills/"$SKILL_NAME"fiif [ -z "$SKILL_PATH" ]; thenecho"Error: Skill '$SKILL_NAME' not found"exit 1
fi
{"questions":[{"question":"Select default languages for new skills:","header":"Defaults","multiSelect":true,"options":[{"label":"简体中文 (zh-CN)","description":"Simplified Chinese"},{"label":"日本語 (ja)","description":"Japanese"},{"label":"한국어 (ko)","description":"Korean"},{"label":"Español (es)","description":"Spanish"}]}]}
Update configuration file
Command-Line Flags
For integration with other skills (e.g., share-skill):
---name:port-allocator# Keep unchanged (identifier)description:Translatethis# Translate to target language---
Style Adaptation
Different languages may use different visual styles:
Language
Emoji Usage
Example
Chinese (zh-CN)
Common
✅ 正确 / ❌ 错误
Japanese (ja)
Minimal
正しい / 間違い
Korean (ko)
Moderate
✅ 올바름 / ❌ 잘못됨
Spanish (es)
Minimal
Correcto / Incorrecto
Follow existing translation patterns in the project if available.
Output Format
Translation Success
Translation complete
Skill: port-allocator
Source: SKILL.md
Generated:
- SKILL.zh-CN.md (简体中文)
- SKILL.ja.md (日本語)
Config saved for: port-allocator
Next run will auto-translate to: zh-CN, ja
Existing Files Detected
Existing translations detected:
- SKILL.zh-CN.md (modified 2 days ago)
- SKILL.ja.md (modified 2 days ago)
Options:
[ ] Overwrite all
[ ] Skip existing
[ ] Select individually
Configuration Saved
Configuration updated
Default languages: zh-CN, ja
Default files: SKILL.md
Skill-specific config:
port-allocator: zh-CN, ja, ko (SKILL.md, README.md)
share-skill: zh-CN, ja (SKILL.md)
Integration with share-skill
skill-i18n integrates with share-skill for documentation generation:
# share-skill docs with i18n
/share-skill docs --i18n
# This internally calls:
/skill-i18n --lang <configured-langs> --files SKILL.md --no-prompt
When share-skill detects --i18n flag:
Check if skill-i18n is available
Load language configuration
Call skill-i18n to generate translations
Include translated files in documentation site
Notes
Source file safety - Never overwrite the source SKILL.md file
First-run prompt - First translation requires language selection
Per-skill config - Different skills can have different language settings
Incremental updates - Only translate when source file is newer than translations
Integration-friendly - Command-line flags allow other skills to call skill-i18n