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
@@ -305,6 +305,17 @@ export function createDataStore(opts = {}) {
|
||||
if (id == null) return null;
|
||||
return index(name)?.get(String(id)) ?? null;
|
||||
},
|
||||
/**
|
||||
* Record by id from a loaded file exactly as downloaded (its Chinese texts), whatever the locale — what the server
|
||||
* copied into a message, to compare with what it sent (ui/lang.js sentText).
|
||||
*/
|
||||
lookupRaw(name, id) {
|
||||
if (id == null) return null;
|
||||
const e = entries.get(name);
|
||||
if (!e || e.status !== 'ready') return null;
|
||||
if (!e.index) e.index = buildIndex(name, e.value);
|
||||
return e.index.get(String(id)) ?? null;
|
||||
},
|
||||
/** All records of a loaded file as an array (empty when not loaded). */
|
||||
list: (name) => [...(index(name)?.values() ?? [])],
|
||||
/** Drop a cached file and refetch it now (subscribers are notified when it settles). */
|
||||
|
||||
Reference in new issue
Block a user