Merge pull request #3682 from matrix-org/travis/fix-calltype-i18n
Improve translatable strings for callspull/21833/head
commit
25809c54a7
|
@ -358,13 +358,25 @@ function textForCallHangupEvent(event) {
|
||||||
function textForCallInviteEvent(event) {
|
function textForCallInviteEvent(event) {
|
||||||
const senderName = event.sender ? event.sender.name : _t('Someone');
|
const senderName = event.sender ? event.sender.name : _t('Someone');
|
||||||
// FIXME: Find a better way to determine this from the event?
|
// FIXME: Find a better way to determine this from the event?
|
||||||
let callType = "voice";
|
let isVoice = true;
|
||||||
if (event.getContent().offer && event.getContent().offer.sdp &&
|
if (event.getContent().offer && event.getContent().offer.sdp &&
|
||||||
event.getContent().offer.sdp.indexOf('m=video') !== -1) {
|
event.getContent().offer.sdp.indexOf('m=video') !== -1) {
|
||||||
callType = "video";
|
isVoice = false;
|
||||||
|
}
|
||||||
|
const isSupported = MatrixClientPeg.get().supportsVoip();
|
||||||
|
|
||||||
|
// This ladder could be reduced down to a couple string variables, however other languages
|
||||||
|
// can have a hard time translating those strings. In an effort to make translations easier
|
||||||
|
// and more accurate, we break out the string-based variables to a couple booleans.
|
||||||
|
if (isVoice && isSupported) {
|
||||||
|
return _t("%(senderName)s placed a voice call.", {senderName});
|
||||||
|
} else if (isVoice && !isSupported) {
|
||||||
|
return _t("%(senderName)s placed a voice call. (not supported by this browser)", {senderName});
|
||||||
|
} else if (!isVoice && isSupported) {
|
||||||
|
return _t("%(senderName)s placed a video call.", {senderName});
|
||||||
|
} else if (!isVoice && !isSupported) {
|
||||||
|
return _t("%(senderName)s placed a video call. (not supported by this browser)", {senderName});
|
||||||
}
|
}
|
||||||
const supported = MatrixClientPeg.get().supportsVoip() ? "" : _t('(not supported by this browser)');
|
|
||||||
return _t('%(senderName)s placed a %(callType)s call.', {senderName, callType}) + ' ' + supported;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function textForThreePidInviteEvent(event) {
|
function textForThreePidInviteEvent(event) {
|
||||||
|
|
|
@ -253,7 +253,10 @@
|
||||||
"(no answer)": "(no answer)",
|
"(no answer)": "(no answer)",
|
||||||
"(unknown failure: %(reason)s)": "(unknown failure: %(reason)s)",
|
"(unknown failure: %(reason)s)": "(unknown failure: %(reason)s)",
|
||||||
"%(senderName)s ended the call.": "%(senderName)s ended the call.",
|
"%(senderName)s ended the call.": "%(senderName)s ended the call.",
|
||||||
"%(senderName)s placed a %(callType)s call.": "%(senderName)s placed a %(callType)s call.",
|
"%(senderName)s placed a voice call.": "%(senderName)s placed a voice call.",
|
||||||
|
"%(senderName)s placed a voice call. (not supported by this browser)": "%(senderName)s placed a voice call. (not supported by this browser)",
|
||||||
|
"%(senderName)s placed a video call.": "%(senderName)s placed a video call.",
|
||||||
|
"%(senderName)s placed a video call. (not supported by this browser)": "%(senderName)s placed a video call. (not supported by this browser)",
|
||||||
"%(senderName)s revoked the invitation for %(targetDisplayName)s to join the room.": "%(senderName)s revoked the invitation for %(targetDisplayName)s to join the room.",
|
"%(senderName)s revoked the invitation for %(targetDisplayName)s to join the room.": "%(senderName)s revoked the invitation for %(targetDisplayName)s to join the room.",
|
||||||
"%(senderName)s sent an invitation to %(targetDisplayName)s to join the room.": "%(senderName)s sent an invitation to %(targetDisplayName)s to join the room.",
|
"%(senderName)s sent an invitation to %(targetDisplayName)s to join the room.": "%(senderName)s sent an invitation to %(targetDisplayName)s to join the room.",
|
||||||
"%(senderName)s made future room history visible to all room members, from the point they are invited.": "%(senderName)s made future room history visible to all room members, from the point they are invited.",
|
"%(senderName)s made future room history visible to all room members, from the point they are invited.": "%(senderName)s made future room history visible to all room members, from the point they are invited.",
|
||||||
|
|
Loading…
Reference in New Issue