A powerful Python-based translation tool using Google Translate API through the googletrans library. Perfect for Hacktoberfest contributions!
Prerequisites
- Python 3.6+
- pip package manager
pip install -r requirements.txt
The requirements.txt contains:Basic Translation bash
python translator.py --text "Hello World" --dest spanish
==================================================
================================================== Original (en): Hello World
Translated (es): Hola Mundo ==================================================
python translator.py --interactiveThis launches an interactive session where you can continuously translate text.
Command Line Options
- Single Text Translation bash
python translator.py --text "Good morning" --dest frpython translator.py --text "Thank you" --dest japanesepython translator.py --text "Bonjour" --src fr --dest enpython translator.py --file input.txt --dest germanpython translator.py --batch "Hello" "Goodbye" "Thank you" --dest zh-cnpython translator.py --detect "Hola cómo estás"python translator.py --list-langs
python translator.py --search-langs "chinese"
python translator.py --text "Hello World" --dest fr --output result.json
The tool supports 100+ languages including:
Code Language Code Language en English es Spanish fr French de German zh-cn Chinese ja Japanese ko Korean ru Russian ar Arabic hi Hindi View all languages with:
python translator.py --list-langs-
✅ 100+ Languages - Comprehensive language support
-
✅ Auto-Detection - Automatic source language detection
-
✅ Batch Processing - Translate multiple texts efficiently
-
✅ File Support - Translate content from files
-
✅ Pronunciation - Get pronunciation guides
-
✅ Interactive Mode - User-friendly continuous translation
-
✅ JSON Export - Save results in structured format
-
✅ Language Search - Find languages by name
-
✅ Error Handling - Robust error management
Display all available options
python translator.py --helpFor issues and feature requests, please open an issue on GitHub.