AI Translator
Context-aware translation with quality scoring.
Features
- đ 100+ Languages â Major and rare languages
- đ§ Context Aware â Understands domain context
- đ Terminology â Custom glossary support
- â Quality Score â Confidence rating
- đ Batch Translate â Multiple files at once
Supported Formats
| Format | Input | Output |
|--------|-------|--------|
| Text | â | â |
| Markdown | â | â |
| JSON | â | â |
| HTML | â | â |
| Subtitles | â | â |
| Documents | â | â |
Usage
Text Translation
# Simple translation
hermes translate "Hello world" --to zh
# With context
hermes translate "Apple is great" --to zh --context technology
# Multiple languages
hermes translate "Welcome" --to zh,ja,ko,es
File Translation
# Translate document
hermes translate file README.md --to zh
# Translate JSON (i18n)
hermes translate file en.json --to zh,ja,ko
# Batch translate directory
hermes translate dir ./docs/ --to zh
Subtitle Translation
# Translate SRT file
hermes translate subtitles video.srt --to zh
# With timing preservation
hermes translate subtitles video.srt --to zh --preserve-timing
Quality Scoring
Each translation gets a quality score:
| Score | Quality | Recommendation |
|-------|---------|----------------|
| 95-100 | Excellent | Use directly |
| 85-94 | Good | Minor review |
| 70-84 | Fair | Review needed |
| <70 | Poor | Rewrite recommended |
Terminology Management
Custom Glossary
# glossary.yml
terms:
- source: "machine learning"
target_zh: "æēå¨åĻäš "
target_ja: "æŠæĸ°åĻįŋ"
context: technology
- source: "cloud computing"
target_zh: "äē莥įŽ"
context: technology
Usage
# Translate with glossary
hermes translate file doc.md --to zh --glossary glossary.yml
# Update glossary from translations
hermes translate learn --from translated.md --glossary glossary.yml
Localization Workflow
# Initialize i18n
hermes translate init --framework nextjs
# Extract strings
hermes translate extract ./src/
# Translate all
hermes translate all --to zh,ja,ko
# Verify translations
hermes translate verify ./locales/
Integration
React/Next.js
// useTranslation hook
import { useTranslation } from 'hermes-i18n';
function Component() {
const { t } = useTranslation();
return <h1>{t('welcome')}</h1>;
}
API
from hermes import Translator
translator = Translator(api_key="...")
result = translator.translate(
text="Hello world",
target_lang="zh",
context="greeting"
)
print(result.translation) # "äŊ åĨŊä¸į"
print(result.quality) # 98
Pitfalls
- Context Matters â Always provide context for accurate translation
- Review Critical Content â Machine translation for legal/medical needs human review
- Glossary Maintenance â Keep glossary updated for consistency
- Character Limits â Some languages expand (German) or contract (Chinese)
- Cultural Adaptation â Direct translation may not convey same meaning