Provide more helpful errors when i18n generation fails

Also fix TextForEvent.js so it doesn't break the script. Using a variable here is not recognized, so the object has been moved inline instead.
This commit is contained in:
Travis Ralston 2018-09-27 11:55:57 -06:00
parent 1b4570ffa1
commit fb262596b2
2 changed files with 6 additions and 7 deletions

View file

@ -158,6 +158,7 @@ function getTranslationsJs(file) {
} catch (e) { } catch (e) {
console.log(); console.log();
console.error(`ERROR: ${file}:${node.loc.start.line} ${tKey}`); console.error(`ERROR: ${file}:${node.loc.start.line} ${tKey}`);
console.error(e);
process.exit(1); process.exit(1);
} }
} }

View file

@ -228,14 +228,12 @@ function textForRoomAliasesEvent(ev) {
removedAddresses: removedAliases.join(', '), removedAddresses: removedAliases.join(', '),
}); });
} else { } else {
const args = { return _t(
'%(senderName)s added %(addedAddresses)s and removed %(removedAddresses)s as addresses for this room.', {
senderName: senderName, senderName: senderName,
addedAddresses: addedAliases.join(', '), addedAddresses: addedAliases.join(', '),
removedAddresses: removedAliases.join(', '), removedAddresses: removedAliases.join(', '),
}; },
return _t(
'%(senderName)s added %(addedAddresses)s and removed %(removedAddresses)s as addresses for this room.',
args,
); );
} }
} }