From fb262596b2814da4bb968f7165a9ce78a092be4d Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 27 Sep 2018 11:55:57 -0600 Subject: [PATCH] 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. --- scripts/gen-i18n.js | 1 + src/TextForEvent.js | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/gen-i18n.js b/scripts/gen-i18n.js index c35cd3466a..a1a2e6f7c5 100755 --- a/scripts/gen-i18n.js +++ b/scripts/gen-i18n.js @@ -158,6 +158,7 @@ function getTranslationsJs(file) { } catch (e) { console.log(); console.error(`ERROR: ${file}:${node.loc.start.line} ${tKey}`); + console.error(e); process.exit(1); } } diff --git a/src/TextForEvent.js b/src/TextForEvent.js index 2b19216a52..bb555d2aa6 100644 --- a/src/TextForEvent.js +++ b/src/TextForEvent.js @@ -228,14 +228,12 @@ function textForRoomAliasesEvent(ev) { removedAddresses: removedAliases.join(', '), }); } else { - const args = { - senderName: senderName, - addedAddresses: addedAliases.join(', '), - removedAddresses: removedAliases.join(', '), - }; return _t( - '%(senderName)s added %(addedAddresses)s and removed %(removedAddresses)s as addresses for this room.', - args, + '%(senderName)s added %(addedAddresses)s and removed %(removedAddresses)s as addresses for this room.', { + senderName: senderName, + addedAddresses: addedAliases.join(', '), + removedAddresses: removedAliases.join(', '), + }, ); } }