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

+4 -2
View File
@@ -19,6 +19,8 @@
// assumed 1).
// Latched state lives in player counters (prefix `bondaddon:`); onPrice only reads them (pure).
import { msg, dn } from '../../../../../shared/i18n.js';
const C_VISI_PAID = 'bondaddon:visi:paid';
const C_VISI_DISC = 'bondaddon:visi:disc';
const C_MIRA_PAID = 'bondaddon:mira:paid';
@@ -50,10 +52,10 @@ function settleCoins(ctx, bondId, counterKey, label) {
const gain = (due - paid) * count;
if (prepEnded(ctx)) {
ctx.addPendingFunds(gain);
ctx.toast(`【${label}】层数达成,下回合开始时获得${gain}资金`, 'info');
ctx.toast(msg('【{label}】层数达成,下回合开始时获得{gain}资金', { label: dn(label), gain }), 'info');
} else {
ctx.addFunds(gain, `bond:${bondId}`);
ctx.toast(`【${label}】层数达成,获得${gain}资金`, 'info');
ctx.toast(msg('【{label}】层数达成,获得{gain}资金', { label: dn(label), gain }), 'info');
}
return gain;
}