v2-refactor-temp/docs/ai/translate-on-main.md
The current source of truth is Text Translation. This file records the v2 design outcome and is not an API reference.
The v2 migration moved model selection, prompt construction, and provider streaming into Main without making translation a chat turn:
renderer translateText
-> IpcApi translate.open
-> translateService.open
-> AiStreamManager.streamPrompt
-> WebContentsListener
-> renderer ai.stream.* subscribers
Translation has no assistant, message history, tools, or chat
RequestFeature stack. Qwen-MT receives raw text; other models receive the
configured translation prompt.
translateService remains a direct-import singleton. It owns no long-lived
resource or persistent side effect; the lifecycle-owned IpcApi layer owns route
registration.
translate.open is a chunks-only route with { streamId, text, targetLangCode }. It has no message target and does not write message or
translation-history data.
Home chat persists the current data-translation part through
homeMessageListAdapter.translateMessage and ChatWrite.editMessage. Other
callers keep the accumulated result locally.
The earlier optional messageId / sourceLangCode request fields,
renderer-side translation overlay, and Main-side TranslationBackend lost
their production consumer when Home moved to the page adapter. They were
removed rather than optimized as an external store or Cache entry.
providerOptions.dashscope.translation_options.target_lang override.useDetectLang remains renderer-owned.translate_history rows.