4. Conclusion
Conclusion
By combining TranslateGemma, a Bash script, and an Alfred Workflow, it is possible to build an environment where selecting text and pressing a hotkey completes a local translation. The text being translated is never sent externally, so documents such as internal company files or personal notes that you would rather not send to a cloud service can be handled with confidence. Translation quality was at a practical level, and sufficient accuracy was achieved for everyday use.
That said, this setup has its limitations. Because the script is dedicated to translation, adding other tasks such as proofreading or summarization requires writing separate scripts. It also requires a tool like Alfred as the trigger, so without it installed, the script only works as a command-line tool.
Evolution: myllm-cli
The idea of "applying the same mechanism to tasks beyond translation" led to the development of myllm-cli, a generalized redesign of the translate script. Whereas translate hardcoded the translation procedure in the script itself, myllm-cli defines task instructions (prompts) in a TOML configuration file, making it possible to execute arbitrary tasks. In addition to Ollama, it supports cloud APIs such as OpenAI and Anthropic. Language detection for translation was also extended beyond Japanese (ja).
Further Evolution: macOS App (My LLM)
While myllm-cli made it possible to invoke tasks other than translation from Alfred, the overhead of creating a shortcut for each task and the requirement for an Alfred license remained. To eliminate the dependency on Alfred and allow a global hotkey to be assigned directly to each task, a Swift-based macOS app called My LLM was developed. The app bundles the myllm script internally, with CLI and GUI sharing the same core logic.