Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-6509 fix(telegram): speak English in the Telegram bot (#7358)
Bohan Jiang341372a89093
diff --git a/server/internal/integrations/telegram/outbound.go b/server/internal/integrations/telegram/outbound.goindex a935731081..72db89c0bf 100644--- a/server/internal/integrations/telegram/outbound.go+++ b/server/internal/integrations/telegram/outbound.go@@ -178,7 +178,7 @@ const (const streamPlaceholder = "…"// taskFailedText is sent when the agent run fails outright.-const taskFailedText = "❌ 智能体处理失败,请稍后重试。"+const taskFailedText = "❌ The agent run failed. Please try again."// NewOutbound builds the Telegram outbound subscriber.func NewOutbound(q outboundQueries, decrypt Decrypter, apiBase string, client *http.Client, logger *slog.Logger) *Outbound {diff --git a/server/internal/integrations/telegram/replier.go b/server/internal/integrations/telegram/replier.goindex 2fd784567c..468c2f9161 100644--- a/server/internal/integrations/telegram/replier.go+++ b/server/internal/integrations/telegram/replier.go@@ -28,10 +28,10 @@ import (// - Dropped addressed /issue commands: an authorization/status refusal.const (- msgFreshPending = "✅ 已准备开始新对话。你的下一条聊天消息将不带之前的上下文运行。"- msgIssueUsage = "请填写任务标题,格式如下:\n\n/issue <标题>\n[描述](可选)"- msgIssueNotMember = "你不是该 Multica 工作区的成员,因此无法创建任务。请让工作区管理员邀请你后重试。"- msgIssueDisabled = "该 Telegram 机器人未连接到 Multica(或已断开连接)。请让工作区管理员重新连接。"+ msgFreshPending = "✅ Fresh start ready. Your next chat message will run without previous context."+ msgIssueUsage = "Please include an issue title. Use:\n\n/issue <title>\n[description] (optional)"+ msgIssueNotMember = "You're not a member of this Multica workspace, so I can't file an issue for you. Ask a workspace admin to invite you, then send the command again."+ msgIssueDisabled = "This Telegram bot isn't connected to Multica (or was disconnected). Ask a workspace admin to reconnect it.")// bindingMinter is the binding-token surface the replier needs.@@ -168,7 +168,7 @@ func (r *OutboundReplier) sendBindingPrompt(ctx context.Context, inst engine.Resreturn fmt.Errorf("mint binding token: %w", err)}bindURL := r.appURL + r.bindingPath + "?token=" + url.QueryEscape(token.Raw)- text := "👋 要开始和我对话,请先绑定你的 Multica 账号:\n" + bindURL + "\n(链接 15 分钟内有效)"+ text := "👋 To start chatting with me, link your Telegram account to Multica:\n" + bindURL + "\n(This link expires in 15 minutes.)"return r.post(ctx, inst, msg, text)}@@ -210,18 +210,18 @@ func issueCreatedText(res engine.Result) string {id := issueResultIdentifier(res)title := strings.TrimSpace(res.IssueTitle)if title == "" {- return "✅ 已创建 " + id+ return "✅ Created " + id}- return "✅ 已创建 " + id + " — " + title+ return "✅ Created " + id + " — " + title}func issueDuplicateText(res engine.Result) string {id := issueResultIdentifier(res)title := strings.TrimSpace(res.IssueTitle)if title == "" {- return "⚠️ 未创建:已存在进行中的任务 " + id + "。"+ return "⚠️ Not created — active issue " + id + " already exists."}- return "⚠️ 未创建:已存在进行中的任务 " + id + " — " + title+ return "⚠️ Not created — active issue " + id + " already exists: " + title}func issueResultIdentifier(res engine.Result) string {diff --git a/server/internal/integrations/telegram/sender.go b/server/internal/integrations/telegram/sender.goindex 4afe779056..eba9028bc0 100644--- a/server/internal/integrations/telegram/sender.go+++ b/server/internal/integrations/telegram/sender.go@@ -12,14 +12,29 @@ import ("github.com/multica-ai/multica/server/internal/integrations/channel")-// User-facing copy the bot speaks in Telegram. Chinese-first, aligned with-// the Lark adapter's product voice (conventions.zh.mdx); the binding prompt-// carries the redeem link.+// User-facing copy the bot speaks in Telegram. English, matching the Slack+// and DingTalk adapters word for word wherever they say the same thing.+//+// The language is chosen per channel by who is on the other end, and this is+// the decision record so the next person does not "fix" it back (MUL-6509,+// #7349). WeCom and Lark are Chinese-market products — WeCom is China-only+// and their adapters keep Chinese copy on purpose. Telegram is blocked in+// mainland China and reaches everyone else, so a Chinese-first bot there+// speaks the wrong language to almost every user it has, starting with the+// binding prompt they must act on before anything else works.+//+// English rather than a locale lookup because this bot speaks before it knows+// who it is speaking to: the binding prompt is sent to an unbound sender, and+// user.language is only ever written by the settings language switcher, so it+// is NULL for anyone who never opened it. English is the product default+// (DEFAULT_LOCALE in packages/core/i18n/types.ts).+//+// The binding prompt carries the redeem link.const (- msgAgentOffline = "⚠️ 智能体当前离线,消息已记录。下次 daemon 上线后会自动继续处理。"- msgAgentArchived = "⚠️ 该智能体已归档,无法回复。请联系工作区管理员。"- msgUnsupportedType = "暂不支持此类消息,请发送文字内容。"- msgBindingGroupHint = "请先私聊我发送一条消息,再完成 Multica 账号绑定。"+ msgAgentOffline = "⚠️ The agent is offline right now. Your message was received and will be handled once it's back online."+ msgAgentArchived = "⚠️ This agent has been archived and can't respond. Please contact your workspace admin."+ msgUnsupportedType = "Sorry, I can't handle this kind of message yet. Please send text."+ msgBindingGroupHint = "Please message me in a direct chat first, then link your Multica account.")// maxMessageUnits caps one outbound sendMessage body. Telegram hard-caps adiff --git a/server/internal/integrations/telegram/telegram_channel.go b/server/internal/integrations/telegram/telegram_channel.goindex 7004dc3da3..6a0ae47894 100644--- a/server/internal/integrations/telegram/telegram_channel.go+++ b/server/internal/integrations/telegram/telegram_channel.go@@ -134,7 +134,7 @@ func (c *telegramChannel) dispatch(ctx context.Context, u Update) error {const (issueErrorReplyTimeout = 5 * time.Second- issueDispatchFailedText = "⚠️ 创建任务时发生内部错误,请稍后重试。"+ issueDispatchFailedText = "⚠️ I couldn't create that issue because an internal error occurred. Please try again.")// notifyIssueDispatchError prevents an addressed /issue command from failing