[PR #4620] [GUI] chat speed line showed raw {0}{1} placeholders in non-English languages: register its two live templates in every catalog #5115

Open
opened 2026-11-07 16:32:49 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4620
Author: @lamboJw
Created: 10/29/2026
Status: 🔄 Open

Base: main ← Head: fix-chat-speed-locale


📝 Commits (1)

  • 717924b Locales: register the chat speed pill's two live templates in every catalog

📊 Changes

10 files changed (+66 additions, -9 deletions)

View changed files

📝 apps/host/src/locales/de.json (+3 -1)
📝 apps/host/src/locales/en.json (+3 -1)
📝 apps/host/src/locales/es.json (+3 -1)
📝 apps/host/src/locales/fr.json (+3 -1)
📝 apps/host/src/locales/ja.json (+3 -1)
📝 apps/host/src/locales/ko.json (+3 -1)
📝 apps/host/src/locales/pt.json (+3 -1)
📝 apps/host/src/locales/ru.json (+3 -1)
📝 apps/host/src/locales/zh.json (+3 -1)
➕ apps/host/tests/chat-speed-locale.test.mjs (+39 -0)

📄 Description

Problem and result:
The chat footer speed line (UI language 中文, Strata 0.2.7) rendered as {0}{1} 词元/秒 · last reply 71: raw placeholders on screen, the speed number glued at the end, and · last reply left in English. Observed on my own PC (Windows 11). After this change the same line reads ≈ 18 词元/秒 · 上次回复 (≈ only while the figure is estimated): the number sits where the language's own word order wants it, in all nine languages.

Approach:
ChatTelemetry builds the live speed line through around() from tr("{0}{1} tok/s") (while a reply streams) and tr("{0}{1} tok/s · last reply") (after it). Neither literal has an English catalog key — only the label form {0}{1} tok/s{2} (s2542) is registered. In English the lookup returns the template itself so nothing looks wrong; in every other language tr() falls to its pattern path, which re-extracts slot values from the template text itself, so the {0} and {1} literals get captured and poured into the translated line. The "{0}{1} total tokens" chip did have a key, which is why only the speed chip broke. The fix is catalog-only: keys s9038 and s9039, each value derived from that language's own s2542 (speed unit) and s2496 (last reply) strings, so the slot parity checks hold and the existing terminology is reused (zh 词元/秒 and 上次回复 come from s2542/s2496 as they are). around() and the number element itself are untouched.

Validation:

  • Reproduction status: reproduced locally, twice. First, in the app UI on my PC (0.2.7, zh, screenshot: (0){1} 词元/秒 · last reply 71). Second, mechanically: the new test file on untouched main@46c152a1 fails both tests before the change, and the zh assertion prints {0}{1} 词元/秒18 (raw placeholder, number glued on).
  • Passed (node v24.11.1, Windows 11, apps/host): node --test tests/chat-speed-locale.test.mjs tests/languages-and-catalog.test.mjs tests/locale-gaps.test.mjs tests/tune-locales.test.mjs tests/tools-locales.test.mjs tests/answer-speed.test.mjs — 25 tests, 25 pass, including the two new ones and every existing catalog key/slot-parity check.
  • Not passed: full npm test on my machine exits with environment-only failures: the guided-setup-empty-catalog tests die on esbuild temp-file writes (Access is denied, sandboxed shell), the model-directory test on a Windows symlink privilege (EPERM), the Harness-dependent agent tests skip with STRATA_HARNESS_DIR is not set, and the real-browser tests skip as designed (STRATA_TEST_BROWSER). I ran those same two test files on untouched main@46c152a1 with this change stashed: identical failures, so they belong to my machine, not to this change. CI should run the full suite properly.

Limits:

  • No existing issue or PR matched this problem when I searched open and closed threads.
  • The added lines for ja/de/es/ru/pt/ko/fr are derived from each language's own s2542 and s2496 wording; a native speaker's eye on the new lines is welcome. The zh lines reuse the existing translations verbatim.
  • Catalog and test files only: no engine or host code touched, so no backend builds apply.

🔄 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/Niko1221/Strata/pull/4620 **Author:** [@lamboJw](https://github.com/lamboJw) **Created:** 10/29/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-chat-speed-locale` --- ### 📝 Commits (1) - [`717924b`](https://github.com/Niko1221/Strata/commit/717924bb54a83de477f1a90d25605a64d5d64078) Locales: register the chat speed pill's two live templates in every catalog ### 📊 Changes **10 files changed** (+66 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `apps/host/src/locales/de.json` (+3 -1) 📝 `apps/host/src/locales/en.json` (+3 -1) 📝 `apps/host/src/locales/es.json` (+3 -1) 📝 `apps/host/src/locales/fr.json` (+3 -1) 📝 `apps/host/src/locales/ja.json` (+3 -1) 📝 `apps/host/src/locales/ko.json` (+3 -1) 📝 `apps/host/src/locales/pt.json` (+3 -1) 📝 `apps/host/src/locales/ru.json` (+3 -1) 📝 `apps/host/src/locales/zh.json` (+3 -1) ➕ `apps/host/tests/chat-speed-locale.test.mjs` (+39 -0) </details> ### 📄 Description Problem and result: The chat footer speed line (UI language 中文, Strata 0.2.7) rendered as `{0}{1} 词元/秒 · last reply 71`: raw placeholders on screen, the speed number glued at the end, and `· last reply` left in English. Observed on my own PC (Windows 11). After this change the same line reads `≈ 18 词元/秒 · 上次回复` (`≈` only while the figure is estimated): the number sits where the language's own word order wants it, in all nine languages. Approach: `ChatTelemetry` builds the live speed line through `around()` from `tr("{0}{1} tok/s")` (while a reply streams) and `tr("{0}{1} tok/s · last reply")` (after it). Neither literal has an English catalog key — only the label form `{0}{1} tok/s{2}` (s2542) is registered. In English the lookup returns the template itself so nothing looks wrong; in every other language `tr()` falls to its pattern path, which re-extracts slot values from the template text itself, so the `{0}` and `{1}` literals get captured and poured into the translated line. The `"{0}{1} total tokens"` chip did have a key, which is why only the speed chip broke. The fix is catalog-only: keys `s9038` and `s9039`, each value derived from that language's own s2542 (speed unit) and s2496 (last reply) strings, so the slot parity checks hold and the existing terminology is reused (zh `词元/秒` and `上次回复` come from s2542/s2496 as they are). `around()` and the number element itself are untouched. Validation: - Reproduction status: reproduced locally, twice. First, in the app UI on my PC (0.2.7, zh, screenshot: `(0){1} 词元/秒 · last reply 71`). Second, mechanically: the new test file on untouched main@46c152a1 fails both tests before the change, and the zh assertion prints `{0}{1} 词元/秒18` (raw placeholder, number glued on). - Passed (node v24.11.1, Windows 11, apps/host): `node --test tests/chat-speed-locale.test.mjs tests/languages-and-catalog.test.mjs tests/locale-gaps.test.mjs tests/tune-locales.test.mjs tests/tools-locales.test.mjs tests/answer-speed.test.mjs` — 25 tests, 25 pass, including the two new ones and every existing catalog key/slot-parity check. - Not passed: full `npm test` on my machine exits with environment-only failures: the guided-setup-empty-catalog tests die on esbuild temp-file writes (`Access is denied`, sandboxed shell), the model-directory test on a Windows symlink privilege (`EPERM`), the Harness-dependent agent tests skip with `STRATA_HARNESS_DIR is not set`, and the real-browser tests skip as designed (`STRATA_TEST_BROWSER`). I ran those same two test files on untouched main@46c152a1 with this change stashed: identical failures, so they belong to my machine, not to this change. CI should run the full suite properly. Limits: - No existing issue or PR matched this problem when I searched open and closed threads. - The added lines for ja/de/es/ru/pt/ko/fr are derived from each language's own s2542 and s2496 wording; a native speaker's eye on the new lines is welcome. The zh lines reuse the existing translations verbatim. - Catalog and test files only: no engine or host code touched, so no backend builds apply. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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
Niko1221/Strata#5115
No description provided.