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:
1 parent
7697b4ff40
commit
0025ceac16
7 files changed
+111
-15
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
import { GEO } from '../../../../shared/constants.js';
|
||||
import { isObj } from './shared.js';
|
||||
import { t } from '../../../../shared/i18n.js';
|
||||
import { t, tName } from '../../../../shared/i18n.js';
|
||||
|
||||
|
||||
// ---- shop ---------------------------------------------------------------------------------------------
|
||||
@@ -119,7 +119,8 @@ export function completesMerge(priv, slot, { getChess = () => null, getItem = ()
|
||||
export function offerHeader(offer) {
|
||||
const slots = isObj(offer) && Array.isArray(offer.slots) ? offer.slots : [];
|
||||
const items = slots.some((s) => isObj(s) && s.kind === 'item');
|
||||
const label = isObj(offer) && typeof offer.label === 'string' && offer.label ? offer.label : null;
|
||||
// (the server names the offer by its source in Chinese: a strategy's effect, an item, an operator — a data name)
|
||||
const label = isObj(offer) && typeof offer.label === 'string' && offer.label ? tName(offer.label) : null;
|
||||
const queued = isObj(offer) && Number.isInteger(offer.queued) && offer.queued > 0 ? offer.queued : 0;
|
||||
const tail = { queued, more: queued ? t('之后还有 {queued} 项', { queued }) : null };
|
||||
if (!items && (!isObj(offer) || offer.source === 'merge' || offer.source == null) && !label) {
|
||||
|
||||
Reference in new issue
Block a user