[GH-ISSUE #5820] [Feature]: Complete frontend i18n coverage — eliminate ~30 hardcoded strings to attract more international users #4044

Open
opened 2026-10-31 20:36:44 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @ghost on GitHub (Jul 5, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5820

The 3x-ui frontend already ships 13 translation files (2,071 keys each) and has i18next fully wired up. But the dashboard, log modals, sidebar, sub page and some form labels still have ~30 user-visible strings hardcoded in English (Statistic titles, table headers, protocol labels, etc.). So even with a complete zh-CN or pt-BR translation file, users of those languages still see mixed English on core screens.

This is a quick gap to close — the i18n engine is already there, just not fully used.

Describe the solution you'd like

Wrap the remaining hardcoded strings in t('key') and add corresponding keys to the translation files. Below is the full list — each entry is a direct code change, no design or architecture decisions needed.

P0 — Dashboard overview page (frontend/src/pages/index/IndexPage.tsx)

Line Hardcoded Suggestion
160 'Copied' use existing t('copied')
312 title="Xray" use existing t('pages.index.xrayStatus')
319 title="OS" new key 'pages.index.os'
427 title="IPv4" new key 'pages.index.ipv4'
434 title="IPv6" new key 'pages.index.ipv6'
448 title="TCP" new key 'pages.index.tcp'
455 title="UDP" new key 'pages.index.udp'
527-528 'Download' / 'config.json' new keys
537 'Copy' use existing t('copy')

P1 — Log modals & sidebar

File Line Hardcoded Suggestion
LogModal.tsx 111-116 Debug, Info, Warning, Error log levels new keys
LogModal.tsx 122 'SysLog' new key
XrayLogModal.tsx 27,168 DIRECT, BLOCKED, PROXY event labels new keys
XrayLogModal.tsx 230-236 Table headers Date From To Inbound Outbound Email new keys
XrayLogModal.tsx 187 'No Record...' new key
AppSidebar.tsx 184,192 'Sub Formats', 'DNS' sidebar labels new keys (...Label to avoid namespace conflict)

P1 — Sub page & settings

File Line Hardcoded Suggestion
SubPage.tsx 195-217 Client app names (V2RayNG, Sing-box, etc.) new keys
SubPage.tsx 316,346,376 SUB, JSON, CLASH tag labels new keys
GeneralTab.tsx 37-38 Gregorian (Standard), Jalalian new keys
useInboundColumns.tsx 79 title: 'ID' new key 'pages.inbounds.id'

P2 — Form labels

File Line Hardcoded Suggestion
reality.tsx 56 label="uTLS" new key
tls.tsx 39,68,72,77 SNI, uTLS, None, ALPN new keys
FallbacksCard.tsx 100 prefix="SNI" use existing t('pages.inbounds.form.serverNameIndication')
InboundFormModal.tsx ~98 protocol enum values as labels wrap in t()
ClientsPage.tsx 602 fileName: 'clients-export.json' new key
TestResultPopover.tsx 41,63 'failed' new key

每个改动都是 s/硬编码字符串/{t('key')}/ 的模式,无副作用。

Why this matters

Chinese users are a major part of this panel's audience. The zh-CN translation file already has 2,071 keys ready — but those ~30 hardcoded strings still show in English, making the UI feel half-translated. Same for Russian, Portuguese, Persian, and all other supported languages.

Filling these gaps is the last step to make the panel feel fully localized for every language we already support.

Which parts of the panel would this affect?

  • Frontend (UI / panel pages)

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @ghost on GitHub (Jul 5, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5820 ## Is your feature request related to a problem? The 3x-ui frontend already ships 13 translation files (2,071 keys each) and has i18next fully wired up. But the dashboard, log modals, sidebar, sub page and some form labels still have ~30 user-visible strings hardcoded in English (Statistic titles, table headers, protocol labels, etc.). So even with a complete zh-CN or pt-BR translation file, users of those languages still see mixed English on core screens. This is a quick gap to close — the i18n engine is already there, just not fully used. ## Describe the solution you'd like Wrap the remaining hardcoded strings in `t('key')` and add corresponding keys to the translation files. Below is the full list — each entry is a direct code change, no design or architecture decisions needed. ### P0 — Dashboard overview page (`frontend/src/pages/index/IndexPage.tsx`) | Line | Hardcoded | Suggestion | |------|-----------|------------| | 160 | `'Copied'` | use existing `t('copied')` | | 312 | `title="Xray"` | use existing `t('pages.index.xrayStatus')` | | 319 | `title="OS"` | new key `'pages.index.os'` | | 427 | `title="IPv4"` | new key `'pages.index.ipv4'` | | 434 | `title="IPv6"` | new key `'pages.index.ipv6'` | | 448 | `title="TCP"` | new key `'pages.index.tcp'` | | 455 | `title="UDP"` | new key `'pages.index.udp'` | | 527-528 | `'Download'` / `'config.json'` | new keys | | 537 | `'Copy'` | use existing `t('copy')` | ### P1 — Log modals & sidebar | File | Line | Hardcoded | Suggestion | |------|------|-----------|------------| | `LogModal.tsx` | 111-116 | `Debug`, `Info`, `Warning`, `Error` log levels | new keys | | `LogModal.tsx` | 122 | `'SysLog'` | new key | | `XrayLogModal.tsx` | 27,168 | `DIRECT`, `BLOCKED`, `PROXY` event labels | new keys | | `XrayLogModal.tsx` | 230-236 | Table headers `Date` `From` `To` `Inbound` `Outbound` `Email` | new keys | | `XrayLogModal.tsx` | 187 | `'No Record...'` | new key | | `AppSidebar.tsx` | 184,192 | `'Sub Formats'`, `'DNS'` sidebar labels | new keys (`...Label` to avoid namespace conflict) | ### P1 — Sub page & settings | File | Line | Hardcoded | Suggestion | |------|------|-----------|------------| | `SubPage.tsx` | 195-217 | Client app names (`V2RayNG`, `Sing-box`, etc.) | new keys | | `SubPage.tsx` | 316,346,376 | `SUB`, `JSON`, `CLASH` tag labels | new keys | | `GeneralTab.tsx` | 37-38 | `Gregorian (Standard)`, `Jalalian` | new keys | | `useInboundColumns.tsx` | 79 | `title: 'ID'` | new key `'pages.inbounds.id'` | ### P2 — Form labels | File | Line | Hardcoded | Suggestion | |------|------|-----------|------------| | `reality.tsx` | 56 | `label="uTLS"` | new key | | `tls.tsx` | 39,68,72,77 | `SNI`, `uTLS`, `None`, `ALPN` | new keys | | `FallbacksCard.tsx` | 100 | `prefix="SNI"` | use existing `t('pages.inbounds.form.serverNameIndication')` | | `InboundFormModal.tsx` | ~98 | protocol enum values as labels | wrap in `t()` | | `ClientsPage.tsx` | 602 | `fileName: 'clients-export.json'` | new key | | `TestResultPopover.tsx` | 41,63 | `'failed'` | new key | 每个改动都是 `s/硬编码字符串/{t('key')}/` 的模式,无副作用。 ## Why this matters Chinese users are a major part of this panel's audience. The zh-CN translation file already has 2,071 keys ready — but those ~30 hardcoded strings still show in English, making the UI feel half-translated. Same for Russian, Portuguese, Persian, and all other supported languages. Filling these gaps is the last step to make the panel feel fully localized for every language we already support. ## Which parts of the panel would this affect? - [x] Frontend (UI / panel pages) ## Before submitting - [x] I searched [existing issues](https://github.com/MHSanaei/3x-ui/issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
Author
Owner

@github-actions[bot] commented on GitHub (Jul 5, 2026):

I checked the specifics against the current main source and the claims here largely hold up.

Confirmed:

  • 13 locale files in internal/web/translation/ (en-US.json + 12 others), each with 2071 scalar keys (verified with jq '[paths(scalars)] | length' on en-US.json, pt-BR.json, zh-CN.json, fa-IR.json, ru-RU.json — all identical).
  • Every P0 dashboard item in frontend/src/pages/index/IndexPage.tsx is hardcoded as described: 'Copied' (line 160), title="Xray" (312), title="OS" (319), title="IPv4" (427), title="IPv6" (434), title="TCP" (448), title="UDP" (455), 'Copy' (537), and the 'Download' / 'config.json' footer button text (528).
  • t('copied') and t('copy') do already resolve to "Copied"/"Copy", and t('pages.index.xrayStatus') already resolves to "Xray" — those three are indeed just a swap, no new key needed.
  • P1/P2 items also check out: AppSidebar.tsx lines 184/192 ('Sub Formats', 'DNS'), LogModal.tsx lines 111-115 (log level labels — plus 'SysLog' at line 122, not listed in the issue, same problem), XrayLogModal.tsx line 27 (EVENT_LABELS) and lines 230-235 (table headers, also 'No Record...' at 187), useInboundColumns.tsx line 79 (title: 'ID'), SubPage.tsx lines 195-217 (client app labels), GeneralTab.tsx lines 37-38, reality.tsx line 56, tls.tsx lines 39/68/72/77, FallbacksCard.tsx line 100, ClientsPage.tsx line 602, TestResultPopover.tsx lines 41/63, and InboundFormModal.tsx line 98 (PROTOCOL_OPTIONS labels taken straight from the Protocols enum values).

One correction to the suggested keys: pages.settings.subFormats and pages.xray.dns are already existing namespace objects (e.g. pages.xray.dns.enable, pages.xray.dns.strategy, …), not leaf strings, so those exact paths can't be reused as scalar keys — new leaf names will be needed there (e.g. something like pages.settings.subFormatsLabel / pages.xray.dnsLabel) to avoid colliding with the existing objects.

No eslint-plugin-i18n or comparable rule is currently configured in frontend/eslint.config.js, consistent with the issue's "Alternatives" section.

Given the source matches the report and you've already volunteered to implement it, this is ready for a PR. A couple of process notes from CONTRIBUTING.md and this repo's conventions that will apply here:

  • A new English key must be added to all 13 locale files, not just en-US.json — missing keys silently fall back to English/raw key rather than failing the build.
  • No // line comments in committed frontend code per repo convention; that shouldn't affect this change since it's just string/key swaps.
  • Please keep the PR scoped to the string-externalization edits themselves (the eslint-rule idea in your "Implementation steps" is reasonable as a separate follow-up, not bundled into this one).

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4886968730 --> @github-actions[bot] commented on GitHub (Jul 5, 2026): I checked the specifics against the current `main` source and the claims here largely hold up. **Confirmed:** - 13 locale files in `internal/web/translation/` (`en-US.json` + 12 others), each with 2071 scalar keys (verified with `jq '[paths(scalars)] | length'` on `en-US.json`, `pt-BR.json`, `zh-CN.json`, `fa-IR.json`, `ru-RU.json` — all identical). - Every P0 dashboard item in `frontend/src/pages/index/IndexPage.tsx` is hardcoded as described: `'Copied'` (line 160), `title="Xray"` (312), `title="OS"` (319), `title="IPv4"` (427), `title="IPv6"` (434), `title="TCP"` (448), `title="UDP"` (455), `'Copy'` (537), and the `'Download'` / `'config.json'` footer button text (528). - `t('copied')` and `t('copy')` do already resolve to `"Copied"`/`"Copy"`, and `t('pages.index.xrayStatus')` already resolves to `"Xray"` — those three are indeed just a swap, no new key needed. - P1/P2 items also check out: `AppSidebar.tsx` lines 184/192 (`'Sub Formats'`, `'DNS'`), `LogModal.tsx` lines 111-115 (log level labels — plus `'SysLog'` at line 122, not listed in the issue, same problem), `XrayLogModal.tsx` line 27 (`EVENT_LABELS`) and lines 230-235 (table headers, also `'No Record...'` at 187), `useInboundColumns.tsx` line 79 (`title: 'ID'`), `SubPage.tsx` lines 195-217 (client app labels), `GeneralTab.tsx` lines 37-38, `reality.tsx` line 56, `tls.tsx` lines 39/68/72/77, `FallbacksCard.tsx` line 100, `ClientsPage.tsx` line 602, `TestResultPopover.tsx` lines 41/63, and `InboundFormModal.tsx` line 98 (`PROTOCOL_OPTIONS` labels taken straight from the `Protocols` enum values). **One correction to the suggested keys:** `pages.settings.subFormats` and `pages.xray.dns` are already existing *namespace objects* (e.g. `pages.xray.dns.enable`, `pages.xray.dns.strategy`, …), not leaf strings, so those exact paths can't be reused as scalar keys — new leaf names will be needed there (e.g. something like `pages.settings.subFormatsLabel` / `pages.xray.dnsLabel`) to avoid colliding with the existing objects. No `eslint-plugin-i18n` or comparable rule is currently configured in `frontend/eslint.config.js`, consistent with the issue's "Alternatives" section. Given the source matches the report and you've already volunteered to implement it, this is ready for a PR. A couple of process notes from `CONTRIBUTING.md` and this repo's conventions that will apply here: - A new English key must be added to **all 13** locale files, not just `en-US.json` — missing keys silently fall back to English/raw key rather than failing the build. - No `//` line comments in committed frontend code per repo convention; that shouldn't affect this change since it's just string/key swaps. - Please keep the PR scoped to the string-externalization edits themselves (the eslint-rule idea in your "Implementation steps" is reasonable as a separate follow-up, not bundled into this one). *This reply was generated automatically; a maintainer may follow up.*
Author
Owner

@oraysercan commented on GitHub (Aug 27, 2026):

Thanks for documenting the remaining strings in detail. We’re working on Contentrain Normalize, which detects hardcoded UI content and generates a reviewable extraction plan for existing codebases.

https://contentrain.io/

This issue looks like a useful small validation case. Would the maintainers be open to us running a dry-run against the frontend and sharing the detected strings and proposed changes here before preparing a PR?

<!-- gh-comment-id:5439133966 --> @oraysercan commented on GitHub (Aug 27, 2026): Thanks for documenting the remaining strings in detail. We’re working on Contentrain Normalize, which detects hardcoded UI content and generates a reviewable extraction plan for existing codebases. https://contentrain.io/ This issue looks like a useful small validation case. Would the maintainers be open to us running a dry-run against the frontend and sharing the detected strings and proposed changes here before preparing a PR?
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#4044
No description provided.