A Raycast extension that translates text to multiple languages at once
by antfuTypeScript
Last 12 weeks · 0 commits
5 of 6 standards met
@algora-pbc /claim #7 Closes #7. Changes New preference (password field) - set it in the extension preferences to enable DeepL. when a DeepL API key is configured and both source/target languages are supported by the DeepL v2 API, translations route through DeepL ( or the host for keys). Any unsupported language automatically falls back to Google Translate. Auto-detects source language when omitted, maps detected codes back to the app language codes. Handles 429/456 (rate/quota limit) and 403 (invalid key) with friendly s. Cache keys now include the active provider, so results never leak between Google and DeepL. README - documents the DeepL (BYOK) setup. Verification succeeds (entry compiled, TS definitions generated). passes with no errors. Note: is currently broken on (repo uses legacy with v4, which requires flat config) - the failure is at config-load time and is unrelated to this change. claim-recheck-marker
Fixes #7 Adds DeepL as an optional BYOK (Bring Your Own Key) translation provider while keeping Google Translate as the default. Changes New dropdown preference (Google Translate / DeepL), defaulting to Google so existing behavior is unchanged New password preference for your DeepL API key (https://www.deepl.com/docs-api); free keys end with dispatches to DeepL when selected, using DeepL's endpoint via global (no new runtime dependencies) Language-code mapping from the extension's Google-style codes to DeepL codes; unsupported languages throw a clear error instead of failing silently Caching is scoped per provider so switching providers never returns stale results /claim #7 _Generated by Agent Core_
Refactored inline language code extraction to be completely pure and computed during render, which avoids side-effects/warnings caused by updating states during render. Additionally, prevented and from running when input is empty using the option of , and restricted rendering of to only when the corrected text is actually different from the source text. $ https://github.com/antfu/raycast-multi-translate/issues/7 Fixes https://github.com/antfu/raycast-multi-translate/issues/7
Summary Adds DeepL as an alternative translation provider, selectable per-extension. Google Translate remains the default — DeepL is opt-in via preferences. Closes #7 /claim #7 What's added New Translation Provider preference ( default, opt-in) DeepL API Key preference (password field) DeepL Plan preference ( → , → ) What's refactored Pulls translation logic out of into per-provider modules so adding more providers later stays cheap: The cache key now includes the provider, so toggling Google ↔ DeepL won't surface stale entries. DeepL implementation notes No new runtime dependency — uses the global available in the Raycast Node runtime Source language: uppercased and region-stripped (DeepL source codes are region-less) Target language picks sensible defaults where DeepL requires region: → → / → → Unsupported target languages return from the mapping helper so the call site surfaces a clear error rather than a generic 4xx Error mapping: → (bad key or wrong plan endpoint) → → other → Validation — clean (after regenerating via ) — built extension successfully Smoke test of the lang-code conversion functions ( export from ): 14/14 cases pass source: →undefined, →, →, → target: →, →, →, →, →, →, unsupported →undefined, →undefined from-DeepL: →, → Why no dependency The official SDK adds ~1 MB of transitive deps for what is effectively one POST endpoint. Sticking with keeps the bundle lean and avoids a runtime dep just to set one header. Out of scope Per-language provider routing (always uses the selected provider for the whole translation set) DeepL glossary support Formal test suite — repo currently has no test runner configured; conversion-helper smoke test was run via against exports
Repository: antfu/raycast-multi-translate. Description: A Raycast extension that translates text to multiple languages at once Stars: 500, Forks: 41. Primary language: TypeScript. Languages: TypeScript (94.6%), Swift (5.4%). License: MIT. Topics: raycast-extension, translate. Open PRs: 9, open issues: 1. Last activity: 11mo ago. Community health: 85%. Top contributors: antfu, tmkx, Innei, MeleMannen.