Perlover/offline-browser-translate

Privacy-focused translation using local LLMs (Ollama, LMStudio).

โ˜… 0Forks 0JavaScriptGitHub โ†—Compare

README

Local LLM Translator

A privacy-focused browser extension that translates web pages using local LLMs (Ollama or LMStudio). Your data never leaves your machine.

Features

  • ๐Ÿ”’ 100% Private - All translations happen on your local machine via Ollama or LMStudio
  • ๐ŸŽฏ Smart Prioritization - Visible content and headings are translated first
  • ๐ŸŒ Many Languages - Supports many many languages :3

Requirements

You need one of these running locally:

  • Ollama (default: http://localhost:11434)
  • LMStudio (default: http://localhost:1234)

With a translation-capable model loaded (e.g. TranslateGemma, tencent.hunyuan-mt, qwen3, etc.)

Installation

Firefox / Mullvad Browser

  1. Go to about:debugging#/runtime/this-firefox
  2. Click Load Temporary Add-on
  3. Select the manifest.json file

Chrome / Chromium

  1. Go to chrome://extensions
  2. Enable Developer mode
  3. Click Load unpacked
  4. Select the extension folder

Coming Soon: Extension in Chrome Web Store and Firefox Add-ons

Preview

Extension Screenshot

Usage

  1. Click the extension icon
  2. Select a model from the dropdown
  3. Choose your target language
  4. Click Translate Page

The extension will:

  • Extract all visible text from the page
  • Prioritize headings and visible content
  • Translate in batches with progress percentage
  • Auto-translate new content (infinite scroll)

Privacy

This extension is designed to be privacy-focused:

  • โœ… Only connects to localhost - no external network requests
  • โœ… No analytics or tracking
  • โœ… No data collection
  • โœ… Minimal permissions (only localhost host permissions)

Settings

Click Advanced Settings to configure:

Setting Description
Provider Auto-detect, Ollama only, or LMStudio only
URLs Custom endpoints for Ollama/LMStudio
Max tokens/items per batch Control batch sizes
Temperature Model creativity (lower = more consistent)
Request Format (work in progress) Default JSON, Hunyuan-MT, Simple, or Custom
Show Glow Toggle visual indicator on translated text

File Structure

โ”œโ”€โ”€ manifest.json      # Extension manifest (MV3)
โ”œโ”€โ”€ background.js      # Background script (LLM API, settings)
โ”œโ”€โ”€ content.js         # Content script (DOM manipulation)
โ”œโ”€โ”€ popup/
โ”‚   โ”œโ”€โ”€ popup.html     # Popup UI
โ”‚   โ”œโ”€โ”€ popup.css      # Styles (Everforest Dark theme)
โ”‚   โ””โ”€โ”€ popup.js       # Popup logic
โ””โ”€โ”€ icons/             # Extension icons

Development

The codebase is intentionally simple with no build step or dependencies:

  • Pure vanilla JavaScript
  • No external libraries
  • No bundler required
  • Works directly in the browser

Debug Logging

Enable the "Enable debug logging" checkbox in the extension's Options page (Output Settings section), then click Save.

To view the logs, go to about:debugging#/runtime/this-firefox, find Local LLM Translator and click Inspect โ€” debug messages with [Background] prefix will appear in the Console tab.

Alternatively, you can toggle debug directly from the Inspect console:

// Enable
browser.storage.local.get('settings').then(r => {
  const s = { ...r.settings, debug: true };
  browser.storage.local.set({ settings: s }).then(() => console.log('Debug enabled'));
});

// Disable
browser.storage.local.get('settings').then(r => {
  const s = { ...r.settings, debug: false };
  browser.storage.local.set({ settings: s }).then(() => console.log('Debug disabled'));
});

License

MIT

Contributors

EldopranoPerlover

Issues