Skip to content

Commit 20eb2fc

Browse files
author
Citrine (rocky)
committed
Detailed log for a missing key in table
1 parent 8057543 commit 20eb2fc

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

scripts/entities/helpers.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,14 @@ export class SR5_EntityHelpers {
238238
}
239239
}
240240
arrayTerms.sort((a, b) => {
241-
return game.i18n.localize(SR5[table][a.key]).localeCompare(game.i18n.localize(SR5[table][b.key]));
241+
const labelA = SR5[table][a.key];
242+
const labelB = SR5[table][b.key];
243+
if (!labelA || !labelB) {
244+
if (!labelA) SR5_SystemHelpers.srLog(1, `Missing key '${a.key}' in translation table '${table}'`);
245+
if (!labelB) SR5_SystemHelpers.srLog(1, `Missing key '${b.key}' in translation table '${table}'`);
246+
return 0;
247+
}
248+
return game.i18n.localize(labelA).localeCompare(game.i18n.localize(labelB));
242249
});
243250
for (let loop = 0; loop < arrayTerms.length; ++loop) {
244251
newObject[arrayTerms[loop]["key"]] = arrayTerms[loop];

0 commit comments

Comments
 (0)