mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2164] [CLOSED] web: runtime i18n layer (English + Chinese), zero markup changes #3895
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3895
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2164
Author: @sdjger-xiaoniu
Created: 10/12/2026
Status: ❌ Closed
Base:
main← Head:webui-i18n📝 Commits (3)
8f3b290web: load the runtime i18n script in index.html248fc92web: load the runtime i18n script in monitor.html2539812web: add a runtime i18n layer (en + zh), no markup changes📊 Changes
3 files changed (+439 additions, -0 deletions)
View changed files
➕
serve/web/i18n.js(+435 -0)📝
serve/web/index.html(+2 -0)📝
serve/web/monitor.html(+2 -0)📄 Description
What
The web UI is English-only. This adds a runtime translation layer so the interface
follows the browser language, with no changes to the existing markup or logic —
index.htmlandmonitor.htmleach gain a single<script>line.Why runtime translation instead of editing the strings
app.jsare untouched, so this cannotchange behaviour, layout or the English text (English is the identity locale:
no entry means "show the source string as written").
app.jsbuilds a lot of the interface atruntime (statuses, metric labels, toasts, request rows). Those strings never
appear in the static HTML, so a markup-level approach would miss them.
A
MutationObserverkeeps translating as the page re-renders.LOCALESinserve/web/i18n.js— copyzhand translate the values. Nothing else changes.
How it picks a language
navigator.language(zh*→ Chinese, otherwise English), with a manual overridekept in
localStorage:Matching order
(
Generating · 42.1 tok/s→生成中 · 42.1 tok/s)app.jsassemblesfrom fragments (
Done,Speed,Power,6 cores · 12 threads)Technical terms stay in English on purpose:
GPU,VRAM,PCIe,Gen3,tok/s,MB/s,W,°C, and the product nameStrata.Scope
the sampling drawer and the API Monitor page (~300 entries).
Testing
Loaded against a local 0.1.43.1 install: chat, monitor, sampling drawer and
/api-monitorall render in Chinese; switching back to English restores theoriginal strings.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.