Skip to content

Repository files navigation

Learn Lang Tool (LLT)

LLT is a browser extension for learning languages in context. Select a word, phrase, or sentence on any page to translate it instantly, then save it to Anki without leaving what you are reading.

The goal is to help you learn expressions in the context where you found them—not as isolated dictionary entries.

Features

  • Translate selected text directly on the page.
  • Translate the word under the cursor with a hold-to-translate hotkey.
  • Use Google Translate by default for translation quality.
  • Switch to local Bergamot translation for a private, offline en → ru workflow.
  • Save the original text, translation, and context sentence to a local Anki queue.
  • Synchronize queued cards through AnkiConnect or export them as TSV/CSV.
  • Generate English pronunciation locally with Kokoro and attach it to Anki cards.
  • Play translated text with a browser or operating-system voice matching the target language.
  • Capture text from regular web pages, Google Docs, YouTube subtitles, and the built-in PDF viewer.
  • Configure the language pair, translation provider, hotkey, Anki connection, and pronunciation settings.

How LLT works

  1. Select text on a page, or hold the configured hotkey over a word.
  2. LLT displays a translation popover next to the selection.
  3. The background provider router sends the translation request to the selected provider.
  4. Google Translate is used by default. In offline mode, Bergamot runs locally inside the extension.
  5. Add to Anki stores the translation result in a local queue.
  6. If Anki and AnkiConnect are available, LLT synchronizes the card immediately. Otherwise, it retries in the background.
┌─────────────────┐     ┌──────────────────┐     ┌────────────────────┐
│  Extension UI   │────▶│  Background      │────▶│  Google Translate  │
│  (popover)      │     │  provider router │     └────────────────────┘
│                 │◀────│                  │────▶ Offscreen / Bergamot
└─────────────────┘     └──────────────────┘

Google Translate receives the selected text when it is the active provider. With Bergamot, the model pack is downloaded with explicit consent and translation then works offline without sending selections to a translation service.

Special text sources

  • Google Docs: an accessibility frame reads canvas selections and forwards them to the visible translation popover. The clipboard fallback restores the user's clipboard.
  • YouTube: when there is no regular selection, the hotkey translates the current visible subtitle line.
  • Built-in PDF viewer: select text and choose Translate selection from the context menu; the result opens in the extension popup.

LLT and Yomitan

LLT is inspired by Yomitan, a mature language-learning extension with local dictionaries, frequency data, audio, and Anki export.

The main difference is focus: Yomitan excels at dictionary lookups, while LLT is designed around translating phrases and sentences as they appear on a page.

Yomitan LLT
Translation source Local dictionaries Google Translate or local Bergamot
Primary strength Rich word lookup Phrases, collocations, and sentences
Anki workflow Mature integration Local queue and AnkiConnect synchronization
Required infrastructure None No server; AnkiConnect is only needed for automatic synchronization

Install a release

Download the latest build from GitHub Releases.

Chrome

  1. Download and extract learn-lang-tool-*-chrome.zip.
  2. Open chrome://extensions.
  3. Enable Developer mode.
  4. Select Load unpacked and choose the extracted directory.

Firefox

  1. Download and extract learn-lang-tool-*-firefox.zip.
  2. Open about:debugging#/runtime/this-firefox.
  3. Select Load Temporary Add-on.
  4. Choose manifest.json from the extracted directory.

The Firefox package is currently a development build and must be loaded again after restarting the browser.

Anki setup

For automatic synchronization:

  1. Install the AnkiConnect add-on.
  2. Create an English deck.
  3. Use the Basic (and reversed card) note type with these fields:
    • Word
    • Reading
    • Sentence
    • Meaning
  4. Start Anki and approve LLT when AnkiConnect requests access.

LLT connects to http://127.0.0.1:8765 by default and adds the yomitan tag. Anki does not need to stay open: cards remain in the local queue and synchronize when it becomes available.

You can also export the queue as TSV/CSV and import it manually. After importing, remove those cards from the queue to prevent duplicate synchronization. AnkiConnect is not required when using export only.

Local development

Requirements:

  • Node.js
  • pnpm 10.4.1

Install dependencies and start the Chrome development build:

pnpm install
pnpm --filter @app/extension dev

Load the unpacked extension from apps/extension/dist_chrome.

Google Translate is selected by default. To use offline translation, open LLT settings, select Bergamot, and download the en → ru model pack (approximately 15 MB).

Verification

pnpm --filter @app/extension test
pnpm --filter @app/extension typecheck
pnpm --filter @app/extension lint
pnpm --filter @app/extension build:chrome
pnpm --filter @app/extension build:firefox

Repository structure

learn-lang-tool/
├── apps/
│   ├── extension/   # LLT browser extension
│   ├── api/         # Optional Fastify translation backend
│   └── translator/  # Optional FastAPI + Argos translation service
└── packages/
    └── shared/      # Shared translation contracts and defaults

apps/api and apps/translator are optional development and experimentation tools. They are not required for the extension's normal product path.

Run the optional backend:

pnpm --filter @app/translator models:install
pnpm --filter @app/translator dev   # http://localhost:8000
pnpm --filter @app/api dev          # http://localhost:3000

Technology

  • Extension: React 19, TypeScript, Vite, Tailwind CSS, Manifest V3
  • Translation: Google Translate, Bergamot WASM
  • Pronunciation: Kokoro, ONNX Runtime Web, Web Speech API
  • Anki: AnkiConnect, TSV/CSV export
  • Optional API: Fastify, TypeScript
  • Optional translator: FastAPI, Argos Translate, Poetry
  • Monorepo: pnpm workspaces

Project documentation

About

LLT — in-context browser translation with offline Bergamot, local pronunciation, and Anki synchronization.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages