theseus/bundled-addons/translate/addon.json
Local Dev 501c7cf273 feat(theseus/translate): new sidebar add-on — right-click Translate selection
Adds a bundled add-on `translate` with a sidebar panel + a right-click
"Translate selection" menu item. Two swappable backends:

- LibreTranslate (default) — free MIT engine; the panel's Settings tab
  lets the user point at any instance (public or self-hosted) and drop
  in an API key if one's required.
- Google (unofficial free endpoint at translate.googleapis.com/
  translate_a/single) — no key, wide coverage, but unofficial and
  Google can break it any time. Opt-in fallback.

Flow: user selects text on a page, right-clicks -> "Translate
selection". Add-on's context-menu handler stashes the selection under
storage.__pending and calls api.revealSidebar("main"); the panel
loads, drains __pending on first paint, and translates. Ctrl/Cmd+Enter
in the input textarea also translates. Source + target language
choices, browser-language default target, swap button, copy-to-
clipboard on the output, settings gear.

Depends on a new "context-menu-item" capability + api.revealSidebar
hook in addons-host.js / main.js. Those wiring changes are prepared
but not committed here — a parallel session is refactoring the same
functions concurrently, so the safe path is to land translate/ first
and let the wiring go in alongside the next host-facing commit. Until
the wiring lands, the manifest's "context-menu-item" cap is silently
dropped (per validateManifest's unknown-caps policy) and the sidebar
panel + the panel's translation UI still work standalone — the
right-click entry point is what's gated.
2026-09-20 17:50:06 +02:00

19 lines
569 B
JSON

{
"id": "translate",
"name": "Translate",
"version": "0.1.0",
"description": "Right-click a selection to translate it. Sidebar panel with LibreTranslate or Google as the backend.",
"author": "Silent Mode",
"icon": "🌐",
"main": "index.js",
"capabilities": ["sidebar-panel", "context-menu-item"],
"context-menu-items": [
{
"id": "translate-selection",
"label": "Translate selection",
"when": "selectionText",
"icon": "🌐"
}
],
"updateURL": "https://navigate.st/bns/theseus.x/extensions/translate/updates.json"
}