A modern web application that provides real-time language translation using Google Translate API. Built with Flask backend and vanilla JavaScript frontend, this tool offers a clean, user-friendly interface for translating text between multiple languages.
- Real-time Language Detection: Automatically detects the source language
- Multiple Language Support: Translate between numerous languages including:
- English
- Spanish
- French
- German
- Italian
- Portuguese
- Russian
- Japanese
- Korean
- Chinese (Simplified)
- Arabic
- Hindi
- Intuitive Interface:
- Clean, modern design
- Responsive layout for all devices
- Easy-to-use language selection
- Additional Features:
- Copy translation to clipboard
- Clear text fields
- Swap languages
- Python 3.x
- Flask: Web framework
- googletrans: Google Translate API wrapper
- flask-cors: Cross-Origin Resource Sharing support
- HTML5
- CSS3: Modern styling with Flexbox
- JavaScript: Vanilla JS for API interactions
- Font Awesome: Icons
- unittest: Python testing framework
language-translator/
├── frontend/
│ ├── index.html # Main HTML file
│ ├── style.css # Styling
| ├── script.js # Frotnend logic
│ └── frontend_screenshot.png # Frontend Interface Screenshot
|
├── app.py # Flask application
├── translate.py # Translation service
├── test_app.py # Backend tests
├── requirements.txt # Python dependencies
├── demo.mp4 # Demo video of tool in working
└── README.md # Documentation
-
Clone the repository:
git clone https://github.com/BukuBukuChagma/CodeAlpha_Language_Translation_Tool.git cd CodeAlpha_Language_Translation_Tool
-
Create and activate a virtual environment:
# Windows python -m venv venv venv\Scripts\activate # Unix/MacOS python -m venv venv source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Start the Flask server:
python app.py
-
Open your web browser and navigate to:
http://localhost:{PORT}
-
To translate text:
- Enter text in the left text area
- Select source and target languages (or use auto-detect)
- Click "Translate" button
- Translation appears in the right text area
-
Additional features:
- Click the swap button (
↔️ ) to switch languages - Click the copy button (📋) to copy translation
- Click the clear button (✖️) to reset both fields
- Click the swap button (
Run the backend tests:
python -m unittest test_app.py -v
GET /
: Serves the main applicationPOST /api/detect
: Detects language of input textPOST /api/translate
: Translates text between languages
- Chrome (recommended)
- Firefox
- Safari
- Edge
- Relies on Google Translate API
- Character limit based on Google Translate restrictions
- Internet connection required
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.