Darija Translator is a full-stack translation project with a Jakarta EE REST web service on WildFly, a Manifest V3 Chrome extension, and a Tkinter desktop app, all working together to translate text into Moroccan Darija using OpenAI.
# Darija Translator
Darija Translator is a multi-client project built around one local Java Jakarta EE web service.
The project contains:
- a Java Jakarta EE REST web service deployed on WildFly
- a Chrome extension built with Manifest V3
- a Python desktop app built with Tkinter
Both clients send text to the same authenticated REST endpoint and receive a Moroccan Darija translation written in Latin characters (Arabizi).
## Project Structure
```text
.
├── extension/ # Chrome extension (Manifest V3)
├── python_app/ # Desktop client built with Tkinter
└── webservice/ # Jakarta EE REST service for translation
```
## Architecture
The system works like this:
1. The user selects or enters text in the Chrome extension or Python app.
2. The client sends a `POST` request to the local web service.
3. The web service protects the endpoint with Basic Authentication and role-based access control.
4. The web service calls the OpenAI API to generate the Darija translation.
5. The translated text is returned to the client and shown in the UI.
## Main Technologies
- Java with Jakarta EE
- Maven for building the web service
- JAX-RS for REST endpoints
- WildFly as the application server / container
- Basic Authentication with role protection
- Chrome Extension Manifest V3
- Python Tkinter for the desktop interface
- OpenAI API for translation generation
## Web Service
The backend lives in `webservice/`.
### What it does
- exposes a REST endpoint at `/api/translate`
- accepts JSON input in the form `{ "text": "..." }`
- protects the endpoint with the `ExtensionUser` role
- uses Basic Authentication through WildFly
- calls the OpenAI API and returns the translation as JSON
- packages the application as a WAR file for deployment to WildFly
### Key files
- `webservice/pom.xml`
- `webservice/mvnw`
- `webservice/src/main/java/ma/aui/ghali/translatorresource/TranslatorApplication.java`
- `webservice/src/main/java/ma/aui/ghali/translatorresource/TranslatorResource. …