mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1836] [CLOSED] [GUI] serve: a Chinese / English language switch for the web app (adapted to 0.2.0-beta) #3710
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#3710
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/1836
Author: @hogtinbao
Created: 10/10/2026
Status: ❌ Closed
Base:
main← Head:web-ui-zh📝 Commits (1)
c220736serve: a Chinese / English language switch for the web app (adapted to v0.1.45)📊 Changes
3 files changed (+704 additions, -0 deletions)
View changed files
➕
serve/web/i18n-zh.js(+702 -0)📝
serve/web/index.html(+1 -0)📝
serve/web/monitor.html(+1 -0)📄 Description
Problem and result
The web UI in
serve/web/is English-only. On a Chinese Windows install the settings page, the sampling drawer, the monitor table and even the server's own validation errors are unreadable to the person running the model, and there is no hook to translate them without editingapp.js/monitor.js— files upstream rewrites regularly.This PR adds a self-contained translation layer that is opt-in at runtime: one new file
serve/web/i18n-zh.jsplus one<script>line in each page. ALanguagecontrol in the header switches between English, 简体中文 and 中英文 (Chinese with the English original in small type beneath it). The default stays English, so anyone who never touches the control sees the current UI. Model output is never rewritten — chat bubbles, thinking, code blocks and tool-call payloads are in the skip list.Related discussion
#1836 — the earlier revision of this change (adapted to v0.1.45). It was closed by the 0.2.0-beta tracker reset, not on merit. This revision is rebased onto
e88ee39dand re-verified there.Approach
app.js,monitor.jsorapp.css; each page gets a single script tag. If the file is absent the pages behave exactly as today.56.9 tok/s,3,201 tokens · 12.3 tok/s,Saved (…); the earlier file is ….bak). AMutationObservertranslates nodes the pages create later, andtitle/placeholder/aria-label/<option>text is translated too./configremain English (only the option text is translated), so the layer cannot change what the server stores.Validation
Passed:
python -m unittest discover -s serve -p 'test_*.py'on this branch — Windows 11, Python 3.12, revision78e13aerebased one88ee39d:Ran 881 tests in 334.4s ... FAILED (errors=1, skipped=20). The one error isserve/test_winjob.py::test_children_end_with_a_killed_server(see Failed).python -m unittest serve.test_winjob -von pristinee88ee39din a clean worktree — the same error, 1 of 3 tests, so it is pre-existing on the base revision, not caused by this change.serve/server.pystarted with the layer attached;/healthreturned{"status": "ok", "loaded": true, "images": true, "image_generation": true, ...}; a/v1/chat/completionsrequest withreasoning_effort: "none"answered normally (18 tokens,finish_reason: "stop") — the API path is untouched.curl /andcurl /api-monitorreturn the pages with the added script tag;curl /web/i18n-zh.jsserves the file with HTTP 200.node --check serve/web/i18n-zh.js— no syntax errors.POST /config {"set": {"lazy_load": true}}returns the 400 messagelazy_load: lazy loading is text-only, and this model reads images ("vision"); that exact string, and the other seven validation messages fromserve/runconfig.py, are matched by the layer's rules (checked by evaluating the file's own dictionary + rules in node, and by POSTing the failing values).Failed:
serve/test_winjob.py::test_children_end_with_a_killed_server—TypeError: argument of type 'NoneType' is not iterableattest_winjob.py:32(the job-object query returns nothing on this machine). Reproduces one88ee39dwithout this branch, so it is environmental.Not run:
--dump-domhangs against the live page on this machine because it streams/metrics, so there is no scripted UI check in this PR.apps/host) — it has its own strings and is untouched here.Limits
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.