Migrate more strings to translation keys (#11680)

This commit is contained in:
Michael Telatynski 2023-09-29 08:49:26 +01:00 committed by GitHub
parent 8014cebb20
commit 6af4335db1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
101 changed files with 6739 additions and 5973 deletions

View file

@ -51,15 +51,15 @@ const EncryptionInfo: React.FC<IProps> = ({
}: IProps) => {
let content: JSX.Element;
if (waitingForOtherParty && isSelfVerification) {
content = <div>{_t("To proceed, please accept the verification request on your other device.")}</div>;
content = <div>{_t("encryption|verification|self_verification_hint")}</div>;
} else if (waitingForOtherParty || waitingForNetwork) {
let text: string;
if (waitingForOtherParty) {
text = _t("Waiting for %(displayName)s to accept…", {
text = _t("encryption|verification|waiting_for_user_accept", {
displayName: (member as User).displayName || (member as RoomMember).name || member.userId,
});
} else {
text = _t("Accepting…");
text = _t("encryption|verification|accepting");
}
content = <PendingActionSpinner text={text} />;
} else {
@ -69,7 +69,7 @@ const EncryptionInfo: React.FC<IProps> = ({
className="mx_UserInfo_wideButton mx_UserInfo_startVerification"
onClick={onStartVerification}
>
{_t("Start Verification")}
{_t("encryption|verification|start_button")}
</AccessibleButton>
);
}
@ -78,23 +78,15 @@ const EncryptionInfo: React.FC<IProps> = ({
if (isRoomEncrypted) {
description = (
<div>
<p>{_t("Messages in this room are end-to-end encrypted.")}</p>
<p>
{_t(
"Your messages are secured and only you and the recipient have the unique keys to unlock them.",
)}
</p>
<p>{_t("user_info|room_encrypted")}</p>
<p>{_t("user_info|room_encrypted_detail")}</p>
</div>
);
} else {
description = (
<div>
<p>{_t("Messages in this room are not end-to-end encrypted.")}</p>
<p>
{_t(
"In encrypted rooms, your messages are secured and only you and the recipient have the unique keys to unlock them.",
)}
</p>
<p>{_t("user_info|room_unencrypted")}</p>
<p>{_t("user_info|room_unencrypted_detail")}</p>
</div>
);
}
@ -110,13 +102,9 @@ const EncryptionInfo: React.FC<IProps> = ({
{description}
</div>
<div className="mx_UserInfo_container">
<h3>{_t("Verify User")}</h3>
<h3>{_t("user_info|verify_button")}</h3>
<div>
<p>
{_t(
"For extra security, verify this user by checking a one-time code on both of your devices.",
)}
</p>
<p>{_t("user_info|verify_explainer")}</p>
<p>{_t("encryption|verification|in_person")}</p>
{content}
</div>

View file

@ -78,15 +78,15 @@ const EncryptionPanel: React.FC<IProps> = (props: IProps) => {
) {
Modal.createDialog(ErrorDialog, {
headerImage: require("../../../../res/img/e2e/warning-deprecated.svg").default,
title: _t("Your messages are not secure"),
title: _t("encryption|messages_not_secure|title"),
description: (
<div>
{_t("One of the following may be compromised:")}
{_t("encryption|messages_not_secure|heading")}
<ul>
<li>{_t("Your homeserver")}</li>
<li>{_t("The homeserver the user you're verifying is connected to")}</li>
<li>{_t("Yours, or the other users' internet connection")}</li>
<li>{_t("Yours, or the other users' session")}</li>
<li>{_t("encryption|messages_not_secure|cause_1")}</li>
<li>{_t("encryption|messages_not_secure|cause_2")}</li>
<li>{_t("encryption|messages_not_secure|cause_3")}</li>
<li>{_t("encryption|messages_not_secure|cause_4")}</li>
</ul>
</div>
),
@ -117,8 +117,8 @@ const EncryptionPanel: React.FC<IProps> = (props: IProps) => {
Modal.createDialog(ErrorDialog, {
headerImage: require("../../../../res/img/e2e/warning.svg").default,
title: _t("Error starting verification"),
description: _t("We were unable to start a chat with the other user."),
title: _t("encryption|verification|error_starting_title"),
description: _t("encryption|verification|error_starting_description"),
});
return;
}

View file

@ -94,7 +94,7 @@ const PinnedMessagesHeaderButton: React.FC<IHeaderButtonProps> = ({ room, isHigh
return (
<HeaderButton
name="pinnedMessagesButton"
title={_t("Pinned messages")}
title={_t("right_panel|pinned_messages|title")}
isHighlighted={isHighlighted}
isUnread={!!unreadIndicator}
onClick={onClick}
@ -114,7 +114,12 @@ const TimelineCardHeaderButton: React.FC<IHeaderButtonProps> = ({ room, isHighli
unreadIndicator = <UnreadIndicator color={color} />;
}
return (
<HeaderButton name="timelineCardButton" title={_t("Chat")} isHighlighted={isHighlighted} onClick={onClick}>
<HeaderButton
name="timelineCardButton"
title={_t("right_panel|video_room_chat|title")}
isHighlighted={isHighlighted}
onClick={onClick}
>
{unreadIndicator}
</HeaderButton>
);
@ -304,7 +309,7 @@ export default class LegacyRoomHeaderButtons extends HeaderButtons<IProps> {
<HeaderButton
key="roomSummaryButton"
name="roomSummaryButton"
title={_t("Room info")}
title={_t("right_panel|room_summary_card|title")}
isHighlighted={this.isPhase(ROOM_INFO_PHASES)}
onClick={this.onRoomSummaryClicked}
/>,

View file

@ -178,10 +178,10 @@ const PinnedMessagesCard: React.FC<IProps> = ({ room, onClose, permalinkCreator
</div>
<Heading size="4" className="mx_PinnedMessagesCard_empty_header">
{_t("Nothing pinned, yet")}
{_t("right_panel|pinned_messages|empty")}
</Heading>
{_t(
"If you have permissions, open the menu on any message and select <b>Pin</b> to stick them here.",
"right_panel|pinned_messages|explainer",
{},
{
b: (sub) => <b>{sub}</b>,
@ -223,7 +223,7 @@ const PinnedMessagesCard: React.FC<IProps> = ({ room, onClose, permalinkCreator
header={
<div className="mx_BaseCard_header_title">
<Heading size="4" className="mx_BaseCard_header_title_heading">
{_t("Pinned messages")}
{_t("right_panel|pinned_messages|title")}
</Heading>
</div>
}

View file

@ -149,7 +149,7 @@ const AppRow: React.FC<IAppRowProps> = ({ app, room }) => {
let pinTitle: string;
if (cannotPin) {
pinTitle = _t("You can only pin up to %(count)s widgets", { count: MAX_PINNED });
pinTitle = _t("right_panel|pinned_messages|limits", { count: MAX_PINNED });
} else {
pinTitle = isPinned ? _t("action|unpin") : _t("action|pin");
}
@ -167,9 +167,9 @@ const AppRow: React.FC<IAppRowProps> = ({ app, room }) => {
let openTitle = "";
if (isPinned) {
openTitle = _t("Unpin this widget to view it in this panel");
openTitle = _t("widget|unpin_to_view_right_panel");
} else if (isMaximised) {
openTitle = _t("Close this widget to view it in this panel");
openTitle = _t("widget|close_to_view_right_panel");
}
const classes = classNames("mx_BaseCard_Button mx_RoomSummaryCard_Button", {
@ -237,19 +237,19 @@ const AppsSection: React.FC<IAppsSectionProps> = ({ room }) => {
if (realApps.length > 0 && WidgetLayoutStore.instance.canCopyLayoutToRoom(room)) {
copyLayoutBtn = (
<AccessibleButton kind="link" onClick={() => WidgetLayoutStore.instance.copyLayoutToRoom(room)}>
{_t("Set my room layout for everyone")}
{_t("widget|set_room_layout")}
</AccessibleButton>
);
}
return (
<Group className="mx_RoomSummaryCard_appsGroup" title={_t("Widgets")}>
<Group className="mx_RoomSummaryCard_appsGroup" title={_t("right_panel|widgets_section")}>
{realApps.map((app) => (
<AppRow key={app.id} app={app} room={room} />
))}
{copyLayoutBtn}
<AccessibleButton kind="link" onClick={onManageIntegrations}>
{realApps.length > 0 ? _t("Edit widgets, bridges & bots") : _t("Add widgets, bridges & bots")}
{realApps.length > 0 ? _t("right_panel|edit_integrations") : _t("right_panel|add_integrations")}
</AccessibleButton>
</Group>
);
@ -310,7 +310,7 @@ const RoomSummaryCard: React.FC<IProps> = ({ room, permalinkCreator, onClose, on
<div className="mx_RoomSummaryCard_avatar" role="presentation">
<RoomAvatar room={room} size="54px" viewAvatarOnClick />
<TextWithTooltip
tooltip={isRoomEncrypted ? _t("common|encrypted") : _t("Not encrypted")}
tooltip={isRoomEncrypted ? _t("common|encrypted") : _t("common|unencrypted")}
class={classNames("mx_RoomSummaryCard_e2ee", {
mx_RoomSummaryCard_e2ee_normal: isRoomEncrypted,
mx_RoomSummaryCard_e2ee_warning: isRoomEncrypted && e2eStatus === E2EStatus.Warning,
@ -350,28 +350,28 @@ const RoomSummaryCard: React.FC<IProps> = ({ room, permalinkCreator, onClose, on
onSearchClick?.();
}}
>
{_t("Search")}
{_t("right_panel|search_button")}
</Button>
)}
{!isVideoRoom && (
<Button className="mx_RoomSummaryCard_icon_files" onClick={onRoomFilesClick}>
{_t("Files")}
{_t("right_panel|files_button")}
</Button>
)}
{!isVideoRoom && (
<Button className="mx_RoomSummaryCard_icon_poll" onClick={onRoomPollHistoryClick}>
{_t("Poll history")}
{_t("right_panel|polls_button")}
</Button>
)}
{pinningEnabled && !isVideoRoom && (
<Button className="mx_RoomSummaryCard_icon_pins" onClick={onRoomPinsClick}>
{_t("Pinned")}
{_t("right_panel|pinned_messages_button")}
{pinCount > 0 && <span className="mx_BaseCard_Button_sublabel">{pinCount}</span>}
</Button>
)}
{!isVideoRoom && (
<Button className="mx_RoomSummaryCard_icon_export" onClick={onRoomExportClick}>
{_t("Export chat")}
{_t("right_panel|export_chat_button")}
</Button>
)}
<Button
@ -379,10 +379,10 @@ const RoomSummaryCard: React.FC<IProps> = ({ room, permalinkCreator, onClose, on
className="mx_RoomSummaryCard_icon_share"
onClick={onShareRoomClick}
>
{_t("Share room")}
{_t("right_panel|share_button")}
</Button>
<Button className="mx_RoomSummaryCard_icon_settings" onClick={onRoomSettingsClick}>
{_t("Room settings")}
{_t("right_panel|settings_button")}
</Button>
</Group>

View file

@ -195,7 +195,7 @@ export default class TimelineCard extends React.Component<IProps, IState> {
return (
<div className="mx_BaseCard_header_title">
<Heading size="4" className="mx_BaseCard_header_title_heading">
{_t("Chat")}
{_t("right_panel|video_room_chat|title")}
</Heading>
</div>
);

View file

@ -283,12 +283,12 @@ function DevicesSection({
}
}
expandCountCaption = _t("%(count)s verified sessions", { count: expandSectionDevices.length });
expandHideCaption = _t("Hide verified sessions");
expandHideCaption = _t("user_info|hide_verified_sessions");
expandIconClasses += " mx_E2EIcon_verified";
} else {
expandSectionDevices = devices;
expandCountCaption = _t("%(count)s sessions", { count: devices.length });
expandHideCaption = _t("Hide sessions");
expandHideCaption = _t("user_info|hide_sessions");
expandIconClasses += " mx_E2EIcon_normal";
}
@ -381,14 +381,8 @@ export const UserOptionsSection: React.FC<{
const ignore = useCallback(async () => {
const name = (member instanceof User ? member.displayName : member.name) || member.userId;
const { finished } = Modal.createDialog(QuestionDialog, {
title: _t("Ignore %(user)s", { user: name }),
description: (
<div>
{_t(
"All messages and invites from this user will be hidden. Are you sure you want to ignore them?",
)}
</div>
),
title: _t("user_info|ignore_confirm_title", { user: name }),
description: <div>{_t("user_info|ignore_confirm_description")}</div>,
button: _t("action|ignore"),
});
const [confirmed] = await finished;
@ -438,7 +432,7 @@ export const UserOptionsSection: React.FC<{
if (room?.getEventReadUpTo(member.userId)) {
readReceiptButton = (
<AccessibleButton kind="link" onClick={onReadReceiptButton} className="mx_UserInfo_field">
{_t("Jump to read receipt")}
{_t("user_info|jump_to_rr_button")}
</AccessibleButton>
);
}
@ -497,7 +491,7 @@ export const UserOptionsSection: React.FC<{
const shareUserButton = (
<AccessibleButton kind="link" onClick={onShareUserClick} className="mx_UserInfo_field">
{_t("Share Link to User")}
{_t("user_info|share_button")}
</AccessibleButton>
);
@ -520,19 +514,15 @@ export const UserOptionsSection: React.FC<{
export const warnSelfDemote = async (isSpace: boolean): Promise<boolean> => {
const { finished } = Modal.createDialog(QuestionDialog, {
title: _t("Demote yourself?"),
title: _t("user_info|demote_self_confirm_title"),
description: (
<div>
{isSpace
? _t(
"You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the space it will be impossible to regain privileges.",
)
: _t(
"You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the room it will be impossible to regain privileges.",
)}
? _t("user_info|demote_self_confirm_description_space")
: _t("user_info|demote_self_confirm_room")}
</div>
),
button: _t("Demote"),
button: _t("user_info|demote_button"),
});
const [confirmed] = await finished;
@ -544,7 +534,7 @@ const GenericAdminToolsContainer: React.FC<{
}> = ({ children }) => {
return (
<div className="mx_UserInfo_container">
<h3>{_t("Admin Tools")}</h3>
<h3>{_t("user_info|admin_tools_section")}</h3>
<div className="mx_UserInfo_buttons">{children}</div>
</div>
);
@ -631,15 +621,15 @@ export const RoomKickButton = ({
member,
action: room.isSpaceRoom()
? member.membership === "invite"
? _t("Disinvite from space")
: _t("Remove from space")
? _t("user_info|disinvite_button_space")
: _t("user_info|kick_button_space")
: member.membership === "invite"
? _t("Disinvite from room")
: _t("Remove from room"),
? _t("user_info|disinvite_button_room")
: _t("user_info|kick_button_room"),
title:
member.membership === "invite"
? _t("Disinvite from %(roomName)s", { roomName: room.name })
: _t("Remove from %(roomName)s", { roomName: room.name }),
? _t("user_info|disinvite_button_room_name", { roomName: room.name })
: _t("user_info|kick_button_room_name", { roomName: room.name }),
askReason: member.membership === "join",
danger: true,
};
@ -664,9 +654,9 @@ export const RoomKickButton = ({
child.currentState.hasSufficientPowerLevelFor("kick", myMember.powerLevel)
);
},
allLabel: _t("Remove them from everything I'm able to"),
specificLabel: _t("Remove them from specific things I'm able to"),
warningMessage: _t("They'll still be able to access whatever you're not an admin of."),
allLabel: _t("user_info|kick_button_space_everything"),
specificLabel: _t("user_info|kick_space_specific"),
warningMessage: _t("user_info|kick_space_warning"),
},
"mx_ConfirmSpaceUserActionDialog_wrapper",
));
@ -690,7 +680,7 @@ export const RoomKickButton = ({
function (err) {
logger.error("Kick error: " + err);
Modal.createDialog(ErrorDialog, {
title: _t("Failed to remove user"),
title: _t("user_info|error_kicking_user"),
description: err && err.message ? err.message : "Operation failed",
});
},
@ -702,11 +692,11 @@ export const RoomKickButton = ({
const kickLabel = room.isSpaceRoom()
? member.membership === "invite"
? _t("Disinvite from space")
: _t("Remove from space")
? _t("user_info|disinvite_button_space")
: _t("user_info|kick_button_space")
: member.membership === "invite"
? _t("Disinvite from room")
: _t("Remove from room");
? _t("user_info|disinvite_button_room")
: _t("user_info|kick_button_room");
return (
<AccessibleButton
@ -740,7 +730,7 @@ const RedactMessagesButton: React.FC<IBaseProps> = ({ member }) => {
className="mx_UserInfo_field mx_UserInfo_destructive"
onClick={onRedactAllMessages}
>
{_t("Remove recent messages")}
{_t("user_info|redact_button")}
</AccessibleButton>
);
};
@ -763,14 +753,14 @@ export const BanToggleButton = ({
member,
action: room.isSpaceRoom()
? isBanned
? _t("Unban from space")
: _t("Ban from space")
? _t("user_info|unban_button_space")
: _t("user_info|ban_button_space")
: isBanned
? _t("Unban from room")
: _t("Ban from room"),
? _t("user_info|unban_button_room")
: _t("user_info|ban_button_room"),
title: isBanned
? _t("Unban from %(roomName)s", { roomName: room.name })
: _t("Ban from %(roomName)s", { roomName: room.name }),
? _t("user_info|unban_room_confirm_title", { roomName: room.name })
: _t("user_info|ban_room_confirm_title", { roomName: room.name }),
askReason: !isBanned,
danger: !isBanned,
};
@ -808,15 +798,9 @@ export const BanToggleButton = ({
child.currentState.hasSufficientPowerLevelFor("ban", myMember.powerLevel)
);
},
allLabel: isBanned
? _t("Unban them from everything I'm able to")
: _t("Ban them from everything I'm able to"),
specificLabel: isBanned
? _t("Unban them from specific things I'm able to")
: _t("Ban them from specific things I'm able to"),
warningMessage: isBanned
? _t("They won't be able to access whatever you're not an admin of.")
: _t("They'll still be able to access whatever you're not an admin of."),
allLabel: isBanned ? _t("user_info|unban_space_everything") : _t("user_info|ban_space_everything"),
specificLabel: isBanned ? _t("user_info|unban_space_specific") : _t("user_info|ban_space_specific"),
warningMessage: isBanned ? _t("user_info|unban_space_warning") : _t("user_info|kick_space_warning"),
},
"mx_ConfirmSpaceUserActionDialog_wrapper",
));
@ -849,7 +833,7 @@ export const BanToggleButton = ({
logger.error("Ban error: " + err);
Modal.createDialog(ErrorDialog, {
title: _t("common|error"),
description: _t("Failed to ban user"),
description: _t("user_info|error_ban_user"),
});
},
)
@ -858,9 +842,9 @@ export const BanToggleButton = ({
});
};
let label = room.isSpaceRoom() ? _t("Ban from space") : _t("Ban from room");
let label = room.isSpaceRoom() ? _t("user_info|ban_button_space") : _t("user_info|ban_button_room");
if (isBanned) {
label = room.isSpaceRoom() ? _t("Unban from space") : _t("Unban from room");
label = room.isSpaceRoom() ? _t("user_info|unban_button_space") : _t("user_info|unban_button_room");
}
const classes = classNames("mx_UserInfo_field", {
@ -931,7 +915,7 @@ const MuteToggleButton: React.FC<IBaseRoomProps> = ({
logger.error("Mute error: " + err);
Modal.createDialog(ErrorDialog, {
title: _t("common|error"),
description: _t("Failed to mute user"),
description: _t("user_info|error_mute_user"),
});
},
)
@ -1179,14 +1163,12 @@ export const PowerLevelEditor: React.FC<{
const myPower = powerLevelEvent.getContent().users[myUserId || ""];
if (myPower && parseInt(myPower) <= powerLevel && myUserId !== target) {
const { finished } = Modal.createDialog(QuestionDialog, {
title: _t("Warning!"),
title: _t("common|warning"),
description: (
<div>
{_t(
"You will not be able to undo this change as you are promoting the user to have the same power level as yourself.",
)}
{_t("user_info|promote_warning")}
<br />
{_t("Are you sure?")}
{_t("common|are_you_sure")}
</div>
),
button: _t("action|continue"),
@ -1348,15 +1330,9 @@ const BasicUserInfo: React.FC<{
const onSynapseDeactivate = useCallback(async () => {
const { finished } = Modal.createDialog(QuestionDialog, {
title: _t("Deactivate user?"),
description: (
<div>
{_t(
"Deactivating this user will log them out and prevent them from logging back in. Additionally, they will leave all the rooms they are in. This action cannot be reversed. Are you sure you want to deactivate this user?",
)}
</div>
),
button: _t("Deactivate user"),
title: _t("user_info|deactivate_confirm_title"),
description: <div>{_t("user_info|deactivate_confirm_description")}</div>,
button: _t("user_info|deactivate_confirm_action"),
danger: true,
});
@ -1371,7 +1347,7 @@ const BasicUserInfo: React.FC<{
const description = err instanceof Error ? err.message : _t("invite|failed_generic");
Modal.createDialog(ErrorDialog, {
title: _t("Failed to deactivate user"),
title: _t("user_info|error_deactivate"),
description,
});
}
@ -1390,7 +1366,7 @@ const BasicUserInfo: React.FC<{
className="mx_UserInfo_field mx_UserInfo_destructive"
onClick={onSynapseDeactivate}
>
{_t("Deactivate user")}
{_t("user_info|deactivate_confirm_action")}
</AccessibleButton>
);
}
@ -1404,7 +1380,7 @@ const BasicUserInfo: React.FC<{
<div className="mx_UserInfo_container">
<h3>
{_t(
"Role in <RoomName/>",
"user_info|role_label",
{},
{
RoomName: () => <b>{room.name}</b>,
@ -1449,10 +1425,10 @@ const BasicUserInfo: React.FC<{
if (!cryptoEnabled) {
text = _t("This client does not support end-to-end encryption.");
} else if (room && !room.isSpaceRoom()) {
text = _t("Messages in this room are not end-to-end encrypted.");
text = _t("user_info|room_unencrypted");
}
} else if (!room.isSpaceRoom()) {
text = _t("Messages in this room are end-to-end encrypted.");
text = _t("user_info|room_encrypted");
}
let verifyButton;