Skip to content

Safari Translator

A lightweight webpage translator for Safari. It shows translations right below each paragraph or swaps text in place, using local Ollama models or Google Translate.

Year
2026
License
Open source, MIT
Release
v0.1.0
Runs on
macOS and Safari
Interactive Live Demo · Compare Before & After
Safari · docs.api-guide.io / webhooks

Vérifiez chaque signature webhook via verifyHeader(payload, sig) ou appuyez sur Option+T avant de renvoyer HTTP 200.

Verify every webhook signature with verifyHeader(payload, sig) or press Option+T before returning HTTP 200.

Les clés d'idempotence expirent après 24 heures ; les identifiants dupliqués sont ignorés sans relancer le traitement.

Idempotency keys expire after 24 hours; duplicate event IDs are safely skipped without re-running handlers.
Active engine: Local Ollama (127.0.0.1:11434) · Zero external network traffic; inline code and shortcut atoms stay intact.
Interactive demo above: compare raw foreign-language docs against inline bilingual or translation-only mode, and switch between local Ollama and Google Translate while inline code stays untouched.

What it is

Safari Translator adds translations directly beneath each paragraph in bilingual mode, or replaces text in place without breaking page layout or CSS line clamps.

One TypeScript and Preact codebase builds two ways: a single-file Userscript that runs through the free Userscripts Mac app with no code signing, and a native Safari MV2 extension built in Xcode.

You pick the translation engine for the task: a local OpenAI-compatible model such as Qwen 3.5 in Ollama, or Google Translate with zero setup.

Why we built it

Safari still has no built-in bilingual page translation. Without a paid Apple Developer account, Safari also turns off unsigned native extensions after every restart or 24 hours.

Most third-party translators charge a monthly fee or send whole pages to remote servers. We built a small, inspectable tool instead. It translates visible text first, leaves inline code, keyboard shortcuts, and math formulas alone, and runs offline on local models.

What stays on your Mac

Your settings, skip rules, and translation cache stay in Safari on your Mac. What leaves your machine depends only on the engine you choose:

With local Ollama
only extracted paragraph text goes to http://127.0.0.1:11434 on your own Mac. Nothing leaves your computer.
With Google Translate
only main-body paragraphs go out through the extension background script or GM.xmlHttpRequest, skipping navbars, code blocks, and sidebars.
Blocked by default
sign-in, checkout, and verification pages such as Apple ID, Google Accounts, Stripe, Cloudflare, WeChat, and DingTalk are skipped automatically.

Before translating, Safari Translator swaps inline <code>, <kbd>, <svg>, KaTeX, and MathJax nodes for placeholders, then puts the originals back cleanly.

How it works

Your Mac
Page in SafariScans visible text first
Filter and guardProtects code and math
Queue and cacheExtension or Userscript
Paragraph textTranslations
Ollama or GoogleLocal model or web API
The page script skips menus and protects inline code, then sends visible paragraphs in order to your local Ollama server or Google Translate.

Limits

  • Built for macOS Safari only. Windows and mobile browsers are not supported.
  • Without a paid Apple Developer certificate, Safari resets the native Xcode extension after a restart. For daily use, the single-file Userscript avoids this.
  • Do not turn on the Userscript and the native extension on the same page, or both will inject translations.
  • Site-specific selectors, such as GitHub repository headers, follow current page markup and may need updates if a site redesigns.

Status

Active open-source release, v0.1.0. Both the single-file Userscript and the Safari MV2 extension pass 79 automated unit tests.