feedback5 W5S: i18n phase 2, render labels — the battlefield canvas label, the 2D fallback field (bench label, piece names, empty enemy pen), the facing wheel (prompt, cancel hints, the four directions) through t(); English for the 3 new msgids; Chinese output unchanged (zh render proof)

This commit is contained in:
sganggs committed 2026-10-06 18:14:08 +08:00
1 parent 5741dc129b
commit 7e262dc809
5 files changed
+20 -13

No files matched your search

+6 -5
View File
@@ -24,6 +24,7 @@ import { html, TierChip } from './components.js';
import { GEO } from '../../../shared/constants.js';
import { chessAvatarUrl, itemIconUrl, tokenAvatarUrl, enemyIconUrl } from './assetUrls.js';
import { tileKey, hasFlag, UF, penPlacement, PEN, fieldTile, ownStandIn, ownDiyRecord } from './gameLogic.js';
import { t } from '../../../shared/i18n.js';
const DRAG_PX = 6;
const DMG_TTL = 900;
@@ -137,10 +138,10 @@ export function createFallbackView(host, opts = {}) {
return chess ? ownDiyRecord(chess, st.priv, { chess: dataStore?.get?.('chess') ?? null, backups: dataStore?.get?.('backups') ?? null }) : null;
}
function pieceName(p) {
if (p.kind === 'item') return lookup('items', p.id)?.name || '道具';
if (p.kind === 'token') return lookup('tokens', p.id)?.name || '召唤物';
if (p.kind === 'item') return lookup('items', p.id)?.name || t('道具');
if (p.kind === 'token') return lookup('tokens', p.id)?.name || t('召唤物');
const chess = lookup('chess', p.id);
return (ownSi(chess) || ownDiy(chess) || chess)?.name || '干员';
return (ownSi(chess) || ownDiy(chess) || chess)?.name || t('干员');
}
function Piece({ p, x, y, L, area }) {
@@ -303,7 +304,7 @@ export function createFallbackView(host, opts = {}) {
});
return html`<div class="ff-board ff-board--pen" style=${`left:${left}px;top:${top}px;width:${bw}px;height:${tile * rows}px;--tile:${tile}px`}>
${cells}${figs}
${models.length ? null : html`<p class="ff-pen__empty">暂无敌方情报</p>`}
${models.length ? null : html`<p class="ff-pen__empty">${t('暂无敌方情报')}</p>`}
</div>`;
}
@@ -372,7 +373,7 @@ export function createFallbackView(host, opts = {}) {
})() : null;
if (st.camera === 'pen') { render(html`${penView()}<div class="ff-badge">SIMPLIFIED VIEW</div>`, root); return; }
render(html`<div class=${cx('ff-board', `ff-board--${st.mode}`, `ff-cam--${st.camera}`)} style=${`left:${L.left}px;top:${L.top}px;width:${L.bw}px;height:${L.bh}px;--tile:${L.tile}px`}>
${st.mode === 'prep' ? html`<div class="ff-hand-label" style=${`top:${(L.rows + 0.18) * L.tile}px`}><span>整备区</span><i></i></div>` : null}
${st.mode === 'prep' ? html`<div class="ff-hand-label" style=${`top:${(L.rows + 0.18) * L.tile}px`}><span>${t('整备区')}</span><i></i></div>` : null}
${tiles}${hand}${units}${pieces}${floats}
</div>${ghost}
<div class="ff-badge">SIMPLIFIED VIEW</div>`, root);