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

Commit

Permalink
Update more strings to not wrongly mention room when it is/could be a…
Browse files Browse the repository at this point in the history
… space

Also fixed badly interpolated i18n
  • Loading branch information
t3chguy committed Mar 24, 2022
1 parent dfdbb6b commit feec1c3
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 67 deletions.
155 changes: 97 additions & 58 deletions src/components/views/rooms/RoomPreviewBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,17 +227,6 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
.getStateEvents(EventType.RoomJoinRules, "")?.getContent<IJoinRuleEventContent>().join_rule;
}

private roomName(atStart = false): string {
const name = this.props.room ? this.props.room.name : this.props.roomAlias;
if (name) {
return name;
} else if (atStart) {
return _t("This room");
} else {
return _t("this room");
}
}

private getMyMember(): RoomMember {
return this.props.room?.getMember(MatrixClientPeg.get().getUserId());
}
Expand Down Expand Up @@ -289,6 +278,8 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {

render() {
const brand = SdkConfig.get().brand;
const roomName = this.props.room?.name ?? this.props.roomAlias ?? "";
const isSpace = this.props.room?.isSpaceRoom() ?? this.props.oobData?.roomType === RoomType.Space;

let showSpinner = false;
let title;
Expand All @@ -304,7 +295,12 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
const messageCase = this.getMessageCase();
switch (messageCase) {
case MessageCase.Joining: {
title = this.props.oobData?.roomType === RoomType.Space ? _t("Joining space …") : _t("Joining room …");
if (this.props.oobData?.roomType || isSpace) {
title = isSpace ? _t("Joining space …") : _t("Joining room …");
} else {
title = _t("Joining …");
}

showSpinner = true;
break;
}
Expand All @@ -330,41 +326,60 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
footer = (
<div>
<Spinner w={20} h={20} />
{ _t("Loading room preview") }
{ _t("Loading preview") }
</div>
);
}
break;
}
case MessageCase.Kicked: {
const { memberName, reason } = this.getKickOrBanInfo();
title = _t("You were removed from %(roomName)s by %(memberName)s",
{ memberName, roomName: this.roomName() });
if (roomName) {
title = _t("You were removed from %(roomName)s by %(memberName)s",
{ memberName, roomName });
} else {
title = _t("You were removed from this room by %(memberName)s", { memberName });
}
subTitle = reason ? _t("Reason: %(reason)s", { reason }) : null;

if (this.joinRule() === "invite") {
primaryActionLabel = _t("Forget this room");
primaryActionHandler = this.props.onForgetClick;
if (isSpace) {
primaryActionLabel = _t("Forget this space");
} else {
primaryActionLabel = _t("Forget this room");
}
primaryActionHandler = this.props.onForgetClick;

if (this.joinRule() !== JoinRule.Invite) {
secondaryActionLabel = primaryActionLabel;
secondaryActionHandler = primaryActionHandler;

primaryActionLabel = _t("Re-join");
primaryActionHandler = this.props.onJoinClick;
secondaryActionLabel = _t("Forget this room");
secondaryActionHandler = this.props.onForgetClick;
}
break;
}
case MessageCase.Banned: {
const { memberName, reason } = this.getKickOrBanInfo();
title = _t("You were banned from %(roomName)s by %(memberName)s",
{ memberName, roomName: this.roomName() });
if (roomName) {
title = _t("You were banned from %(roomName)s by %(memberName)s", { memberName, roomName });
} else {
title = _t("You were banned from this room by %(memberName)s", { memberName });
}
subTitle = reason ? _t("Reason: %(reason)s", { reason }) : null;
primaryActionLabel = _t("Forget this room");
if (isSpace) {
primaryActionLabel = _t("Forget this space");
} else {
primaryActionLabel = _t("Forget this room");
}
primaryActionHandler = this.props.onForgetClick;
break;
}
case MessageCase.OtherThreePIDError: {
title = _t("Something went wrong with your invite to %(roomName)s",
{ roomName: this.roomName() });
if (roomName) {
title = _t("Something went wrong with your invite to %(roomName)s", { roomName });
} else {
title = _t("Something went wrong with your invite to this room.");
}
const joinRule = this.joinRule();
const errCodeMessage = _t(
"An error (%(errcode)s) was returned while trying to validate your " +
Expand Down Expand Up @@ -394,14 +409,22 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
break;
}
case MessageCase.InvitedEmailNotFoundInAccount: {
title = _t(
"This invite to %(roomName)s was sent to %(email)s which is not " +
"associated with your account",
{
roomName: this.roomName(),
email: this.props.invitedEmail,
},
);
if (roomName) {
title = _t(
"This invite to %(roomName)s was sent to %(email)s which is not " +
"associated with your account",
{
roomName,
email: this.props.invitedEmail,
},
);
} else {
title = _t(
"This invite was sent to %(email)s which is not associated with your account",
{ email: this.props.invitedEmail },
);
}

subTitle = _t(
"Link this email with your account in Settings to receive invites " +
"directly in %(brand)s.",
Expand All @@ -412,13 +435,18 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
break;
}
case MessageCase.InvitedEmailNoIdentityServer: {
title = _t(
"This invite to %(roomName)s was sent to %(email)s",
{
roomName: this.roomName(),
email: this.props.invitedEmail,
},
);
if (roomName) {
title = _t(
"This invite to %(roomName)s was sent to %(email)s",
{
roomName,
email: this.props.invitedEmail,
},
);
} else {
title = _t("This invite was sent to %(email)s", { email: this.props.invitedEmail });
}

subTitle = _t(
"Use an identity server in Settings to receive invites directly in %(brand)s.",
{ brand },
Expand All @@ -428,13 +456,18 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
break;
}
case MessageCase.InvitedEmailMismatch: {
title = _t(
"This invite to %(roomName)s was sent to %(email)s",
{
roomName: this.roomName(),
email: this.props.invitedEmail,
},
);
if (roomName) {
title = _t(
"This invite to %(roomName)s was sent to %(email)s",
{
roomName,
email: this.props.invitedEmail,
},
);
} else {
title = _t("This invite was sent to %(email)s", { email: this.props.invitedEmail });
}

subTitle = _t(
"Share this email in Settings to receive invites directly in %(brand)s.",
{ brand },
Expand All @@ -460,16 +493,14 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {

const isDM = this.isDMInvite();
if (isDM) {
title = _t("Do you want to chat with %(user)s?",
{ user: inviteMember.name });
title = _t("Do you want to chat with %(user)s?", { user: inviteMember.name });
subTitle = [
avatar,
_t("<userName/> wants to chat", {}, { userName: () => inviterElement }),
];
primaryActionLabel = _t("Start chatting");
} else {
title = _t("Do you want to join %(roomName)s?",
{ roomName: this.roomName() });
title = _t("Do you want to join %(roomName)s?", { roomName });
subTitle = [
avatar,
_t("<userName/> invited you", {}, { userName: () => inviterElement }),
Expand Down Expand Up @@ -502,23 +533,31 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
}
case MessageCase.ViewingRoom: {
if (this.props.canPreview) {
title = _t("You're previewing %(roomName)s. Want to join it?",
{ roomName: this.roomName() });
title = _t("You're previewing %(roomName)s. Want to join it?", { roomName });
} else if (roomName) {
title = _t("%(roomName)s can't be previewed. Do you want to join it?", { roomName });
} else {
title = _t("%(roomName)s can't be previewed. Do you want to join it?",
{ roomName: this.roomName(true) });
title = _t("There's no preview, would you like to join?");
}
primaryActionLabel = _t("Join the discussion");
primaryActionHandler = this.props.onJoinClick;
break;
}
case MessageCase.RoomNotFound: {
title = _t("%(roomName)s does not exist.", { roomName: this.roomName(true) });
subTitle = _t("This room doesn't exist. Are you sure you're at the right place?");
if (roomName) {
title = _t("%(roomName)s does not exist.", { roomName });
} else {
title = _t("This room does not exist.");
}
subTitle = _t("Are you sure you're at the right place?");
break;
}
case MessageCase.OtherError: {
title = _t("%(roomName)s is not accessible at this time.", { roomName: this.roomName(true) });
if (roomName) {
title = _t("%(roomName)s is not accessible at this time.", { roomName });
} else {
title = _t("This room is not accessible at this time.");
}
subTitle = [
_t("Try again later, or ask a room admin to check if you have access."),
_t(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export default class AdvancedRoomSettingsTab extends React.Component<IProps, ISt
render() {
const client = MatrixClientPeg.get();
const room = client.getRoom(this.props.roomId);
const isSpace = room.isSpaceRoom();

let unfederatableSection;
const createEvent = room.currentState.getStateEvents(EventType.RoomCreate, '');
Expand All @@ -122,20 +123,26 @@ export default class AdvancedRoomSettingsTab extends React.Component<IProps, ISt
) }
</p>
<AccessibleButton onClick={this.upgradeRoom} kind='primary'>
{ _t("Upgrade this room to the recommended room version") }
{ isSpace
? _t("Upgrade this space to the recommended room version")
: _t("Upgrade this room to the recommended room version") }
</AccessibleButton>
</div>
);
}

let oldRoomLink;
if (this.state.oldRoomId) {
let name = _t("this room");
const room = MatrixClientPeg.get().getRoom(this.props.roomId);
if (room && room.name) name = room.name;
let copy: string;
if (isSpace) {
copy = _t("View older version of %(spaceName)s.", { spaceName: room.name });
} else {
copy = _t("View older messages in %(roomName)s.", { roomName: room.name });
}

oldRoomLink = (
<AccessibleButton element='a' onClick={this.onOldRoomClicked}>
{ _t("View older messages in %(roomName)s.", { roomName: name }) }
{ copy }
</AccessibleButton>
);
}
Expand Down
18 changes: 14 additions & 4 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1520,8 +1520,9 @@
"Voice & Video": "Voice & Video",
"This room is not accessible by remote Matrix servers": "This room is not accessible by remote Matrix servers",
"<b>Warning</b>: Upgrading a room will <i>not automatically migrate room members to the new version of the room.</i> We'll post a link to the new room in the old version of the room - room members will have to click this link to join the new room.": "<b>Warning</b>: Upgrading a room will <i>not automatically migrate room members to the new version of the room.</i> We'll post a link to the new room in the old version of the room - room members will have to click this link to join the new room.",
"Upgrade this space to the recommended room version": "Upgrade this space to the recommended room version",
"Upgrade this room to the recommended room version": "Upgrade this room to the recommended room version",
"this room": "this room",
"View older version of %(spaceName)s.": "View older version of %(spaceName)s.",
"View older messages in %(roomName)s.": "View older messages in %(roomName)s.",
"Space information": "Space information",
"Internal room ID": "Internal room ID",
Expand Down Expand Up @@ -1781,29 +1782,35 @@
"Currently removing messages in %(count)s rooms|one": "Currently removing messages in %(count)s room",
"%(spaceName)s menu": "%(spaceName)s menu",
"Home options": "Home options",
"This room": "This room",
"Joining space …": "Joining space …",
"Joining room …": "Joining room …",
"Joining …": "Joining …",
"Loading …": "Loading …",
"Rejecting invite …": "Rejecting invite …",
"Join the conversation with an account": "Join the conversation with an account",
"Sign Up": "Sign Up",
"Loading room preview": "Loading room preview",
"Loading preview": "Loading preview",
"You were removed from %(roomName)s by %(memberName)s": "You were removed from %(roomName)s by %(memberName)s",
"You were removed from this room by %(memberName)s": "You were removed from this room by %(memberName)s",
"Reason: %(reason)s": "Reason: %(reason)s",
"Forget this space": "Forget this space",
"Forget this room": "Forget this room",
"Re-join": "Re-join",
"You were banned from %(roomName)s by %(memberName)s": "You were banned from %(roomName)s by %(memberName)s",
"You were banned from this room by %(memberName)s": "You were banned from this room by %(memberName)s",
"Something went wrong with your invite to %(roomName)s": "Something went wrong with your invite to %(roomName)s",
"Something went wrong with your invite to this room.": "Something went wrong with your invite to this room.",
"An error (%(errcode)s) was returned while trying to validate your invite. You could try to pass this information on to a room admin.": "An error (%(errcode)s) was returned while trying to validate your invite. You could try to pass this information on to a room admin.",
"unknown error code": "unknown error code",
"You can only join it with a working invite.": "You can only join it with a working invite.",
"Try to join anyway": "Try to join anyway",
"You can still join it because this is a public room.": "You can still join it because this is a public room.",
"Join the discussion": "Join the discussion",
"This invite to %(roomName)s was sent to %(email)s which is not associated with your account": "This invite to %(roomName)s was sent to %(email)s which is not associated with your account",
"This invite was sent to %(email)s which is not associated with your account": "This invite was sent to %(email)s which is not associated with your account",
"Link this email with your account in Settings to receive invites directly in %(brand)s.": "Link this email with your account in Settings to receive invites directly in %(brand)s.",
"This invite to %(roomName)s was sent to %(email)s": "This invite to %(roomName)s was sent to %(email)s",
"This invite was sent to %(email)s": "This invite was sent to %(email)s",
"Use an identity server in Settings to receive invites directly in %(brand)s.": "Use an identity server in Settings to receive invites directly in %(brand)s.",
"Share this email in Settings to receive invites directly in %(brand)s.": "Share this email in Settings to receive invites directly in %(brand)s.",
"Do you want to chat with %(user)s?": "Do you want to chat with %(user)s?",
Expand All @@ -1815,9 +1822,12 @@
"Reject & Ignore user": "Reject & Ignore user",
"You're previewing %(roomName)s. Want to join it?": "You're previewing %(roomName)s. Want to join it?",
"%(roomName)s can't be previewed. Do you want to join it?": "%(roomName)s can't be previewed. Do you want to join it?",
"There's no preview, would you like to join?": "There's no preview, would you like to join?",
"%(roomName)s does not exist.": "%(roomName)s does not exist.",
"This room doesn't exist. Are you sure you're at the right place?": "This room doesn't exist. Are you sure you're at the right place?",
"This room does not exist.": "This room does not exist.",
"Are you sure you're at the right place?": "Are you sure you're at the right place?",
"%(roomName)s is not accessible at this time.": "%(roomName)s is not accessible at this time.",
"This room is not accessible at this time.": "This room is not accessible at this time.",
"Try again later, or ask a room admin to check if you have access.": "Try again later, or ask a room admin to check if you have access.",
"%(errcode)s was returned while trying to access the room. If you think you're seeing this message in error, please <issueLink>submit a bug report</issueLink>.": "%(errcode)s was returned while trying to access the room. If you think you're seeing this message in error, please <issueLink>submit a bug report</issueLink>.",
"Appearance": "Appearance",
Expand Down

0 comments on commit feec1c3

Please sign in to comment.