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
Vérifiez chaque signature webhook via verifyHeader(payload, sig) ou appuyez sur Option+T avant de renvoyer HTTP 200.
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.
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
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.