Migrate more strings to translation keys (#11651)

This commit is contained in:
Michael Telatynski 2023-09-22 16:39:40 +01:00 committed by GitHub
parent 560449676b
commit f4d056fd38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
127 changed files with 8916 additions and 8272 deletions

View file

@ -393,15 +393,12 @@ export const Commands = [
const defaultIdentityServerUrl = getDefaultIdentityServerUrl();
if (defaultIdentityServerUrl) {
const { finished } = Modal.createDialog(QuestionDialog, {
title: _t("Use an identity server"),
title: _t("slash_command|invite_3pid_use_default_is_title"),
description: (
<p>
{_t(
"Use an identity server to invite by email. Click continue to use the default identity server (%(defaultIdentityServerName)s) or manage in Settings.",
{
defaultIdentityServerName: abbreviateUrl(defaultIdentityServerUrl),
},
)}
{_t("slash_command|invite_3pid_use_default_is_title_description", {
defaultIdentityServerName: abbreviateUrl(defaultIdentityServerUrl),
})}
</p>
),
button: _t("action|continue"),
@ -412,14 +409,10 @@ export const Commands = [
setToDefaultIdentityServer(cli);
return;
}
throw new UserFriendlyError(
"Use an identity server to invite by email. Manage in Settings.",
);
throw new UserFriendlyError("slash_command|invite_3pid_needs_is_error");
});
} else {
return reject(
new UserFriendlyError("Use an identity server to invite by email. Manage in Settings."),
);
return reject(new UserFriendlyError("slash_command|invite_3pid_needs_is_error"));
}
}
const inviter = new MultiInviter(cli, roomId);
@ -434,10 +427,11 @@ export const Commands = [
if (errorStringFromInviterUtility) {
throw new Error(errorStringFromInviterUtility);
} else {
throw new UserFriendlyError(
"User (%(user)s) did not end up as invited to %(roomId)s but no error was given from the inviter utility",
{ user: address, roomId, cause: undefined },
);
throw new UserFriendlyError("slash_command|invite_failed", {
user: address,
roomId,
cause: undefined,
});
}
}
}),
@ -476,7 +470,7 @@ export const Commands = [
})?.roomId;
if (!targetRoomId) {
return reject(
new UserFriendlyError("Unrecognised room address: %(roomAlias)s", {
new UserFriendlyError("slash_command|part_unknown_alias", {
roomAlias,
cause: undefined,
}),
@ -558,10 +552,10 @@ export const Commands = [
return success(
cli.setIgnoredUsers(ignoredUsers).then(() => {
Modal.createDialog(InfoDialog, {
title: _t("Ignored user"),
title: _t("slash_command|ignore_dialog_title"),
description: (
<div>
<p>{_t("You are now ignoring %(userId)s", { userId })}</p>
<p>{_t("slash_command|ignore_dialog_description", { userId })}</p>
</div>
),
});
@ -588,10 +582,10 @@ export const Commands = [
return success(
cli.setIgnoredUsers(ignoredUsers).then(() => {
Modal.createDialog(InfoDialog, {
title: _t("Unignored user"),
title: _t("slash_command|unignore_dialog_title"),
description: (
<div>
<p>{_t("You are no longer ignoring %(userId)s", { userId })}</p>
<p>{_t("slash_command|unignore_dialog_description", { userId })}</p>
</div>
),
});
@ -674,7 +668,7 @@ export const Commands = [
new Command({
command: "verify",
args: "<user-id> <device-id> <device-signing-key>",
description: _td("Verifies a user, session, and pubkey tuple"),
description: _td("slash_command|verify"),
runFn: function (cli, roomId, threadId, args) {
if (args) {
const matches = args.match(/^(\S+) +(\S+) +(\S+)$/);
@ -687,54 +681,41 @@ export const Commands = [
(async (): Promise<void> => {
const device = await getDeviceCryptoInfo(cli, userId, deviceId);
if (!device) {
throw new UserFriendlyError(
"Unknown (user, session) pair: (%(userId)s, %(deviceId)s)",
{
userId,
deviceId,
cause: undefined,
},
);
throw new UserFriendlyError("slash_command|verify_unknown_pair", {
userId,
deviceId,
cause: undefined,
});
}
const deviceTrust = await cli.getCrypto()?.getDeviceVerificationStatus(userId, deviceId);
if (deviceTrust?.isVerified()) {
if (device.getFingerprint() === fingerprint) {
throw new UserFriendlyError("Session already verified!");
throw new UserFriendlyError("slash_command|verify_nop");
} else {
throw new UserFriendlyError(
"WARNING: session already verified, but keys do NOT MATCH!",
);
throw new UserFriendlyError("slash_command|verify_nop_warning_mismatch");
}
}
if (device.getFingerprint() !== fingerprint) {
const fprint = device.getFingerprint();
throw new UserFriendlyError(
'WARNING: KEY VERIFICATION FAILED! The signing key for %(userId)s and session %(deviceId)s is "%(fprint)s" which does not match the provided key "%(fingerprint)s". This could mean your communications are being intercepted!',
{
fprint,
userId,
deviceId,
fingerprint,
cause: undefined,
},
);
throw new UserFriendlyError("slash_command|verify_mismatch", {
fprint,
userId,
deviceId,
fingerprint,
cause: undefined,
});
}
await cli.setDeviceVerified(userId, deviceId, true);
// Tell the user we verified everything
Modal.createDialog(InfoDialog, {
title: _t("Verified key"),
title: _t("slash_command|verify_success_title"),
description: (
<div>
<p>
{_t(
"The signing key you provided matches the signing key you received from %(userId)s's session %(deviceId)s. Session marked as verified.",
{ userId, deviceId },
)}
</p>
<p>{_t("slash_command|verify_success_description", { userId, deviceId })}</p>
</div>
),
});