What It Is
AI-powered translation for Astro websites. Auto-generates localized content from your content/ directory.
How It Works
Mark files for translation in frontmatter:
---
title: About Us
description: Learn about our company
_translateTo: [ru, de]
---
Options:
_translateTo: [ru, de]β translate to specific locales_translateTo: allβ translate to all configured locales_translateTo: falseβ explicitly donβt translate
Usage
# Translate missing content
npx astro-ai-translator
# Translate specific file
npx astro-ai-translator about.mdx
# Check status
npx astro-ai-translator --status
# Dry run (no API calls)
npx astro-ai-translator --dry-run
Cost Estimation
Before translation starts, you see:
- Cost estimate β approximate tokens and USD cost
- File list β what will be translated
- Confirmation prompt β approve before spending
π TRANSLATION ESTIMATE
π Files to translate:
β’ index.mdx β ru (~807 tokens)
β’ about.mdx β ru (~658 tokens)
π° Estimated cost: $0.02
Proceed with translation? [Y/n]
Supported Models
| Model | Input/1M | Output/1M | Best for |
|---|---|---|---|
| gpt-4.1 | $2.00 | $8.00 | Default, best quality |
| gpt-4.1-mini | $0.40 | $1.60 | Good balance |
| gpt-4.1-nano | $0.10 | $0.40 | Budget option |
| gpt-4o | $2.50 | $10.00 | High quality |
| gpt-4o-mini | $0.15 | $0.60 | Very cheap |
Generated Files
AI-translated files include metadata:
---
title: Π Π½Π°Ρ
_ai:
source: about.mdx
hash: a1b2c3d4e5f6
model: gpt-4.1
date: "2025-12-15"
---
Track source changes. Know which model was used. Identify AI vs manual translations.
Best Practices
For Production
- Use for initial translation
- Have native speakers review
- Make corrections in translated files
- Tool wonβt overwrite existing translations
For Rapid Iteration
- Translate early and often
- Use draft mode for testing
- Batch translate when content stabilizes
Limitations
- AI translation isnβt perfect β human review recommended
- Technical content may need extra attention
- Cultural adaptation requires human judgment
Open Source
Full source on GitHub. Issues, suggestions, contributions welcome.