Add translations for slash command failures

This commit is contained in:
Kegan Dougal 2017-06-01 15:44:56 +01:00
parent f75e714c3a
commit 547f10bcbb
4 changed files with 29 additions and 14 deletions

View file

@ -186,7 +186,7 @@ const commands = {
if (targetRoomId) { break; }
}
if (!targetRoomId) {
return reject("Unrecognised room alias: " + roomAlias);
return reject(_t("Unrecognised room alias:") + ' ' + roomAlias);
}
}
}
@ -303,14 +303,14 @@ const commands = {
const device = MatrixClientPeg.get().getStoredDevice(userId, deviceId);
if (!device) {
return reject(`Unknown (user, device) pair: (${userId}, ${deviceId})`);
return reject(_t(`Unknown (user, device) pair:`) + ` (${userId}, ${deviceId})`);
}
if (device.isVerified()) {
if (device.getFingerprint() === fingerprint) {
return reject(`Device already verified!`);
return reject(_t(`Device already verified!`));
} else {
return reject(`WARNING: Device already verified, but keys do NOT MATCH!`);
return reject(_t(`WARNING: Device already verified, but keys do NOT MATCH!`));
}
}
@ -322,12 +322,15 @@ const commands = {
// Tell the user we verified everything!
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
Modal.createDialog(QuestionDialog, {
title: "Verified key",
title: _t("Verified key"),
description: (
<div>
<p>
The signing key you provided matches the signing key you received
from { userId }'s device { deviceId }. Device marked as verified.
{
_t("The signing key you provided matches the signing key you received " +
"from %(userId)s's device %(deviceId)s. Device marked as verified.",
{userId: userId, deviceId: deviceId})
}
</p>
</div>
),
@ -336,9 +339,13 @@ const commands = {
return success();
} else {
return reject(`WARNING: KEY VERIFICATION FAILED! The signing key for ${userId} and device
${deviceId} is "${device.getFingerprint()}" which does not match the provided key
"${fingerprint}". This could mean your communications are being intercepted!`);
const fprint = device.getFingerprint();
return reject(
_t('WARNING: KEY VERIFICATION FAILED! The signing key for %(userId)s and device' +
' %(deviceId)s is "%(fprint)s" which does not match the provided key' +
' "%(fingerprint)s". This could mean your communications are being intercepted!',
{deviceId: deviceId, fprint: fprint, userId: userId, fingerprint: fingerprint})
);
}
}
}
@ -383,7 +390,7 @@ module.exports = {
if (commands[cmd]) {
return commands[cmd].run(roomId, args);
} else {
return reject("Unrecognised command: " + input);
return reject(_t("Unrecognised command:") + ' ' + input);
}
}
return null; // not a command

View file

@ -506,7 +506,7 @@ export default class MessageComposerInput extends React.Component {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: _t("Server error"),
description: ((err && err.message) ? err.message : _t("Server unavailable, overloaded, or something else went wrong") + "."),
description: ((err && err.message) ? err.message : _t("Server unavailable, overloaded, or something else went wrong.")),
});
});
}

View file

@ -316,7 +316,7 @@ export default React.createClass({
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: _t("Server error"),
description: ((err && err.message) ? err.message : _t("Server unavailable, overloaded, or something else went wrong") + "."),
description: ((err && err.message) ? err.message : _t("Server unavailable, overloaded, or something else went wrong.")),
});
});
}

View file

@ -215,6 +215,7 @@
"demote": "demote",
"Deops user with given id": "Deops user with given id",
"Default": "Default",
"Device already verified!": "Device already verified!",
"Device ID": "Device ID",
"Devices": "Devices",
"Devices will not yet be able to decrypt history from before they joined the room": "Devices will not yet be able to decrypt history from before they joined the room",
@ -436,7 +437,7 @@
"Server may be unavailable, overloaded, or search timed out :(": "Server may be unavailable, overloaded, or search timed out :(",
"Server may be unavailable, overloaded, or the file too big": "Server may be unavailable, overloaded, or the file too big",
"Server may be unavailable, overloaded, or you hit a bug.": "Server may be unavailable, overloaded, or you hit a bug.",
"Server unavailable, overloaded, or something else went wrong": "Server unavailable, overloaded, or something else went wrong",
"Server unavailable, overloaded, or something else went wrong.": "Server unavailable, overloaded, or something else went wrong.",
"Session ID": "Session ID",
"%(senderName)s set a profile picture.": "%(senderName)s set a profile picture.",
"%(senderName)s set their display name to %(displayName)s.": "%(senderName)s set their display name to %(displayName)s.",
@ -460,6 +461,7 @@
"tag direct chat": "tag direct chat",
"The default role for new room members is": "The default role for new room members is",
"The main address for this room is": "The main address for this room is",
"The signing key you provided matches the signing key you received from %(userId)s's device %(deviceId)s. Device marked as verified.": "The signing key you provided matches the signing key you received from %(userId)s's device %(deviceId)s. Device marked as verified.",
"This action cannot be performed by a guest user. Please register to be able to do this": "This action cannot be performed by a guest user. Please register to be able to do this",
"This email address is already in use": "This email address is already in use",
"This email address was not found": "This email address was not found",
@ -521,8 +523,11 @@
"unknown device": "unknown device",
"unknown error code": "unknown error code",
"Unknown room %(roomId)s": "Unknown room %(roomId)s",
"Unknown (user, device) pair:": "Unknown (user, device) pair:",
"unknown": "unknown",
"Unmute": "Unmute",
"Unrecognised command:": "Unrecognised command:",
"Unrecognised room alias:": "Unrecognised room alias:",
"uploaded a file": "uploaded a file",
"Upload avatar": "Upload avatar",
"Upload Failed": "Upload Failed",
@ -538,6 +543,7 @@
"Verification Pending": "Verification Pending",
"Verification": "Verification",
"verified": "verified",
"Verified key": "Verified key",
"Video call": "Video call",
"Voice call": "Voice call",
"VoIP conference finished.": "VoIP conference finished.",
@ -545,6 +551,8 @@
"VoIP is unsupported": "VoIP is unsupported",
"(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!",
"WARNING: KEY VERIFICATION FAILED! The signing key for %(userId)s and device %(deviceId)s is \"%(fprint)s\" which does not match the provided key \"%(fingerprint)s\". This could mean your communications are being intercepted!": "WARNING: KEY VERIFICATION FAILED! The signing key for %(userId)s and device %(deviceId)s is \"%(fprint)s\" which does not match the provided key \"%(fingerprint)s\". This could mean your communications are being intercepted!",
"Who can access this room?": "Who can access this room?",
"Who can read history?": "Who can read history?",
"Who would you like to add to this room?": "Who would you like to add to this room?",