DiMeTrans is a Chrome/Chromium extension that translates Discord messages into Czech. Click the translation icon beside a message to replace its visible text; click again to show the original. Translation appears progressively when the API supplies partial results. The original message remains available, and the translated text uses the original message's color and typography. The composer and messages being edited are excluded.
This repository contains only the browser client. It does not ship a translation model or server. Run a compatible local API yourself using the operating system, process manager, and translation backend you prefer. An Ollama-backed Python service is one possible implementation, but it is not required and is not distributed here.
The default endpoint is http://127.0.0.1:5001. Click the extension icon (or open its Options from chrome://extensions/) to change the API address and save it. Enter the base URL without /translate; HTTP, HTTPS, custom ports, and path prefixes such as https://example.com/api are supported. Chrome requests access to the selected host when needed. The address is stored locally and applies to new translation requests in already open Discord tabs. Running jobs finish on their original server; translations already displayed or cached remain available. Výchozí adresa restores the default. Keep the API on loopback unless you have explicitly secured another deployment.
A compatible server must provide:
| Request | Expected response |
|---|---|
GET /health |
JSON with at least status: "ready" for diagnostics. |
POST /translate with JSON { "q": "Hello", "source": "auto", "target": "cs" } |
HTTP 202 with { "jobId": "<32 lowercase hex characters>", "status": "pending" }. |
GET /translations/<jobId> |
{ "status": "pending", "partialText": "..." }, { "status": "done", "translatedText": "Ahoj" }, or { "status": "failed", "error": "..." }. partialText is optional. |
source may be a fixed language code such as en instead of auto. The client polls every 500 ms for up to 180 seconds. Failed jobs must remain distinguishable from completed translations. The server should accept requests from the extension service worker and should not require a public internet endpoint. Its model installation, startup, and GPU configuration depend on your OS and backend.
To check a running API:
curl http://127.0.0.1:5001/health
curl -H 'Content-Type: application/json' \
-d '{"q":"Hello, how are you?","source":"en","target":"cs"}' \
http://127.0.0.1:5001/translateUse the returned jobId with GET /translations/<jobId>.
- Open
chrome://extensions/, enable Developer mode, and choose Load unpacked with this repository directory. - Reload the Discord tab after installing or updating the extension.
- Click the translation icon beside a message. Click it again to restore the original.
The default mode is manual. Set MANUAL_TRANSLATION: false in content.js to translate visible messages automatically. SOURCE_LANGUAGE, TARGET_LANGUAGE, and TRANSLATION_TIMEOUT_MS are configured near the top of the same file. If language detection is unreliable for short messages or slang, use a fixed source language. The extension caches completed translations in memory and lets you retry failures from the icon.
node --test tests/translation.test.cjsWith a compatible local server running, node tests/live-translation.cjs checks the client-to-API path and a real translation. It does not check the rendering in a signed-in Discord session.
