Translator
Overview
Professional translation skill supporting 15+ languages with advanced features:
- Single Translation - Translate one piece of text
- Batch Translation - Translate multiple texts at once
- Auto Language Detection - Automatic source language detection
- Multiple Translation Methods - API-based and AI-based translation
- Rich Output Formats - Plain text, with source, detailed results
Supported Languages (15+)
| Language | Code | Native Name |
|---|---|---|
| Chinese (Simplified) | zh | 中文(简体) |
| Chinese (Traditional) | zh-TW | 中文(繁體) |
| English | en | English |
| Japanese | ja | 日本語 |
| Korean | ko | 한국어 |
| Russian | ru | Русский |
| Arabic | ar | العربية |
| French | fr | Français |
| German | de | Deutsch |
| Spanish | es | Español |
| Italian | it | Italiano |
| Portuguese | pt | Português |
| Thai | th | ไทย |
| Vietnamese | vi | Tiếng Việt |
| Hindi | hi | हिन्दी |
Quick Start
Single Translation
User: "把'你好世界'翻译成英文"
→ "Hello World"
Batch Translation
User: "把以下内容翻译成日文:
苹果 - Apple
香蕉 - Banana
橙子 - Orange"
→ 苹果 - リンゴ
香蕉 - バナナ
オレンジ - オレンジ
Language Detection
User: "Translate: Bonjour le monde"
→ Auto-detect: French → "Hello World"
Core Workflow
Step 1: Detect Translation Intent
Trigger Keywords:
- "翻译" / "translate" / "翻译成" / "translation"
- "用XX语怎么说" / "How do you say X in XX"
- "Language exchange" / "convert to XX"
Detection Patterns:
- Explicit: "翻译成英文"
- Implicit: "这段话用日语怎么说"
Step 2: Parse Request
- Identify text to translate (single or multiple)
- Identify target language (explicit or implicit)
- Identify source language (explicit or auto-detect)
- Determine translation mode (single/batch)
Step 3: Process Translation
Priority:
1. Try API-based translation (if API key configured)
2. Fallback to Claude-based translation
3. Return formatted result
Step 4: Format Output
Output Formats:
Simple (default):
[translated text]
With Source:
原文(中文):你好世界
翻译(英文):Hello World
Detailed:
原文:你好世界
源语言:中文
目标语言:English
翻译结果:Hello World
翻译方式:AI-based (Claude)
Advanced Features
Batch Translation
For multiple texts, process efficiently:
Input: "翻译成韩文:
- 你好
- 谢谢
- 对不起"
Output:
- 你好 → 안녕하세요
-谢谢 → 고마워요
- 对不起 → 죄송합니다
Best practices for batch:
- Use bullet points or numbered lists
- Keep each item concise
- Format consistently
Auto Language Detection
The skill automatically detects source language when not specified:
User: "Translate: Hello World to Chinese"
→ Detect: English → "你好世界"
Supported detection: zh, en, ja, ko, ru, ar, fr, de, es
Error Recovery
If translation fails:
1. Try alternative translation method
2. Provide partial results if possible
3. Suggest fixes for configuration issues
Example error handling:
原文:[text]
错误:Translation API unavailable
备选:Using AI translation
结果:[translated text]
API Configuration (Optional)
Quick Setup
Option 1: Google Translate (Free Tier)
# scripts/translate.py 中设置
api_service = 'google'
# 需要: pip install google-cloud-translate
Option 2: DeepL API
# 设置环境变量
import os
os.environ['DEEPL_API_KEY'] = 'your-key'
api_service = 'deepl'
Option 3: LibreTranslate (Free/Open Source)
api_service = 'libre'
os.environ['LIBRETRANSLATE_URL'] = 'https://libretranslate.com'
No Configuration Required:
If no API is configured, Claude provides reliable AI-based translation automatically.
Usage Examples
Example 1: Simple Translation
Input: "把'谢谢'翻译成英文"
Output: "Thank you"
Example 2: Target Language in Text
Input: "翻译成日文:今天天气很好"
Output: 今日は天気がとても良いですね
Example 3: Batch with Format
Input: "翻译成韩文:
苹果
香蕉
橙子"
Output:
- 苹果 → 사과
-香蕉 → 바나나
- オレンジ → 오렌지
Example 4: Language Detection
Input: "Translate: Guten Morgen to Chinese"
Output: 早上好
Example 5: Phrase Translation
Input: "用日语说'祝你生日快乐'"
Output: お誕生日おめでとうございます
Example 6: Formal vs Informal
Input: "翻译成韩语(敬语):谢谢你"
Output: 감사합니다 (formal)
Example 7: Multiple Languages at Once
Input: "'Hello' in all languages"
Output:
- 中文:你好
- English:Hello
- 日文:こんにちは
- 韩文:안녕하세요
- 法文:Bonjour
- 德文:Hallo
- 等等...
Scripts
scripts/translate.py
Features:
- Single and batch translation
- Auto language detection
- Multiple API support
- Progress indicator for batch
- Rich error handling
Usage:
# Single
python scripts/translate.py --text "Hello" --target zh
# Batch
python scripts/translate.py --batch --file input.txt --target ja
# With source language
python scripts/translate.py --text "Bonjour" --source fr --target en
Quality Assurance
Translation Accuracy
- High - For major languages (zh, en, ja, ko, ru, ar, fr, de, es)
- Medium - For other supported languages
- Fallback available - AI translation ensures results
Best Practices
-
Be specific about target language
- ✓ "翻译成英文"
- ✗ "翻译成外语" -
Use clear formatting for batch
- ✓ "翻译成日文:\n苹果\n香蕉"
- ✗ "翻译成日文:苹果香蕉" -
Specify source for ambiguous phrases
- ✓ "Bonjour 翻译成中文" (specifying French)
- ✓ "翻译:Bonjour to Chinese" (specifying source)
Notes
- No API key required for AI-based translation
- Batch translation for 2+ items supported
- Auto-detection works for major languages
- Results are cached for similar requests
Version History
- v1.1 (current): Added batch translation, 15+ languages, error recovery, auto-detection
- v1.0: Initial release with 6 languages