[PR #6564] [MERGED] fix(tgbot): localize QR caption via I18nBot #6353

Closed
opened 2026-11-02 04:08:10 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6564
Author: @sdhfsl
Created: 9/16/2026
Status: ✅ Merged
Merged: 9/16/2026
Merged by: @MHSanaei

Base: main ← Head: fix-bot-qr-i18n


📝 Commits (8)

  • 959e6fd fix(panel): accept 2FA codes from adjacent TOTP windows
  • f3096bb fix(panel): share TOTP skew tolerance with VerifyTwoFactorCode
  • 198ac75 Merge branch 'main' into main
  • 19f2e95 fix(tgbot): localize QR caption via I18nBot
  • ea79df3 fix(tgbot): repair locale JSON syntax, harden QR i18n test
  • 60e2eca Merge branch 'main' into fix-bot-qr-i18n
  • 1a4c60f Merge branch 'main' into fix-bot-qr-i18n
  • 7c8b2ca chore(tgbot): drop QR caption tests that cannot catch the bug

📊 Changes

14 files changed (+27 additions, -14 deletions)

View changed files

📝 internal/web/service/tgbot/tgbot_client.go (+1 -1)
📝 internal/web/translation/ar-EG.json (+2 -1)
📝 internal/web/translation/en-US.json (+2 -1)
📝 internal/web/translation/es-ES.json (+2 -1)
📝 internal/web/translation/fa-IR.json (+2 -1)
📝 internal/web/translation/id-ID.json (+2 -1)
📝 internal/web/translation/ja-JP.json (+2 -1)
📝 internal/web/translation/pt-BR.json (+2 -1)
📝 internal/web/translation/ru-RU.json (+2 -1)
📝 internal/web/translation/tr-TR.json (+2 -1)
📝 internal/web/translation/uk-UA.json (+2 -1)
📝 internal/web/translation/vi-VN.json (+2 -1)
📝 internal/web/translation/zh-CN.json (+2 -1)
📝 internal/web/translation/zh-TW.json (+2 -1)

📄 Description

Problem

Fixes #6562.

sendClientQRLinks hardcoded English "QRCode for client "+email+":", bypassing I18nBot{} localization, so the caption stays English no matter the configured bot language (e.g. ru-RU).

Fix

  • Route the caption through t.I18nBot("tgbot.answers.qrCodeForClient", "Email=="+email).
  • Add the qrCodeForClient key (QRCode for client {{ .Email }}: pattern) to all 13 locale files (en-US original wording kept; ru-RU/zh-CN/zh-TW and others translated).

Tests

New TestQRCodeForClientLocalizes: en renders the original wording, ru renders Russian, no hardcoded English leaks into ru. Full tgbot package suite passes, go vet clean.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6564 **Author:** [@sdhfsl](https://github.com/sdhfsl) **Created:** 9/16/2026 **Status:** ✅ Merged **Merged:** 9/16/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix-bot-qr-i18n` --- ### 📝 Commits (8) - [`959e6fd`](https://github.com/MHSanaei/3x-ui/commit/959e6fd62b07efd1038d70ecc18c3bc59ce2e3c2) fix(panel): accept 2FA codes from adjacent TOTP windows - [`f3096bb`](https://github.com/MHSanaei/3x-ui/commit/f3096bb3c1e3091647101d80939da52ab054b21d) fix(panel): share TOTP skew tolerance with VerifyTwoFactorCode - [`198ac75`](https://github.com/MHSanaei/3x-ui/commit/198ac751d71b3b063a61b59efed80d50444febbf) Merge branch 'main' into main - [`19f2e95`](https://github.com/MHSanaei/3x-ui/commit/19f2e956f0887bfec8ac944fb763601b320d4b6b) fix(tgbot): localize QR caption via I18nBot - [`ea79df3`](https://github.com/MHSanaei/3x-ui/commit/ea79df3a94c025bd1b366cd83383c97120363811) fix(tgbot): repair locale JSON syntax, harden QR i18n test - [`60e2eca`](https://github.com/MHSanaei/3x-ui/commit/60e2eca0f53a5c9363c5dae61d2aa15c7717f5ae) Merge branch 'main' into fix-bot-qr-i18n - [`1a4c60f`](https://github.com/MHSanaei/3x-ui/commit/1a4c60f29d1dc43ae48a4b6e1d693204e46e04b8) Merge branch 'main' into fix-bot-qr-i18n - [`7c8b2ca`](https://github.com/MHSanaei/3x-ui/commit/7c8b2ca02d971df0f19b4d2df9976cf5e832603c) chore(tgbot): drop QR caption tests that cannot catch the bug ### 📊 Changes **14 files changed** (+27 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `internal/web/service/tgbot/tgbot_client.go` (+1 -1) 📝 `internal/web/translation/ar-EG.json` (+2 -1) 📝 `internal/web/translation/en-US.json` (+2 -1) 📝 `internal/web/translation/es-ES.json` (+2 -1) 📝 `internal/web/translation/fa-IR.json` (+2 -1) 📝 `internal/web/translation/id-ID.json` (+2 -1) 📝 `internal/web/translation/ja-JP.json` (+2 -1) 📝 `internal/web/translation/pt-BR.json` (+2 -1) 📝 `internal/web/translation/ru-RU.json` (+2 -1) 📝 `internal/web/translation/tr-TR.json` (+2 -1) 📝 `internal/web/translation/uk-UA.json` (+2 -1) 📝 `internal/web/translation/vi-VN.json` (+2 -1) 📝 `internal/web/translation/zh-CN.json` (+2 -1) 📝 `internal/web/translation/zh-TW.json` (+2 -1) </details> ### 📄 Description ## Problem Fixes #6562. `sendClientQRLinks` hardcoded English `"QRCode for client "+email+":"`, bypassing `I18nBot{}` localization, so the caption stays English no matter the configured bot language (e.g. ru-RU). ## Fix - Route the caption through `t.I18nBot("tgbot.answers.qrCodeForClient", "Email=="+email)`. - Add the `qrCodeForClient` key (`QRCode for client {{ .Email }}:` pattern) to all 13 locale files (en-US original wording kept; ru-RU/zh-CN/zh-TW and others translated). ## Tests New `TestQRCodeForClientLocalizes`: en renders the original wording, ru renders Russian, no hardcoded English leaks into ru. Full `tgbot` package suite passes, `go vet` clean. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:08:10 +07:00
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#6353
No description provided.