Skip to content

mattwiebe/babelkey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BabelKey

BabelKey is a local-first macOS translation overlay built for fast back-and-forth bilingual writing.

It is designed to stay out of the way until summoned by hotkey, then give you two independent text panes where either side can be the source. It currently targets translategemma-4b-it running in LM Studio on your Mac.

Features

  • Global summon/hide overlay hotkey
  • Two-pane translation UI with either pane acting as the source
  • Side-by-side and stacked layouts
  • Draggable, resizable, always-on-top overlay
  • Remembers window size and position
  • Per-pane copy actions and keyboard-first workflows
  • Translation history stored in SQLite
  • Configurable overlay color, opacity, and shortcut
  • Menu bar app with no Dock icon
  • Local LM Studio integration using the TranslateGemma prompt format

Requirements

  • macOS 14 or later
  • Xcode 16+ with command line tools
  • LM Studio
  • The translategemma-4b-it model already downloaded in LM Studio
  • gh if you want to publish or clone/fork with GitHub CLI
  • xcodegen if you want to regenerate the Xcode project from project.yml

How It Works

BabelKey talks to LM Studio through the local OpenAI-compatible completions endpoint:

  • http://127.0.0.1:1234/v1/completions

It does not depend on LM Studio’s chat-format adapter for TranslateGemma. Instead, it renders the model prompt directly so the request shape matches the model’s expected template.

Setup

1. Start LM Studio

In LM Studio:

  1. Load translategemma-4b-it
  2. Start the local server on port 1234
  3. Confirm the model is available before launching BabelKey

2. Build the app

From the repo root:

xcodebuild -project BabelKey.xcodeproj -scheme BabelKey -configuration Debug build

Or open BabelKey.xcodeproj in Xcode and run the BabelKey scheme.

3. Launch

The built app bundle is typically here:

open ~/Library/Developer/Xcode/DerivedData/BabelKey-*/Build/Products/Debug/BabelKey.app

On first launch:

  • the overlay appears immediately
  • a menu bar icon appears
  • the app runs as a menu bar utility with no Dock icon

Permissions

Accessibility

If you use the cross-app paste workflow (Cmd-Shift-V), BabelKey needs Accessibility permission:

  • System Settings
  • Privacy & Security
  • Accessibility

Without that permission, BabelKey can still copy the translation and close the overlay, but it cannot send the final paste command into the previously focused app.

Default Shortcuts

  • Global toggle: Cmd-Control-Option-Shift-T
  • Translate focused pane: Cmd-Return
  • Close overlay: Esc or Cmd-W
  • Quit app: Cmd-Q
  • Open Settings: Cmd-,
  • Focus left pane: Cmd-Shift-[
  • Focus right pane: Cmd-Shift-]
  • Copy left pane: Cmd-1
  • Copy right pane: Cmd-2
  • Copy selection or latest translation: Cmd-C
  • Copy latest translation and close overlay: Cmd-Shift-C
  • Copy latest translation, close overlay, refocus prior app, and paste: Cmd-Shift-V
  • Tab between panes: Tab

The global toggle shortcut is configurable in Settings.

Settings

BabelKey includes settings for:

  • global hotkey
  • overlay color
  • overlay transparency

The overlay becomes more transparent when the app is not active, while still preserving the configured focused opacity when the Settings window is open.

Data Storage

Translation history is stored locally in SQLite. Logged data includes:

  • source text
  • translated text
  • source and target language codes
  • prompt/completion/total tokens
  • latency
  • provider and model identifiers
  • error state

This is intended as a personal local utility. There is no cloud sync.

Development

Project structure:

  • BabelKey/Sources contains app, UI, model, and service code
  • BabelKey/Resources contains asset catalogs
  • BabelKey/Tests contains tests
  • project.yml is the XcodeGen source of truth

If you modify project.yml, regenerate the project with:

xcodegen generate

Then rebuild:

xcodebuild -project BabelKey.xcodeproj -scheme BabelKey -configuration Debug build

Run tests with:

xcodebuild -project BabelKey.xcodeproj -scheme BabelKeyTests -configuration Debug test -destination 'platform=macOS'

Notes

  • This app is currently optimized for macOS and LM Studio.
  • The translation provider layer is structured so other local models/providers can be added later.
  • The current default language pairing is English and Mexican Spanish, but the UI supports the broader TranslateGemma language set.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors