Detect the language of any text input instantly using Python, Flask, and LangDetect. Tracks detection history with a clean web UI and smart caching.
## 📖 Overview
Language Detector is a full-stack Flask web application that uses the langdetect
library to detect the language of any given text. It includes:
- 🧠 Automatic Language Detection using
langdetect
- 💾 Detection History Tracking with SQLite (via SQLAlchemy)
- ⚡ Smart Caching for faster repeat detection
- 🖥️ Responsive Web Interface with recent detection previews
Built for fast prototyping, linguistic demos, and simple multi-language handling.
- Uses
langdetect
to identify the language code (e.g.,en
,fr
,de
,hi
) - Shows both code and full language name using
pycountry
- Displays last 5 detections on home page
- View complete paginated history on
/history
page
- Avoids repeated detection for same text using a TTL-based cache (5 minutes default)
- Built with HTML/CSS and modular templates (using Jinja2)
- Includes 404 and 500 error pages
Category | Tech Stack |
---|---|
Backend | Flask (Python) |
Language Detection | langdetect, pycountry |
Database | SQLite + SQLAlchemy |
Frontend | HTML, CSS (custom), JS |
Caching | TTL-based manual Python decorator |
Route | Description |
---|---|
/ |
Home page with text input + recent detections |
/detect |
API endpoint for POST-based language detection |
/history |
Full history page with pagination |
- Clone the Repository
git clone https://github.com/Aayushinit/LanguageDetectorApp.git
cd LanguageDetectorApp
- Install Dependencies
pip install flask langdetect pycountry flask_sqlalchemy
- Run the App
python app.py
- Visit in Browser http://localhost:5000
- Accepts user text input from the frontend
langdetect
attempts to detect language codepycountry
maps language code to human-readable name- Result is cached and also saved in the database
- History is displayed and paginated with timestamps
- 🔤 Display detection confidence (if supported)
- 🌍 Add language flag icons
- 💬 Translate detected text
- 💽 Export detection history as CSV
- 📱 Mobile-optimized interface with Tailwind CSS
Aayush Kadam — Final Year AI & ML Student | Python & Web Enthusiast
"Giving apps the power to understand language—one line at a time."
If you find this project helpful, please ⭐ the repo and share with your network!
Licensed under the MIT License.
UI and logic were developed for educational and demonstration purposes.