feat(translate): inline per-message translation [operator-action] (LC-486) #466
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/LC-486-inline-translation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Per-message "Translate" into the viewer's language (LC-486), using the operator LLM, cached. Inspired by Telegram/Teams.
How
message_translations, migration 0071) keyed by (message_id, locale) so repeat opens and viewers sharing a locale are free. Editing a message invalidates its cached translations (patch_message->delete_for_message) so a re-translate reflects the new body.LlmClient::completewith a translation prompt; target language from the viewer's resolved locale (i18n::current_lang_code+language_name). Markdown/code/URLs/@mentions preserved.data-lc-llmon the room/DM page root (DmPage gainsllm_available; RoomPage already had it). Because the rule is ancestor-based, it also covers live-swapped message fragments - avoiding threading a flag through all 17MessageViewconstructors.Tests
Route: translate returns the model output and caches it; 400 when no LLM; cache upsert + invalidate round-trip. Regenerated the LC-77 webhook/email render fixtures for the new menu item + translation container.
just check,just test,just test-saasall green.Operator note
[operator-action]marker: no action required, but withLETS_CHAT_LLM_URLset, the Translate action now sends a message's text to the endpoint (cached) - in addition to the existing summary/transcript paths. Documented in the CLAUDE.md LLM row.Verify
just verifybuilds the release binary clean; boot fails only on the missing SSO env (environmental, as in prior PRs).Add a Translate item to the message overflow menu and a per-message #translation-{id} block under the body. The item is CSS-gated on an LLM being configured via data-lc-llm on the room/DM page root (DmPage gains llm_available; RoomPage already had it) - this also covers live-swapped message fragments since the rule is ancestor-based, avoiding threading a flag through all 17 MessageView constructors. patch_message clears cached translations so an edit re-translates. i18n en + es. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>