English | Русский
A lightweight, privacy-focused browser extension for real-time two-way translation in Discord Web (https://discord.com/*) powered by the Google Gemini API.
[🎙️ Subtitles] embedded in both the Discord voice status panel and input bar.⚡ Gemini (EN ➔ RU) or ⚡ Gemini (JA ➔ RU)).[⚡ Auto] toggle button embedded in the chat input bar for the current channel.Ctrl + ~ (Tilde / ё) instantly translates the typed text in the Discord Slate editor to the target language before sending.[ EN ▾ ] badge near the input bar opens a full popout menu with 9 supported languages without leaving Discord.RU ➔ EN ➔ RU) right above the chat bar before sending.chrome.storage.local.thinkingBudget = 0): 2.5 series models respond near-instantaneously (200–400 ms) without reasoning token latency or thoughts leaking into chat.**bold**, *italic*, ~~strikethrough~~, ||spoiler||, inline and multi-line code blocks ```).<@id>, <#id>, <@&id>), server custom emojis (<:name:id>), and URLs.EN / RU switcher.chrome.storage.local).generativelanguage.googleapis.com) with zero third-party telemetry or middleware servers.No build steps or dependencies required. Runs natively on pure JavaScript (Manifest V3):
git clone https://github.com/<your-username>/discord-gemini-translator.git).chrome://extensions
discord-gemini-translator folder.| Shortcut | Description |
|---|---|
Ctrl + ~ (or Ctrl + ё) |
Translate text currently typed in the Discord chat box to the target outgoing language |
discord-gemini-translator/
├── manifest.json # Extension Manifest V3 configuration
├── GEMINI.md # Mandatory development rules & guidelines for AI agents
├── assets/ # Project screenshots and promotional artwork
│ └── settings.png # Extension settings interface preview
├── icons/ # Extension icons (16x16, 48x48, 128x128 px and source SVG)
├── popup/ # Extension settings modal
│ ├── popup.html # Acrylic markup with data-i18n attributes
│ ├── popup.css # Glassmorphic and neon aesthetic styles
│ └── popup.js # EN/RU i18n, model loader, storage sync
├── background/ # Service worker
│ └── background.js # REST v1beta + WebSocket Gemini Multimodal Live API
├── content/ # Discord DOM integration scripts
│ ├── content.js # Button injections, chat observer & captions overlay (ISOLATED)
│ ├── content.css # Scoped styles for Discord UI (.dgt-*)
│ └── inject.js # WebRTC audio capture, VAD, PCM 16kHz & Slate.js hooks (MAIN)
└── tests/ # Automated test suite (Native Node.js test runner)
├── i18n-no-hardcode.test.js # Audit preventing unlocalized UI text & dictionary leaks
├── live-captions.test.js # WebSocket Live API protocol & sentence aggregation
├── inject-audio.test.js # Audio downsampling to PCM 16kHz, VAD & Base64 encoding
├── background.test.js # Service worker, REST requests, LRU caching & errors
├── content.test.js # Chat integration, Slate editor replacement & selectors
└── popup.test.js # Settings validation & model filtering
The project has comprehensive automated test coverage built on the native Node.js test runner (node:test + node:assert/strict) with zero third-party test dependencies:
npm test
i18n-no-hardcode.test.js): ensures all HTML elements have data-i18n attributes, verifies 100% key parity between RU and EN, guarantees zero Cyrillic characters in English dictionaries, and statically audits JS files against raw string DOM assignments.live-captions.test.js): validates WebSocket messages, modality configuration, thought part filtering (thought: true), and sentence completion upon turnComplete.inject-audio.test.js): verifies WebRTC audio downsampling from 48 kHz to 16 kHz (16-bit mono PCM), RMS threshold calculations to cut silence, and Base64 chunking.background.test.js): tests REST endpoints, thinkingBudget: 0 enforcement, LRU translation cache eviction, and model list sanitization.content.test.js): verifies Slate.js editor text replacement without focus loss, channel auto-translation queues, and UI overlay containers.popup.test.js): validates separation of text vs live models, options persistence, and storage synchronization.All developers and AI agents must follow the repository standards documented in [GEMINI.md]. It establishes strict rules against hardcoded strings, requires dgt-* scoped CSS, specifies Slate.js integration requirements, and provides a Definition of Done checklist.
This project is licensed under the MIT License.