[PR #7044] [MERGED] fix(sub): map single-bracket UI tokens and clarify host remark hint #6597

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/7044
Author: @DoctorGuidance
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @MHSanaei

Base: main ← Head: fix/sub-ui-tokens-host-remark


📝 Commits (3)

  • 7d2f454 fix(sub): map single-bracket UI tokens and clarify host remark hint
  • 99c39d4 Merge remote-tracking branch 'origin/main' into pr/7044
  • c9d375f fix(sub): keep the single-brace token list as it was

📊 Changes

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

View changed files

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

📄 Description

Summary

This PR addresses two closely related issues regarding subscription template token expansion and host remark documentation:

  1. Map Missing Single-Bracket Tokens in uiTokenMap:
    uiTokenMap in internal/sub/remark_vars.go previously only mapped 13 tokens. Operator-facing single-bracket tokens such as {HOST}, {INBOUND}, {ID}, {SHORT_ID}, {TELEGRAM_ID}, {SUB_ID}, {COMMENT}, {STATUS}, {EXPIRE_UNIX}, {CREATED_UNIX}, {TRAFFIC_*} bytes/totals, {UP}, {DOWN}, {RESET_DAYS}, {RESET_DAY}, and {USERNAME} were not included. As a result, when operators wrote {HOST} or {INBOUND} in their remark fields, they remained unexpanded in single brackets. All supported tokens from remarkVarValue are now mapped.

  2. Clarify pages.hosts.hints.remark Across All 14 Locales:
    The hint tooltip in pages.hosts.hints.remark previously stated:

"A plain label for this host. Shown as the config name only when the inbound has no remark of its own."
As designed in internal/sub/remark_vars.go, the host remark does not automatically substitute the inbound remark; rather, it is accessed through the {{HOST}} token in the Remark Template. This caused confusion for users (e.g., #7027). The tooltip hint has been updated across all 14 locale files to clearly instruct operators to insert {{HOST}} in the Remark Template.

Testing

  • Added unit tests for {HOST} and {INBOUND} single-bracket translations in TestTranslateUISingleBrackets and TestExpandRemarkVars_SingleBracketUI.
  • Verified that all 14 translation JSON files parse cleanly.

🔄 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/7044 **Author:** [@DoctorGuidance](https://github.com/DoctorGuidance) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/sub-ui-tokens-host-remark` --- ### 📝 Commits (3) - [`7d2f454`](https://github.com/MHSanaei/3x-ui/commit/7d2f454d6f03b3b3c73c5cba7ec24486764ee23b) fix(sub): map single-bracket UI tokens and clarify host remark hint - [`99c39d4`](https://github.com/MHSanaei/3x-ui/commit/99c39d4391ed0ad547603624d0e2a3c1a5dcfa08) Merge remote-tracking branch 'origin/main' into pr/7044 - [`c9d375f`](https://github.com/MHSanaei/3x-ui/commit/c9d375fd05910edc38fb66fff0593129a54d200b) fix(sub): keep the single-brace token list as it was ### 📊 Changes **14 files changed** (+14 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `internal/web/translation/ar-EG.json` (+1 -1) 📝 `internal/web/translation/en-US.json` (+1 -1) 📝 `internal/web/translation/es-ES.json` (+1 -1) 📝 `internal/web/translation/fa-IR.json` (+1 -1) 📝 `internal/web/translation/id-ID.json` (+1 -1) 📝 `internal/web/translation/ja-JP.json` (+1 -1) 📝 `internal/web/translation/pt-BR.json` (+1 -1) 📝 `internal/web/translation/ru-RU.json` (+1 -1) 📝 `internal/web/translation/sk-SK.json` (+1 -1) 📝 `internal/web/translation/tr-TR.json` (+1 -1) 📝 `internal/web/translation/uk-UA.json` (+1 -1) 📝 `internal/web/translation/vi-VN.json` (+1 -1) 📝 `internal/web/translation/zh-CN.json` (+1 -1) 📝 `internal/web/translation/zh-TW.json` (+1 -1) </details> ### 📄 Description ### Summary This PR addresses two closely related issues regarding subscription template token expansion and host remark documentation: 1. **Map Missing Single-Bracket Tokens in `uiTokenMap`**: `uiTokenMap` in `internal/sub/remark_vars.go` previously only mapped 13 tokens. Operator-facing single-bracket tokens such as `{HOST}`, `{INBOUND}`, `{ID}`, `{SHORT_ID}`, `{TELEGRAM_ID}`, `{SUB_ID}`, `{COMMENT}`, `{STATUS}`, `{EXPIRE_UNIX}`, `{CREATED_UNIX}`, `{TRAFFIC_*}` bytes/totals, `{UP}`, `{DOWN}`, `{RESET_DAYS}`, `{RESET_DAY}`, and `{USERNAME}` were not included. As a result, when operators wrote `{HOST}` or `{INBOUND}` in their remark fields, they remained unexpanded in single brackets. All supported tokens from `remarkVarValue` are now mapped. 2. **Clarify `pages.hosts.hints.remark` Across All 14 Locales**: The hint tooltip in `pages.hosts.hints.remark` previously stated: > *"A plain label for this host. Shown as the config name only when the inbound has no remark of its own."* As designed in `internal/sub/remark_vars.go`, the host remark does not automatically substitute the inbound remark; rather, it is accessed through the `{{HOST}}` token in the Remark Template. This caused confusion for users (e.g., #7027). The tooltip hint has been updated across all 14 locale files to clearly instruct operators to insert `{{HOST}}` in the Remark Template. ### Related Issues - Resolves #7027 ### Testing - Added unit tests for `{HOST}` and `{INBOUND}` single-bracket translations in `TestTranslateUISingleBrackets` and `TestExpandRemarkVars_SingleBracketUI`. - Verified that all 14 translation JSON files parse cleanly. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi changed title from [PR #7044] fix(sub): map single-bracket UI tokens and clarify host remark hint to [PR #7044] [MERGED] fix(sub): map single-bracket UI tokens and clarify host remark hint 2026-11-07 14:34:09 +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#6597
No description provided.