From 2bfad52b40a8dc64793c85cd2fe33b41f3cbb032 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Sat, 10 Jun 2017 14:35:11 +0100 Subject: [PATCH] Make unknown failures more helpful. --- src/TextForEvent.js | 8 ++++---- src/i18n/strings/en_EN.json | 2 +- src/i18n/strings/en_US.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/TextForEvent.js b/src/TextForEvent.js index 61e821d7cb..9521ac3a6a 100644 --- a/src/TextForEvent.js +++ b/src/TextForEvent.js @@ -145,15 +145,15 @@ function textForCallHangupEvent(event) { const eventContent = event.getContent(); let reason = ""; if(!MatrixClientPeg.get().supportsVoip()) { - reason = '(not supported by this browser)'; + reason = _t('(not supported by this browser)'); } else if(eventContent.reason) { if (eventContent.reason === "ice_failed") { - reason = "(call failed to connect)"; + reason = _t('(call failed to connect)'); } else { - reason = `(${eventContent.reason})`; + reason = _t('(unknown failure: %(reason)s)', {reason: eventContent.reason}); } } - return _t('%(senderName)s ended the call.', {senderName}) + ' ' + _t(reason); + return _t('%(senderName)s ended the call.', {senderName}) + ' ' + reason; } function textForCallInviteEvent(event) { diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index ed931c917f..93c5f2cf94 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -638,7 +638,7 @@ "VoIP conference started.": "VoIP conference started.", "VoIP is unsupported": "VoIP is unsupported", "(call failed to connect)": "(call failed to connect)", - "(unknown failure)": "(unknown failure)", + "(unknown failure: %(reason)s)": "(unknown failure: %(reason)s)", "(warning: cannot be disabled again!)": "(warning: cannot be disabled again!)", "Warning!": "Warning!", "WARNING: Device already verified, but keys do NOT MATCH!": "WARNING: Device already verified, but keys do NOT MATCH!", diff --git a/src/i18n/strings/en_US.json b/src/i18n/strings/en_US.json index b2da44c2a6..9038253a9b 100644 --- a/src/i18n/strings/en_US.json +++ b/src/i18n/strings/en_US.json @@ -577,7 +577,7 @@ "VoIP conference started.": "VoIP conference started.", "VoIP is unsupported": "VoIP is unsupported", "(call failed to connect)": "(call failed to connect)", - "(unknown failure)": "(unknown failure)", + "(unknown failure: %(reason)s)": "(unknown failure: %(reason)s)", "(warning: cannot be disabled again!)": "(warning: cannot be disabled again!)", "Warning!": "Warning!", "WARNING: Device already verified, but keys do NOT MATCH!": "WARNING: Device already verified, but keys do NOT MATCH!",