feedback5 WI: server toasts and ticker lines carry msgid + params so the client shows them in the player's language

messaging.js: a toast / CUSTOM ticker line is a string (its own msgid) or a shared/i18n.js msg(); frames keep
the Chinese `text` (older clients) and add `msgid` / `params`; config.broadcasts lines carry their `args`
(the client fills the localized broadcast template; the player name {0} is never translated). Templated call
sites send msg(): the grant toast 「X:获得Y」, the summon-range and terrain withdrawals, the 联防 line,
eliminated / left lines, the 远见 / 奇迹 stack payouts and the 维多利亚 hammers; game-data names go as dn().
The protocol stays backward compatible (new fields optional). Tests that captured m.toast's argument render
it with renderMessage. No gameplay change: golden unchanged.
This commit is contained in:
sganggs committed 2026-10-05 20:19:58 +08:00
1 parent a12a539e4d
commit 5398a0cfc5
12 files changed
+166 -18

No files matched your search

+2 -1
View File
@@ -7,6 +7,7 @@
// the player state).
import { PHASE } from '../../../shared/constants.js';
import { msg, dn } from '../../../shared/i18n.js';
import { checkLoadout, resolveLoadout } from '../../../shared/protocol.js';
import { tileKey, boardOrder } from '../board.js';
@@ -126,7 +127,7 @@ export class PlayerBasics {
}
}
}
if (names.length) this.m.toast(this, 'warn', `地形变化:${names.join('、')}无法停留在原位置,已撤回整备区`);
if (names.length) this.m.toast(this, 'warn', msg('地形变化:{names}无法停留在原位置,已撤回整备区', { names: names.map(dn) }));
return moved;
}