Offline Translation in Alfred: No API Keys, No Network, No Account

작성자

카테고리:

← 피드로
DEV Community · Kamil Kujawiński · 2026-09-20 개발(SW)
Cover image for Offline Translation in Alfred: No API Keys, No Network, No Account

Kamil Kujawiński

macOS 26 ships translation models on the device. The Translate app uses them, Safari uses them, and Apple exposes them to developers through the Translation framework. They sit on your disk, they work in airplane mode, and until now the only way to reach them was to open an app and paste text into a box.

So I wired them into Alfred: alfred-offline-translator-workflow.

Type t some text, the translation appears inline, Enter copies it. The direction is detected automatically, so one keyword works both ways – t good morning and t dzień dobry both do the right thing without you telling them which language you just typed.

Translating a phrase in Alfred

No API key. No network call. No account. Nothing leaves the Mac, which matters more than it sounds once you notice how often the thing you paste into a translator is a client email or a half-finished contract.

Install

Download the latest .alfredworkflow from Releases and double-click it.

You need:

  • macOS 26 (Tahoe) or newer – that’s where the on-device translation API lives.
  • Alfred 5 with the Powerpack.
  • The languages you want, downloaded once (see below).

Usage

Trigger What it does t Translate between your configured pair, direction detected t >de Translate into German, source detected t de>en Both languages given explicitly t ? List every language and whether it is downloaded Universal Action → Translate offline Translate the selection and paste it over the original Hotkey (unassigned by default) Same, without opening Alfred

Enter copies the translation. ⌘Y shows it in large type.

The Universal Action is the one I reach for most: select a sentence anywhere, invoke it, and the translation replaces the selection in place.

Translating a selection with the Universal Action

The language pair and the keyword both live in the workflow’s Configuration in Alfred – no editing scripts. Set the pair to en,de, pt-BR,ja, or any two supported codes, and both directions work from that single keyword.

Languages

23 languages are available. Most are already on your Mac; the rest download on demand.

Status Languages Usually already installed da de en es fr it ja ko nb nl pt sv tr zh-Hans zh-Hant vi Need downloading pl ar hi id ru th uk

Type t ? to see exactly which ones are ready on your machine.

Listing the available languages

To add one: System Settings → General → Language & Region → Translation Languages.

Language & Region settings

Downloading translation languages

macOS cannot prompt for this from inside a workflow, so it’s a one-off manual step per language. If a model is missing, the workflow says so and points you here instead of failing silently.

Budget the disk space: roughly 1 GB per language family, because macOS bundles speech recognition alongside the translation models. The translation models themselves are about 210 MB.

Three things worth knowing

Some pairs go through English. Apple ships its models in families – Polish belongs with English, Russian and Ukrainian; German belongs with the western languages. So Polish → German has no direct model, however many languages you download. The workflow notices, translates in two hops automatically, and shows Polish → English → German as the subtitle. It costs about a third of a second extra.

Single words are the weak spot. Apple’s models resolve a bare word without context and sometimes pick an unexpected sense – Polish motyl comes back as “Spinnaker”, the sailing term, rather than “butterfly”. Adding a full stop or a few words of context fixes it. This isn’t the workflow; it’s the model, identical to what the Translate app gives you.

Quality is Apple’s. Good for everyday text, noticeably weaker than large cloud models on idioms, technical jargon and long documents. In exchange you get roughly half a second for a phrase, about a second for a full sentence, and no round trip to anyone’s server.

Building it yourself

The workflow is a small Swift CLI wrapped in Alfred script filters. DEVELOPMENT.md covers the CLI, the build script, how the workflow is assembled, and the signing and release pipeline.

Source and releases: github.com/kkujawinski/alfred-offline-translator-workflow

Originally published at https://digit11.com/blog/alfred-offline-translator/

원문에서 계속 ↗