Automatic translation application into Moroccan Darija. This project provides an API, a web interface, and a browser extension to make translating texts into Darija easier.
# ToDarija
ToDarija is a web application for automatic translation of text into Darija (Moroccan Arabic) using Google Gemini API. The project provides a Java REST API (JAX-RS) and a modern web interface for easy translation and text correction.
## Main Features
- Automatic translation of text into Darija (Moroccan Arabic)
- Spelling and grammar correction of the source text
- Secure RESTful API (Java, Jakarta EE)
- Web interface and browser extension for client-side usage
## Project Architecture
```
ToDarija/
├── application/ToDarija/ # Java backend (REST API, services, models)
│ ├── src/main/java/org/project # Main source code (API, controllers, services, strategies)
│ ├── src/main/resources # Config files (application.properties, beans.xml)
│ └── pom.xml # Maven dependencies
├── translator-client/ # Web client and browser extension
│ ├── web/ # Web interface (HTML, JS, CSS)
│ └── extension/ # Browser extension (Chrome/Firefox)
├── docs/images/ # Images and examples
└── README.md # This file
```
## Backend Security Overview
The backend uses a Bearer token authentication mechanism to secure all API endpoints:
- Every incoming HTTP request is intercepted by an authentication filter (`AuthFilter`).
- The filter checks for a valid `Authorization: Bearer ` header.
- If the token is missing or invalid, the request is rejected with a `401 Unauthorized` response.
- Only requests with a valid token are processed by the API controllers.
**Key file:** `application/ToDarija/src/main/java/org/project/authentification/AuthFilter.java`
## Layered Architecture & Flow
```
┌─────────────────────────────────────────────┐
│ PRESENTATION LAYER (Frontend) │
│ - HTML/CSS/JS │
│ - Google OAuth 2.0 │
│ - Fetch API for requests │
└─────────────────┬────────────────────────── …