# Darija Side Translator (Chrome Extension - Manifest V3)
This Chrome extension translates selected **English** text to **Moroccan Arabic Dialect (Darija)** using the browser side panel.
## Features
- Manifest V3 extension
- Uses `chrome.sidePanel` to display translation beside webpage content
- Captures selected text automatically and pastes it into the side panel
- Context menu entry: **Translate to Darija**
- Calls a REST translation endpoint from the side panel
- Optional AI Darija mode (OpenAI-compatible) for more accurate Moroccan dialect
## Project structure
- `manifest.json`
- `background/service_worker.js`
- `content/content.js`
- `sidepanel/sidepanel.html`
- `sidepanel/sidepanel.js`
- `sidepanel/sidepanel.css`
## Load in Chrome
1. Open `chrome://extensions`
2. Enable **Developer mode**
3. Click **Load unpacked**
4. Select this folder (`chrome extension`)
## How to use
1. Open any webpage.
2. Select English text.
3. Right-click and choose **Translate to Darija**.
4. The side panel opens and translates immediately.
You can also click the extension toolbar icon to open the side panel, then select text on a page and it will auto-update.
## Get real Darija quality
Free public translators usually return Modern Standard Arabic, not Moroccan Darija.
For better Darija results:
1. Open the side panel.
2. Expand **AI Darija settings**.
3. Choose provider:
- **OpenRouter (Darija LLM)**
- **OpenAI**
- **Fallback only (no API key)**
4. Enter provider API key (not needed for fallback).
5. Set model (default: `openrouter/auto`).
5. Click **Save settings**.
Then every translation uses AI Darija mode.
## API endpoint
The extension tries these translation providers in order (fallback):
- `
libretranslate.de`
- `
translate.argosopentech.com`
- `
api.mymemory.translated.net`
Configuration is in `sidepanel/sidepanel.js` (`TRANSLATION_PROVIDERS`).
If an API key is configured, the extension calls by provider:
- Ope …