[GH-ISSUE #6562] [Bug]: Telegram bot sends hardcoded English "QRCode for client" message regardless of configured bot language #4398

Closed
opened 2026-10-31 20:39:23 +07:00 by bsakaguchi · 2 comments
Owner

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

  1. Install 3x-ui (official install script), set the Telegram bot up (Settings → Telegram Bot) with language ru-RU.
  2. Open the bot in Telegram as admin.
  3. Navigate to a client / inbound and press the QRCode action.
  4. Observe the message caption.

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

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
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 <email>:" 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 1. Install 3x-ui (official install script), set the Telegram bot up (Settings → Telegram Bot) with language ru-RU. 2. Open the bot in Telegram as admin. 3. Navigate to a client / inbound and press the QRCode action. 4. Observe the message caption. ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### 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 - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:39:23 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@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:

// Inform user
t.SendMsgToTgbot(chatId, "QRCode for client "+email+":")

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")) at tgbot_client.go:245 and tgbot_send.go:53 and :67, which resolves via internal/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: initTGBotLocalizer reads settingService.GetTgLang() and builds LocalizerBot (internal/web/locale/locale.go:133-141), and I18nBot is a thin wrapper over locale.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, in sendClientQRLinks — the caption is built by string concatenation instead of t.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 by ed96fa09 "tgbot: subscription,qrcode, link" (2025-09-14, first carried by v2.8.0), which added sendClientQRLinks with 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 only 0829f1ec and the 41645255 file 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) where botLang, err := settingService.GetTgLang()
  • internal/web/translation/en-US.json:2337 — "email": "📧 Email: {{ .Email }}\r\n", the existing placeholder style for a parameterized bot message
    Not 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 in internal/web/translation/ with the {{ .Email }} placeholder style already used at en-US.json:2337 (the == separator is parsed by createTemplateData, 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.

<!-- gh-comment-id:5691113814 --> @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`: ```go // Inform user t.SendMsgToTgbot(chatId, "QRCode for client "+email+":") ``` 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"))` at `tgbot_client.go:245` and `tgbot_send.go:53` and `:67`, which resolves via `internal/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: `initTGBotLocalizer` reads `settingService.GetTgLang()` and builds `LocalizerBot` (`internal/web/locale/locale.go:133-141`), and `I18nBot` is a thin wrapper over `locale.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`, in `sendClientQRLinks` — the caption is built by string concatenation instead of `t.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 by `ed96fa09` "tgbot: subscription,qrcode, link" (2025-09-14, first carried by `v2.8.0`), which added `sendClientQRLinks` with 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 only `0829f1ec` and the `41645255` file 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)` where `botLang, err := settingService.GetTgLang()` - `internal/web/translation/en-US.json:2337` — `"email": "📧 Email: {{ .Email }}\r\n"`, the existing placeholder style for a parameterized bot message Not 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 in `internal/web/translation/` with the `{{ .Email }}` placeholder style already used at `en-US.json:2337` (the `==` separator is parsed by `createTemplateData`, `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.* <!-- claude-issue:analyst -->
Author
Owner

@BlindMaster24 commented on GitHub (Sep 16, 2026):

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 7ef22f9).

How to reproduce the problem

  1. Install 3x-ui (official install script), set the Telegram bot up (Settings → Telegram Bot) with language ru-RU.
  2. Open the bot in Telegram as admin.
  3. Navigate to a client / inbound and press the QRCode action.
  4. Observe the message caption.

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

  • I searched existing issues and this bug has not been reported.[x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it).[x] This bug report is written in English.[x] I have redacted any sensitive data (tokens, real domains, client UUIDs).

Fix coming later.

<!-- gh-comment-id:5692898659 --> @BlindMaster24 commented on GitHub (Sep 16, 2026): > ### 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 [7ef22f9](https://github.com/MHSanaei/3x-ui/commit/7ef22f94c950ff09f0870e2295fa65ad5968742c)). > > ### How to reproduce the problem > 1. Install 3x-ui (official install script), set the Telegram bot up (Settings → Telegram Bot) with language ru-RU. > 2. Open the bot in Telegram as admin. > 3. Navigate to a client / inbound and press the QRCode action. > 4. Observe the message caption. > > ### 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 > * [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported.[x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it).[x] This bug report is written in English.[x] I have redacted any sensitive data (tokens, real domains, client UUIDs). Fix coming later.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#4398
No description provided.