# studio.translate.ollama Translate-hook plugin for F∆I Studio. Routes the `translate` call through a configured Ollama-shaped `/api/chat` endpoint so server-supplied English text (MCP tool descriptions, n8n endpoint names, `[EN]`-badged strings) gets translated into the active Studio locale on the fly. ## Capability - `studio.translate.ollama@0.1.0` ## Hook implemented - `translate(text, from_locale, to_locale) -> string` The other two Studio-plugin hooks (`theme`, `output-view`) return `PluginError::Declined` — this plugin only translates. ## Configuration Reads two environment variables that the operator exposes via the plugin's `env:` permission: | Variable | Default | | ----------------- | ------------------------------------ | | `OLLAMA_ENDPOINT` | `http://localhost:11434/api/chat` | | `OLLAMA_MODEL` | `qwen2.5:14b` | To point at a different endpoint (e.g. a remote inference node), set `OLLAMA_ENDPOINT` before starting `fai serve` and make sure the host appears in the `net:` permissions below. ## Permissions ```yaml permissions: - "net: localhost" - "net: 127.0.0.1" - "net: ollama" ``` Operators that route through a non-loopback endpoint extend their operator-policy ceiling to include the upstream host. ## How the system prompt works The plugin sends two messages to the model: a fixed system prompt that constrains the output to ONLY the translation (no quotation marks, no commentary, no explanation) and a user message with the source text. The locale hint goes in the system prompt so the model treats it as a directive, not as translatable content. This keeps the translate hook's contract honest: caller expects a plain string back, not a markdown-wrapped LLM response. ## Limits in v0.1.0 - No glossary / terminology list — the model relies on its general training. - No batching. Each call is one HTTP request. - No caching. Studio's plugin-host may add a per-call cache in a future iteration. ## Build ```bash cargo build --release --target wasm32-wasip2 # Output: target/wasm32-wasip2/release/studio_translate_ollama.wasm ```