Book Translator is a powerful application for translating books and large text documents (.txt files) between multiple languages using a two-stage translation process: Google Translate for initial translation and Ollama AI models for literary refinement. It works with plain text format only and combines a Flask backend with a React frontend to provide a smooth and efficient translation experience.
- π Two-stage translation process:
- Stage 1: Fast initial translation using Google Translate
- Stage 2: Literary refinement using Ollama AI models
- π Support for multiple languages including English, Russian, German, French, Spanish, Italian, Chinese, and Japanese
- π€ Integration with Ollama AI models for high-quality refinements
- π Real-time translation progress tracking for both stages
- π Translation history and status monitoring
- πΎ Efficient caching system for improved performance
- π Automatic error recovery and retry mechanisms
- π Real-time metrics and system monitoring
- π± Modern, responsive UI with React and Tailwind CSS
Experience the translation process in modern, user-friendly interface:
The application uses a sophisticated two-stage translation approach:
- Uses Google Translate API for fast initial translation
- Handles large volumes of text efficiently
- Provides basic translation quality
- Progress tracking for initial translation stage
- Uses Ollama AI models to refine the initial translation
- Improves literary quality and natural language flow
- Maintains context and style
- Separate progress tracking for refinement stage
- Python 3.7+
- Ollama installed and running
- Node.js (for development)
- Clone the repository
git clone https://github.com/kazkozdev/book-translator.git
cd book-translator
- Install dependencies
pip install -r requirements.txt
- Pull required Ollama model
ollama pull gemma2:27b
- Start the application
python translator.py
- Access the application
- Open
http://localhost:5001
in your browser
book-translator/
βββ translator.py # Flask backend
βββ static/ # Frontend files
βββ uploads/ # Temporary uploads
βββ translations/ # Completed translations
βββ logs/ # Application logs
βββ translations.db # Main database
βββ cache.db # Cache database
POST /translate
- Start translation process (both stages)GET /translations
- Get historyGET /translations/<id>
- Get translation details including stage progressGET /download/<id>
- Download refined translationPOST /retry-translation/<id>
- Retry failed translation
GET /models
- List available Ollama modelsGET /metrics
- System metricsGET /health
- Service health checkGET /failed-translations
- List failed translations
We welcome contributions! Here's how:
- Fork the repository
- Create feature branch (
git checkout -b feature/AmazingFeature
) - Commit changes (
git commit -m 'Add AmazingFeature'
) - Push to branch (
git push origin feature/AmazingFeature
) - Open Pull Request
MIT License - see LICENSE file
β Star us on GitHub!