feedback5 W5S: a language switch in the middle of a screen re-reads the game texts — useGameData(), the 干员调配 / 干员持有 rosters, the strategy list and the open detail card list data.locale() among their memo dependencies (they kept the records of the language they were built in); docs/I18N.md

This commit is contained in:
sganggs committed 2026-10-06 18:35:33 +08:00
1 parent c2e77c7fe9
commit 250ad254a6
6 files changed
+8 -6

No files matched your search

+2 -1
View File
@@ -40,7 +40,8 @@ html`<span>${tParts('第 {r} 回合 · 最终攻势', { r: html`<b class="num">$
current language (§2). Do not wrap them in `t()`.
- **Re-rendering**: `main.js` App subscribes with `useLang()` (`public/js/ui/lang.js`), so the whole tree re-renders on a
switch. A component that caches text outside rendering (a `useMemo` returning text, a module-level string) must
depend on the language (`useLang()`) or move the `t()` call into rendering.
depend on the language (`useLang()`) or move the `t()` call into rendering; a memo over data records (the roster, the
strategy list, `useGameData()`) lists `data.locale()` among its dependencies, so the game texts follow the switch.
- Font samples, data keys and other Chinese that is not UI text can carry `// i18n-ignore` on the line.
### Translating