Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
fix i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
owi92 committed Nov 25, 2022
1 parent ec9295a commit acfc4ba
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
14 changes: 9 additions & 5 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -706,14 +706,18 @@
"Not a valid %(brand)s keyfile": "Not a valid %(brand)s keyfile",
"Authentication check failed: incorrect password?": "Authentication check failed: incorrect password?",
"Unrecognised address": "Unrecognised address",
"This %(type)s is unfederated. You cannot invite people from external servers.": "This %(type)s is unfederated. You cannot invite people from external servers.",
"You do not have permission to invite people to this %(type)s.": "You do not have permission to invite people to this %(type)s.",
"User is already invited to the %(type)s": "User is already invited to the %(type)s",
"User is already in the %(type)s": "User is already in the %(type)s",
"You do not have permission to invite people to this space.": "You do not have permission to invite people to this space.",
"This room is unfederated. You cannot invite people from external servers.": "This room is unfederated. You cannot invite people from external servers.",
"You do not have permission to invite people to this room.": "You do not have permission to invite people to this room.",
"User is already invited to the space": "User is already invited to the space",
"User is already invited to the room": "User is already invited to the room",
"User is already in the space": "User is already in the space",
"User is already in the room": "User is already in the room",
"User does not exist": "User does not exist",
"User may or may not exist": "User may or may not exist",
"The user must be unbanned before they can be invited.": "The user must be unbanned before they can be invited.",
"The user's homeserver does not support the version of the %(type)s.": "The user's homeserver does not support the version of the %(type)s.",
"The user's homeserver does not support the version of the space.": "The user's homeserver does not support the version of the space.",
"The user's homeserver does not support the version of the room.": "The user's homeserver does not support the version of the room.",
"Unknown server error": "Unknown server error",
"Use a few words, avoid common phrases": "Use a few words, avoid common phrases",
"No need for symbols, digits, or uppercase letters": "No need for symbols, digits, or uppercase letters",
Expand Down
29 changes: 21 additions & 8 deletions src/utils/MultiInviter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,24 +217,33 @@ export default class MultiInviter {
const isFederated = room?.currentState.getStateEvents(EventType.RoomCreate, '')
?.getContent()['m.federate'];

const type = isSpace ? 'space' : 'room';
let errorText: string;
let fatal = false;
switch (err.errcode) {
case "M_FORBIDDEN":
if (isFederated === false) {
errorText = _t("This %(type)s is unfederated. " +
"You cannot invite people from external servers.", { type });
if (isSpace) {
errorText = _t('You do not have permission to invite people to this space.');
} else if (isFederated === false) {
errorText = _t("This room is unfederated. " +

This comment has been minimized.

Copy link
@t3chguy

t3chguy Nov 25, 2022

Member

Spaces can be unfederated too

This comment has been minimized.

Copy link
@owi92

owi92 Nov 25, 2022

Author Contributor

I couldn't find the option to create an unfederated space, but of couse that doesn't mean they don't exist. Thank you for clarifying.

"You cannot invite people from external servers.");
} else {
errorText = _t("You do not have permission to invite people to this %(type)s.", { type });
errorText = _t('You do not have permission to invite people to this room.');
}
fatal = true;
break;
case USER_ALREADY_INVITED:
errorText = _t("User is already invited to the %(type)s", { type });
if (isSpace) {
errorText = _t("User is already invited to the space");
} else {
errorText = _t("User is already invited to the room");
}
break;
case USER_ALREADY_JOINED:
errorText = _t("User is already in the %(type)s", { type });
if (isSpace) {
errorText = _t("User is already in the space");
} else {
errorText = _t("User is already in the room");
}
break;
case "M_LIMIT_EXCEEDED":
// we're being throttled so wait a bit & try again
Expand All @@ -261,7 +270,11 @@ export default class MultiInviter {
errorText = _t("The user must be unbanned before they can be invited.");
break;
case "M_UNSUPPORTED_ROOM_VERSION":
errorText = _t("The user's homeserver does not support the version of the %(type)s.", { type });
if (isSpace) {
errorText = _t("The user's homeserver does not support the version of the space.");
} else {
errorText = _t("The user's homeserver does not support the version of the room.");
}
break;
}

Expand Down

0 comments on commit acfc4ba

Please sign in to comment.