A browser extension that translates webpages into Moroccan Darija using BYOK AI providers like Gemini, Groq, and Agent Router.
Bdarija
A Chrome extension that scans visible webpage text and translates it into Moroccan Darija using your own AI provider key.
---
## Why Bdarija
Bdarija is built for quick personal translation experiments without committing secrets to a backend. The extension stores your provider config locally in Chrome, sends translation requests to a local Hono API, and lets you restore the original page text at any time.
## Highlights
| Area | Details |
|---|---|
| Extension | WXT, React, TypeScript, Tailwind CSS, Chrome Manifest V3 |
| Backend | Hono, Node.js, Zod validation |
| Providers | Gemini, Groq, Agent Router, OpenAI |
| Modes | Arabizi and Arabic-script output |
| Style profiles | Casual, Clean Web, Gen Z, and Literal Darija styles |
| Privacy | BYOK config stored locally in `chrome.storage.local` |
| Cache | Provider, model, mode, style, and source text are included in cache keys |
| Recovery | Restore original page text after translation |
| Selection tools | Right-click selected text to translate, copy, or replace |
| Floating toolbar | Select text and translate it without opening the context menu |
| Smart Auto | Translate newly visible text while scrolling |
## How It Works
```mermaid
flowchart LR
Popup["Extension popup"] --> Background["Background worker"]
Background --> Content["Content script"]
Content --> Extract["Visible DOM text extraction"]
Extract --> Cache["Local translation cache"]
Cache --> API["Local Hono API"]
API --> Provider["Gemini / Groq / Agent Router / OpenAI"]
Provider --> API
API --> Background
Background --> Apply["Apply translated text"]
Apply --> Page["Current webpage"]
```
## Quick Start
Install dependencies:
```bash
npm install
```
Start the local API:
```bash
npm run dev:api
```
Build the extension:
```bash
npm run build:extension
```
Load this folder as an unpacked Chrome extension:
```text
extension/.output/chrome-mv3
```
## BYOK Setup
1. Open the Bdarija popup.
2. Select `Gemini`, `Groq`, `Agent …