mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1204] [CLOSED] serve: a Chinese / English language switch for the web app #3308
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#3308
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/1204
Author: @hogtinbao
Created: 10/6/2026
Status: ❌ Closed
Base:
main← Head:web-ui-zh📝 Commits (1)
85b4553serve: a Chinese / English language switch for the web app📊 Changes
3 files changed (+674 additions, -0 deletions)
View changed files
➕
serve/web/i18n-zh.js(+672 -0)📝
serve/web/index.html(+1 -0)📝
serve/web/monitor.html(+1 -0)📄 Description
Adapted to Strata v0.1.41: the dictionary and the rules are current for the web interface of 0.1.41 (re-checked against every
app.jschange since this branch's base — see Coverage), and the branch is rebased onto today'smain(fb58e0d, the v0.1.41 release). It replaces #682, which GitHub closed automatically when the history was rewritten. The branch is a single commit.What this adds
An optional Chinese / English language switch for the web app, with a
Languagebutton at the left of the header: English / Simplified Chinese / Chinese + English.It is opt-in and reversible: the stock interface is what you get until someone picks another language.
Coverage: the whole 0.1.41 web interface is translated
Not a partial pass — every user-facing string in the two pages of this release, including the views added in 0.1.40 and the two strings 0.1.40.2 added:
+N% PCIe), the totals line, and the new Conversation cache panel — its bars, its four facts rows and both of its notes;cvecvalue, the experimental speed projection's line (Projection control vector on layers 4–44. Per chat in Sampling. …→ 在第 4~44 层上投影控制向量。…), which a rule matches because the mode (project / additive) and the layer numbers come from the engine at run time;runconfig.pyand are matched as data), and the two pieces of the form that are not sentences — the<option>text of its dropdowns (default/on/offrender as 默认 / 开 / 关; an enum choice keeps its config word with the meaning beside it:model(按模型习惯),start(开头)…) and the monospace config key beside each field, which keeps the key untouched and gets a short gloss after it (sampling.top_p(核采样范围),reasoning_budget_tokens(思考长度上限)…). The key names and thevalueattributes are never rewritten, so what a save writes to the run config stays exactly the English keys the server expects;title,placeholderandaria-label.How that was verified: every string literal and text node was extracted from
index.html,monitor.html,app.js,monitor.jsand theEDITABLElist inrunconfig.py(~264 candidates), then compared against the dictionary and the rules, with HTML line-wrapping normalised; every<option>label the settings form can render is checked against the option and general tables, and the short enum words are asserted absent from the general dictionary. For every later release the diff ofserve/web/was re-checked the same way: 0.1.40.2 added exactly two strings (not available,not available on Windows AMD yet— the GPU-fact placeholders shown on Windows AMD), both now in the dictionary, and 0.1.40.3 and 0.1.41 changed nothing inserve/web/at all, so the coverage above carries over unchanged. The projection sentence the About page composes from the engine'scvec(Projection control vector on layers 4–44. …) is covered by a rule. The remaining unlisted items are CSS class names, code fragments, Python docstrings and proper nouns (e.g.Top-p,Strata,Tok/s) — nothing a user reads.A new string added upstream later shows up untranslated rather than breaking anything, so this list only ever grows.
Files
serve/web/i18n-zh.jsserve/web/index.html<script>tagserve/web/monitor.html<script>tagNo existing function is modified, there is no new dependency, no server-side change and no API change (
/health,/v1/...are untouched — only the two HTML pages load the new file). Removing the feature is deleting one line per page.How it works
tok/s, the request table, theSince …totals line, the conversation-cache statistics, the composed per-message meta line, the projection sentence built from the engine'scvec, and so on).MutationObserverre-translates after the app re-renders, so the live Monitor — the status pill included — keeps updating in the chosen language, and it does so before the next paint, so nothing flickers back to English. Every write is guarded (if (el.textContent !== next)), which makes the observer converge: a secondtranslateAll()over the same page performs zero DOM writes (asserted in a test), so it can never feed itself into a loop.data-langattribute on<html>plus CSS decides which one is shown. Switching is instant and does not re-run the translation.Language/语言/语言 Language), and the choice is kept inlocalStorage(strata.lang).Guarantees
Englishrestores the stock interface, attributes included: every translatedtitle,placeholderandaria-labelkeeps its original value in adata-i18n-orig-*attribute, and every<option>and<code>key its original text indata-i18n-orig-text.Tested
On Windows 11, engine 0.1.40.3 and 0.1.41, in a real browser against a running server (a headless Edge dump of the live DOM — not a mock — plus the interactive page), on Qwen3.8-Flash-Next IQ2_XS and IQ3_XXS: all three modes on the Chat, Monitor and About tabs, in the sampling drawer and in the Model settings view; switching back and forth without a reload; reloading to confirm the stored choice comes back; the composed projection sentence on the About page; and the model-output check above.
Notes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.