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

Commit

Permalink
Migrate more strings to translation keys (#11665)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Sep 25, 2023
1 parent de250df commit 54c88c5
Show file tree
Hide file tree
Showing 127 changed files with 6,797 additions and 5,825 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export default class ManageEventIndexDialog extends React.Component<IProps, ISta
<BaseDialog
className="mx_ManageEventIndexDialog"
onFinished={this.props.onFinished}
title={_t("Message search")}
title={_t("settings|security|message_search_section")}
>
{eventIndexingSettings}
<DialogButtons
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent<IProp
onClick={this.onCopyClick}
disabled={this.state.phase === Phase.Storing}
>
{this.state.copied ? _t("Copied!") : _t("action|copy")}
{this.state.copied ? _t("common|copied") : _t("action|copy")}
</AccessibleButton>
</div>
</div>
Expand Down Expand Up @@ -873,7 +873,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent<IProp
private titleForPhase(phase: Phase): string {
switch (phase) {
case Phase.ChooseKeyPassphrase:
return _t("Set up Secure Backup");
return _t("encryption|set_up_toast_title");
case Phase.Migrate:
return _t("Upgrade your encryption");
case Phase.Passphrase:
Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/NotificationPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default class NotificationPanel extends React.PureComponent<IProps, IStat
header={
<div className="mx_BaseCard_header_title">
<Heading size="4" className="mx_BaseCard_header_title_heading">
{_t("Notifications")}
{_t("notifications|enable_prompt_toast_title")}
</Heading>
</div>
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/structures/UserMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
{homeButton}
<IconizedContextMenuOption
iconClassName="mx_UserMenu_iconBell"
label={_t("Notifications")}
label={_t("notifications|enable_prompt_toast_title")}
onClick={(e) => this.onSettingsOpen(e, UserTab.Notifications)}
/>
<IconizedContextMenuOption
Expand All @@ -359,7 +359,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
/>
<IconizedContextMenuOption
iconClassName="mx_UserMenu_iconSettings"
label={_t("All settings")}
label={_t("user_menu|settings")}
onClick={(e) => this.onSettingsOpen(e)}
/>
{feedbackButton}
Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/auth/Registration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ export default class Registration extends React.Component<IProps, IState> {
<Fragment>
<div className="mx_Register_mainContent">
<AuthHeaderDisplay
title={_t("Create account")}
title={_t("auth|create_account_title")}
serverPicker={
<ServerPicker
title={_t("auth|server_picker_title_registration")}
Expand Down
12 changes: 6 additions & 6 deletions src/components/views/context_menus/MessageContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
const viewSourceButton = (
<IconizedContextMenuOption
iconClassName="mx_MessageContextMenu_iconSource"
label={_t("View source")}
label={_t("timeline|context_menu|view_source")}
onClick={this.onViewSourceClick}
/>
);
Expand All @@ -487,7 +487,7 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
unhidePreviewButton = (
<IconizedContextMenuOption
iconClassName="mx_MessageContextMenu_iconUnhidePreview"
label={_t("Show preview")}
label={_t("timeline|context_menu|show_url_preview")}
onClick={this.onUnhidePreviewClick}
/>
);
Expand Down Expand Up @@ -546,7 +546,7 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
<IconizedContextMenuOption
iconClassName="mx_MessageContextMenu_iconLink"
onClick={this.closeMenu}
label={_t("Source URL")}
label={_t("timeline|context_menu|external_url")}
element="a"
{
// XXX: Typescript signature for AccessibleButton doesn't work properly for non-inputs like `a`
Expand All @@ -565,7 +565,7 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
collapseReplyChainButton = (
<IconizedContextMenuOption
iconClassName="mx_MessageContextMenu_iconCollapse"
label={_t("Collapse reply thread")}
label={_t("timeline|context_menu|collapse_reply_thread")}
onClick={this.onCollapseReplyChainClick}
/>
);
Expand All @@ -577,7 +577,7 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
jumpToRelatedEventButton = (
<IconizedContextMenuOption
iconClassName="mx_MessageContextMenu_jumpToEvent"
label={_t("View related event")}
label={_t("timeline|context_menu|view_related_event")}
onClick={() => this.onJumpToRelatedEventClick(relatedEventId)}
/>
);
Expand All @@ -588,7 +588,7 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
reportEventButton = (
<IconizedContextMenuOption
iconClassName="mx_MessageContextMenu_iconReport"
label={_t("Report")}
label={_t("timeline|context_menu|report")}
onClick={this.onReportEventClick}
/>
);
Expand Down
10 changes: 5 additions & 5 deletions src/components/views/context_menus/RoomContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const RoomContextMenu: React.FC<IProps> = ({ room, onFinished, ...props }) => {
leaveOption = (
<IconizedContextMenuOption
iconClassName="mx_RoomTile_iconSignOut"
label={_t("Forget")}
label={_t("room|context_menu|forget")}
className="mx_IconizedContextMenu_option_red"
onClick={onForgetRoomClick}
/>
Expand Down Expand Up @@ -154,7 +154,7 @@ const RoomContextMenu: React.FC<IProps> = ({ room, onFinished, ...props }) => {
PosthogTrackers.trackInteraction("WebRoomHeaderContextMenuFavouriteToggle", e);
}}
active={isFavorite}
label={isFavorite ? _t("Favourited") : _t("Favourite")}
label={isFavorite ? _t("room|context_menu|unfavourite") : _t("room|context_menu|favourite")}
iconClassName="mx_RoomTile_iconStar"
/>
);
Expand Down Expand Up @@ -182,7 +182,7 @@ const RoomContextMenu: React.FC<IProps> = ({ room, onFinished, ...props }) => {
iconClassName = "mx_RoomTile_iconNotificationsAllMessages";
break;
case RoomNotifState.MentionsOnly:
notificationLabel = _t("Mentions only");
notificationLabel = _t("room|context_menu|mentions_only");
iconClassName = "mx_RoomTile_iconNotificationsMentionsKeywords";
break;
case RoomNotifState.Mute:
Expand All @@ -206,7 +206,7 @@ const RoomContextMenu: React.FC<IProps> = ({ room, onFinished, ...props }) => {

PosthogTrackers.trackInteraction("WebRoomHeaderContextMenuNotificationsItem", ev);
}}
label={_t("Notifications")}
label={_t("notifications|enable_prompt_toast_title")}
iconClassName={iconClassName}
>
<span className="mx_IconizedContextMenu_sublabel">{notificationLabel}</span>
Expand Down Expand Up @@ -247,7 +247,7 @@ const RoomContextMenu: React.FC<IProps> = ({ room, onFinished, ...props }) => {
});
onFinished();
}}
label={_t("Copy room link")}
label={_t("room|context_menu|copy_link")}
iconClassName="mx_RoomTile_iconCopyLink"
/>
);
Expand Down
10 changes: 5 additions & 5 deletions src/components/views/context_menus/RoomGeneralContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const RoomGeneralContextMenu: React.FC<RoomGeneralContextMenuProps> = ({
<IconizedContextMenuCheckbox
onClick={wrapHandler((ev) => onTagRoom(ev, DefaultTagID.Favourite), onPostFavoriteClick, true)}
active={isFavorite}
label={isFavorite ? _t("Favourited") : _t("Favourite")}
label={isFavorite ? _t("room|context_menu|unfavourite") : _t("room|context_menu|favourite")}
iconClassName="mx_RoomGeneralContextMenu_iconStar"
/>
);
Expand All @@ -121,7 +121,7 @@ export const RoomGeneralContextMenu: React.FC<RoomGeneralContextMenuProps> = ({
<IconizedContextMenuCheckbox
onClick={wrapHandler((ev) => onTagRoom(ev, DefaultTagID.LowPriority), onPostLowPriorityClick, true)}
active={isLowPriority}
label={_t("Low Priority")}
label={_t("room|context_menu|low_priority")}
iconClassName="mx_RoomGeneralContextMenu_iconArrowDown"
/>
);
Expand Down Expand Up @@ -156,7 +156,7 @@ export const RoomGeneralContextMenu: React.FC<RoomGeneralContextMenuProps> = ({
}),
onPostCopyLinkClick,
)}
label={_t("Copy room link")}
label={_t("room|context_menu|copy_link")}
iconClassName="mx_RoomGeneralContextMenu_iconCopyLink"
/>
);
Expand All @@ -182,7 +182,7 @@ export const RoomGeneralContextMenu: React.FC<RoomGeneralContextMenuProps> = ({
leaveOption = (
<IconizedContextMenuOption
iconClassName="mx_RoomGeneralContextMenu_iconSignOut"
label={_t("Forget Room")}
label={_t("room|context_menu|forget")}
className="mx_IconizedContextMenu_option_red"
onClick={wrapHandler(
() =>
Expand Down Expand Up @@ -221,7 +221,7 @@ export const RoomGeneralContextMenu: React.FC<RoomGeneralContextMenuProps> = ({
onFinished?.();
}}
active={false}
label={_t("Mark as read")}
label={_t("room|context_menu|mark_read")}
iconClassName="mx_RoomGeneralContextMenu_iconMarkAsRead"
/>
) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const RoomNotificationContextMenu: React.FC<IProps> = ({ room, onFinished

const defaultOption: JSX.Element = (
<IconizedContextMenuRadio
label={_t("Match default setting")}
label={_t("room|context_menu|notifications_default")}
active={notificationState === RoomNotifState.AllMessages}
iconClassName="mx_RoomNotificationContextMenu_iconBell"
onClick={wrapHandler(() => setNotificationState(RoomNotifState.AllMessages))}
Expand All @@ -79,7 +79,7 @@ export const RoomNotificationContextMenu: React.FC<IProps> = ({ room, onFinished

const muteOption: JSX.Element = (
<IconizedContextMenuRadio
label={_t("Mute room")}
label={_t("room|context_menu|notifications_mute")}
active={notificationState === RoomNotifState.Mute}
iconClassName="mx_RoomNotificationContextMenu_iconBellCrossed"
onClick={wrapHandler(() => setNotificationState(RoomNotifState.Mute))}
Expand Down
27 changes: 16 additions & 11 deletions src/components/views/context_menus/WidgetContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ export const WidgetContextMenu: React.FC<IProps> = ({
onFinished();
};
streamAudioStreamButton = (
<IconizedContextMenuOption onClick={onStreamAudioClick} label={_t("Start audio stream")} />
<IconizedContextMenuOption
onClick={onStreamAudioClick}
label={_t("widget|context_menu|start_audio_stream")}
/>
);
}

Expand Down Expand Up @@ -179,7 +182,9 @@ export const WidgetContextMenu: React.FC<IProps> = ({
onFinished();
};

snapshotButton = <IconizedContextMenuOption onClick={onSnapshotClick} label={_t("Take a picture")} />;
snapshotButton = (
<IconizedContextMenuOption onClick={onSnapshotClick} label={_t("widget|context_menu|screenshot")} />
);
}

let deleteButton: JSX.Element | undefined;
Expand All @@ -190,11 +195,9 @@ export const WidgetContextMenu: React.FC<IProps> = ({
} else if (roomId) {
// Show delete confirmation dialog
Modal.createDialog(QuestionDialog, {
title: _t("Delete Widget"),
description: _t(
"Deleting a widget removes it for all users in this room. Are you sure you want to delete this widget?",
),
button: _t("Delete widget"),
title: _t("widget|context_menu|delete"),
description: _t("widget|context_menu|delete_warning"),
button: _t("widget|context_menu|delete"),
onFinished: (confirmed) => {
if (!confirmed) return;
WidgetUtils.setRoomWidget(cli, roomId, app.id);
Expand All @@ -208,7 +211,7 @@ export const WidgetContextMenu: React.FC<IProps> = ({
deleteButton = (
<IconizedContextMenuOption
onClick={_onDeleteClick}
label={userWidget ? _t("action|remove") : _t("Remove for everyone")}
label={userWidget ? _t("action|remove") : _t("widget|context_menu|remove")}
/>
);
}
Expand All @@ -233,7 +236,9 @@ export const WidgetContextMenu: React.FC<IProps> = ({
onFinished();
};

revokeButton = <IconizedContextMenuOption onClick={onRevokeClick} label={_t("Revoke permissions")} />;
revokeButton = (
<IconizedContextMenuOption onClick={onRevokeClick} label={_t("widget|context_menu|revoke")} />
);
}
}

Expand All @@ -246,7 +251,7 @@ export const WidgetContextMenu: React.FC<IProps> = ({
onFinished();
};

moveLeftButton = <IconizedContextMenuOption onClick={onClick} label={_t("Move left")} />;
moveLeftButton = <IconizedContextMenuOption onClick={onClick} label={_t("widget|context_menu|move_left")} />;
}

let moveRightButton: JSX.Element | undefined;
Expand All @@ -257,7 +262,7 @@ export const WidgetContextMenu: React.FC<IProps> = ({
onFinished();
};

moveRightButton = <IconizedContextMenuOption onClick={onClick} label={_t("Move right")} />;
moveRightButton = <IconizedContextMenuOption onClick={onClick} label={_t("widget|context_menu|move_right")} />;
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/dialogs/LogoutDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export default class LogoutDialog extends React.Component<IProps, IState> {
<button onClick={this.onLogoutConfirm}>{_t("I don't want my encrypted messages")}</button>
</DialogButtons>
<details>
<summary>{_t("Advanced")}</summary>
<summary>{_t("common|Advanced")}</summary>
<p>
<button onClick={this.onExportE2eKeysClicked}>{_t("Manually export keys")}</button>
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/dialogs/MessageEditHistoryDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export default class MessageEditHistoryDialog extends React.PureComponent<IProps
);
} else if (error.errcode) {
// some kind of error from the homeserver
content = <p className="mx_MessageEditHistoryDialog_error">{_t("Something went wrong!")}</p>;
content = <p className="mx_MessageEditHistoryDialog_error">{_t("error|something_went_wrong")}</p>;
} else {
content = (
<p className="mx_MessageEditHistoryDialog_error">
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/dialogs/RoomSettingsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class RoomSettingsDialog extends React.Component<IProps, IState> {
tabs.push(
new Tab(
RoomSettingsTab.Notifications,
_td("Notifications"),
_td("notifications|enable_prompt_toast_title"),
"mx_RoomSettingsDialog_notificationsIcon",
(
<NotificationSettingsTab
Expand Down Expand Up @@ -218,7 +218,7 @@ class RoomSettingsDialog extends React.Component<IProps, IState> {
tabs.push(
new Tab(
RoomSettingsTab.Advanced,
_td("Advanced"),
_td("common|Advanced"),
"mx_RoomSettingsDialog_warningIcon",
(
<AdvancedRoomSettingsTab
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/dialogs/SpaceSettingsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const SpaceSettingsDialog: React.FC<IProps> = ({ matrixClient: cli, space, onFin
SettingsStore.getValue(UIFeature.AdvancedSettings)
? new Tab(
SpaceSettingsTab.Advanced,
_td("Advanced"),
_td("common|Advanced"),
"mx_RoomSettingsDialog_warningIcon",
<AdvancedRoomSettingsTab room={space} closeSettingsFn={onFinished} />,
)
Expand Down
6 changes: 3 additions & 3 deletions src/components/views/dialogs/UserSettingsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>
tabs.push(
new Tab(
UserTab.Notifications,
_td("Notifications"),
_td("notifications|enable_prompt_toast_title"),
"mx_UserSettingsDialog_bellIcon",
<NotificationUserSettingsTab />,
"UserSettingsNotifications",
Expand All @@ -122,7 +122,7 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>
tabs.push(
new Tab(
UserTab.Sidebar,
_td("Sidebar"),
_td("settings|sidebar|title"),
"mx_UserSettingsDialog_sidebarIcon",
<SidebarUserSettingsTab />,
"UserSettingsSidebar",
Expand Down Expand Up @@ -153,7 +153,7 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>
tabs.push(
new Tab(
UserTab.SessionManager,
_td("Sessions"),
_td("settings|sessions|title"),
"mx_UserSettingsDialog_sessionsIcon",
<SessionManagerTab />,
// don't track with posthog while under construction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default class SetupEncryptionDialog extends React.Component<IProps, IStat
<BaseDialog
headerImage={this.state.icon}
onFinished={this.props.onFinished}
title={_t("Verify this session")}
title={_t("encryption|verify_toast_title")}
>
<SetupEncryptionBody onFinished={this.props.onFinished} />
</BaseDialog>
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/dialogs/spotlight/SpotlightDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
copyPlaintext(ownInviteLink);
}}
onHideTooltip={() => setInviteLinkCopied(false)}
title={inviteLinkCopied ? _t("Copied!") : _t("action|copy")}
title={inviteLinkCopied ? _t("common|copied") : _t("action|copy")}
>
<span className="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary_outline">
{_t("Copy invite link")}
Expand Down
Loading

0 comments on commit 54c88c5

Please sign in to comment.