feedback5 W5S: i18n phase 2, match texts the server sends — a 机变 card's and an effect entry's name and description, the draft's name, a reward offer's label and the result title are shown from the localized data when the server's Chinese text is the data record's own (data.lookupRaw + ui/lang.js sentText; names through tName), a text the server reworded (a multi-round 悬赏) stays as sent; Chinese output unchanged by construction (in Chinese the localized record is the raw one); test/i18n-server.test.js covers it

This commit is contained in:
sganggs committed 2026-10-06 18:27:13 +08:00
1 parent 7697b4ff40
commit 0025ceac16
7 files changed
+111 -15

No files matched your search

+5 -2
View File
@@ -23,6 +23,7 @@ import { data } from '../data.js';
import { enemyIconUrl, titleIconUrl, uiUrl } from '../ui/assetUrls.js';
import { store, useStore, emptyMatch } from '../store.js';
import { audio } from '../audio.js';
import { sentText } from '../ui/lang.js';
import { t, tParts, N_ } from '../../../shared/i18n.js';
const cx = (...p) => p.flat().filter(Boolean).join(' ');
@@ -49,8 +50,10 @@ export function LineupThumb({ u, gd }) {
function PlayerCard({ p, myId, titles, best, solo = false }) {
const gd = useGameData();
const titleRec = p.title ? titles.find((t) => t.id === p.title.id) || null : null;
const titleName = p.title?.name || titleRec?.name || null;
const titleRec = p.title ? titles.find((x) => x.id === p.title.id) || null : null;
// (the server sends the title's Chinese name: the localized config.titles record when it is that record's)
const rawTitle = p.title ? (data.getRaw('config')?.titles || []).find((x) => x && x.id === p.title.id) || null : null;
const titleName = sentText(p.title?.name, rawTitle?.name, titleRec?.name) || titleRec?.name || null;
const stats = STAT_ROWS.filter(([k]) => Number.isFinite(p.stats[k])).slice(0, 7);
const band = p.bandId ? gd.band(p.bandId) : null;
const lineup = p.lineup.slice(0, 10);