mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6562] [Bug]: Telegram bot sends hardcoded English "QRCode for client" message regardless of configured bot language #4398
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#4398
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Originally created by @Bananosme on GitHub (Sep 16, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6562
Describe the bug
When a client requests a QR code from the panel's Telegram bot, the caption message "QRCode for client :" is sent in English even though the bot language is set to Russian (ru-RU) in Panel Settings → Telegram Bot. The string is hardcoded in sendClientQRLinks() in internal/web/service/tgbot/tgbot_client.go, bypassing I18nBot{} localization, so it cannot be translated. Verified present both in v3.8.5 (the version I run) and in current master (latest commit
7ef22f94).How to reproduce the problem
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.8.5
Xray-core version
26.9.9
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24.04
Which parts of the panel are affected?
Telegram bot
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
Yes — Nginx
Before submitting
@github-actions[bot] commented on GitHub (Sep 16, 2026):
Confirmed — that caption is a hardcoded Go string literal that never passes through
I18nBot, so no value of the Telegram bot language setting can change it. Your reading of the code is correct, including that it is still present at the tip (7ef22f94). There is no panel-side workaround; the string is compiled in.The deciding line is
internal/web/service/tgbot/tgbot_client.go:351:Everything else the same function sends is localized —
t.I18nBot("tgbot.answers.errorOperation")at lines 338, 361 and 373 — and so is the button that triggers the flow:tu.InlineKeyboardButton(t.I18nBot("qrCode"))attgbot_client.go:245andtgbot_send.go:53and:67, which resolves viainternal/web/translation/ru-RU.json:42("qrCode": "QR-код"). That is why a ru-RU bot gives you a Russian button followed by an English caption. No key for this string exists in any of the 13 locale JSON files, so this is an oversight rather than intended behaviour.The language plumbing itself is fine:
initTGBotLocalizerreadssettingService.GetTgLang()and buildsLocalizerBot(internal/web/locale/locale.go:133-141), andI18nBotis a thin wrapper overlocale.I18n(locale.Bot, ...)(internal/web/service/tgbot/tgbot.go:220-222). Line 351 simply never consults it.Verdict: Confirmed bug
Severity: Low
Confidence: High
Root cause:
internal/web/service/tgbot/tgbot_client.go:351, insendClientQRLinks— the caption is built by string concatenation instead oft.I18nBot(...), so it is emitted in English on every code path that reaches the QR action (tgbot_router.go:371,:1237,:1250,:1348), for every bot language. Introduced byed96fa09"tgbot: subscription,qrcode, link" (2025-09-14, first carried byv2.8.0), which addedsendClientQRLinkswith a hardcoded"QRCode"+":";0829f1ec(#4623) later rewrote the literal into its current form without localizing it.Already fixed: Still present on the default branch (
7ef22f94);git log --all -S 'QRCode for client 'returns only0829f1ecand the41645255file move.Duplicate of: None. (#2897 is about Russian wording quality of keys that do exist, a different root cause.)
Evidence:
internal/web/service/tgbot/tgbot_client.go:351—t.SendMsgToTgbot(chatId, "QRCode for client "+email+":")internal/web/service/tgbot/tgbot_client.go:245—tu.InlineKeyboardButton(t.I18nBot("qrCode")).WithCallbackData(...)(the same feature's button IS localized)internal/web/translation/ru-RU.json:42—"qrCode": "QR-код"internal/web/service/tgbot/tgbot.go:220-222—func (t *Tgbot) I18nBot(...) string { return locale.I18n(locale.Bot, name, params...) }internal/web/locale/locale.go:139—LocalizerBot = i18n.NewLocalizer(i18nBundle, botLang)wherebotLang, err := settingService.GetTgLang()internal/web/translation/en-US.json:2337—"email": "📧 Email: {{ .Email }}\r\n", the existing placeholder style for a parameterized bot messageNot determined: Nothing material. I could not run the bot here, but the literal is unconditional — it is reached before any language-dependent branch — so no configuration detail changes the outcome.
Suggested fix: Replace line 351 with a parameterized lookup such as
t.I18nBot("tgbot.messages.qrCodeFor", "Email=="+email), adding the key to all 13 files ininternal/web/translation/with the{{ .Email }}placeholder style already used aten-US.json:2337(the==separator is parsed bycreateTemplateData,internal/web/locale/locale.go:57-70). While in the area,internal/web/service/tgbot/tgbot_router.go:1215—t.SendMsgToTgbot(chatId, "Pick inbound(s) to attach:", picker)— is the only other hardcoded English bot message in the package and has the same defect.This reply was generated automatically; a maintainer may follow up.
@BlindMaster24 commented on GitHub (Sep 16, 2026):
Fix coming later.