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 (#11694)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Oct 3, 2023
1 parent 677854d commit e1cfde0
Show file tree
Hide file tree
Showing 201 changed files with 21,085 additions and 18,563 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,13 @@ export default class CreateSecretStorageDialog extends React.PureComponent<IProp
const dialogAesthetics = {
[SSOAuthEntry.PHASE_PREAUTH]: {
title: _t("auth|uia|sso_title"),
body: _t("To continue, use Single Sign On to prove your identity."),
body: _t("auth|uia|sso_preauth_body"),
continueText: _t("auth|sso"),
continueKind: "primary",
},
[SSOAuthEntry.PHASE_POSTAUTH]: {
title: _t("Confirm encryption setup"),
body: _t("Click the button below to confirm setting up encryption."),
title: _t("encryption|confirm_encryption_setup_title"),
body: _t("encryption|confirm_encryption_setup_body"),
continueText: _t("action|confirm"),
continueKind: "primary",
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/structures/MatrixChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {

const isSpace = roomToLeave?.isSpaceRoom();
Modal.createDialog(QuestionDialog, {
title: isSpace ? _t("Leave space") : _t("action|leave_room"),
title: isSpace ? _t("space|leave_dialog_action") : _t("action|leave_room"),
description: (
<span>
{isSpace
Expand Down Expand Up @@ -1271,7 +1271,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
if (room) RoomListStore.instance.manualRoomUpdate(room, RoomUpdateCause.RoomRemoved);
})
.catch((err) => {
const errCode = err.errcode || _td("unknown error code");
const errCode = err.errcode || _td("error|unknown_error_code");
Modal.createDialog(ErrorDialog, {
title: _t("error_dialog|forget_room_failed", { errCode }),
description: err && err.message ? err.message : _t("invite|failed_generic"),
Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/RoomStatusBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export default class RoomStatusBar extends React.PureComponent<IProps, IState> {
<>
<InlineSpinner w={20} h={20} />
{/* span for css */}
<span>{_t("Sending")}</span>
<span>{_t("forward|sending")}</span>
</>
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/structures/SpaceHierarchy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ const Tile: React.FC<ITileProps> = ({
);
}

let description = _t("%(count)s members", { count: room.num_joined_members ?? 0 });
let description = _t("common|n_members", { count: room.num_joined_members ?? 0 });
if (numChildRooms !== undefined) {
description += " · " + _t("%(count)s rooms", { count: numChildRooms });
description += " · " + _t("common|n_rooms", { count: numChildRooms });
}

let topic: ReactNode | string | null;
Expand Down Expand Up @@ -713,7 +713,7 @@ const ManageButtons: React.FC<IManageButtonsProps> = ({ hierarchy, selected, set
kind="danger_outline"
disabled={disabled}
>
{removing ? _t("Removing…") : _t("action|remove")}
{removing ? _t("redact|ongoing") : _t("action|remove")}
</Button>
<Button
{...props}
Expand Down Expand Up @@ -857,7 +857,7 @@ const SpaceHierarchy: React.FC<IProps> = ({ space, initialText = "", showRoom, a
} else if (!hierarchy.canLoadMore) {
results = (
<div className="mx_SpaceHierarchy_noResults">
<h3>{_t("No results found")}</h3>
<h3>{_t("common|no_results_found")}</h3>
<div>{_t("space|no_search_result_hint")}</div>
</div>
);
Expand Down
6 changes: 3 additions & 3 deletions src/components/structures/SpaceRoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ const SpaceAddExistingRooms: React.FC<{
{_t("create_space|skip_action")}
</AccessibleButton>
}
filterPlaceholder={_t("Search for rooms")}
filterPlaceholder={_t("space|room_filter_placeholder")}
onFinished={onFinished}
roomsRenderer={defaultRoomsRenderer}
dmsRenderer={defaultDmsRenderer}
Expand Down Expand Up @@ -508,7 +508,7 @@ const SpaceSetupPrivateInvite: React.FC<{
key={name}
name={name}
type="text"
label={_t("Email address")}
label={_t("common|email_address")}
placeholder={_t("auth|email_field_label")}
value={emailAddresses[i]}
onChange={(ev: React.ChangeEvent<HTMLInputElement>) => setEmailAddress(i, ev.target.value)}
Expand Down Expand Up @@ -553,7 +553,7 @@ const SpaceSetupPrivateInvite: React.FC<{
}
} catch (err) {
logger.error("Failed to invite users to space: ", err);
setError(_t("We couldn't invite those users. Please check the users you want to invite and try again."));
setError(_t("invite|error_invite"));
}
setBusy(false);
};
Expand Down
12 changes: 1 addition & 11 deletions src/components/structures/auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import classNames from "classnames";
import { logger } from "matrix-js-sdk/src/logger";
import { SSOFlow, SSOAction } from "matrix-js-sdk/src/matrix";

import { _t, _td, UserFriendlyError } from "../../../languageHandler";
import { _t, UserFriendlyError } from "../../../languageHandler";
import Login, { ClientLoginFlow, OidcNativeFlow } from "../../../Login";
import { messageForConnectionError, messageForLoginError } from "../../../utils/ErrorUtils";
import AutoDiscoveryUtils from "../../../utils/AutoDiscoveryUtils";
Expand All @@ -41,16 +41,6 @@ import { filterBoolean } from "../../../utils/arrays";
import { Features } from "../../../settings/Settings";
import { startOidcLogin } from "../../../utils/oidc/authorize";

// These are used in several places, and come from the js-sdk's autodiscovery
// stuff. We define them here so that they'll be picked up by i18n.
_td("Invalid homeserver discovery response");
_td("Failed to get autodiscovery configuration from server");
_td("Invalid base_url for m.homeserver");
_td("Homeserver URL does not appear to be a valid Matrix homeserver");
_td("Invalid identity server discovery response");
_td("Invalid base_url for m.identity_server");
_td("Identity server URL does not appear to be a valid identity server");
_td("General failure");
interface IProps {
serverConfig: ValidatedServerConfig;
// If true, the component will consider itself busy.
Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/auth/SetupEncryptionBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export default class SetupEncryptionBody extends React.Component<IProps, IState>
{useRecoveryKeyButton}
</div>
<div className="mx_SetupEncryptionBody_reset">
{_t("Forgotten or lost all recovery methods? <a>Reset all</a>", undefined, {
{_t("encryption|reset_all_button", undefined, {
a: (sub) => (
<AccessibleButton
kind="link_inline"
Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/auth/SoftLogout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export default class SoftLogout extends React.Component<IProps, IState> {
<p>{_t("auth|soft_logout_warning")}</p>
<div>
<AccessibleButton onClick={this.onClearAll} kind="danger">
{_t("Clear all data")}
{_t("auth|soft_logout|clear_data_button")}
</AccessibleButton>
</div>
</AuthBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const EnterEmail: React.FC<EnterEmailProps> = ({
<div className="mx_AuthBody_fieldRow">
<EmailField
name="reset_email" // define a name so browser's password autofill gets less confused
label="Email address"
label={_td("common|email_address")}
labelRequired={_td("auth|forgot_password_email_required")}
labelInvalid={_td("auth|forgot_password_email_invalid")}
value={email}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const VerifyEmailModal: React.FC<Props> = ({
<AccessibleButton
onClick={onCloseClick}
className="mx_Dialog_cancelButton"
aria-label={_t("Close dialog")}
aria-label={_t("dialog_close_label")}
/>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/auth/PasswordLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ export default class PasswordLogin extends React.PureComponent<IProps, IState> {
{_t("common|username")}
</option>
<option key={LoginField.Email} value={LoginField.Email}>
{_t("Email address")}
{_t("common|email_address")}
</option>
<option key={LoginField.Password} value={LoginField.Password}>
{_t("auth|msisdn_field_label")}
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/auth/RegistrationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
test: ({ value }, usernameAvailable) =>
(!value || SAFE_LOCALPART_REGEX.test(value)) &&
usernameAvailable !== UsernameAvailableStatus.Invalid,
invalid: () => _t("Some characters not allowed"),
invalid: () => _t("room_settings|general|alias_field_safe_localpart_invalid"),
},
{
key: "available",
Expand Down Expand Up @@ -453,7 +453,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
}
const emailLabel = this.authStepIsRequired("m.login.email.identity")
? _td("auth|email_field_label")
: _td("Email (optional)");
: _td("auth|registration|continue_without_email_field_label");
return (
<EmailField
fieldRef={(field) => (this[RegistrationField.Email] = field)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/beacon/BeaconListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const BeaconListItem: React.FC<Props & HTMLProps<HTMLLIElement>> = ({ beacon, ..
</div>
</BeaconStatus>
<span className="mx_BeaconListItem_lastUpdated">
{_t("Updated %(humanizedUpdateTime)s", { humanizedUpdateTime })}
{_t("location_sharing|live_update_time", { humanizedUpdateTime })}
</span>
</div>
</li>
Expand Down
14 changes: 10 additions & 4 deletions src/components/views/beacon/BeaconStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface Props {

const BeaconExpiryTime: React.FC<{ beacon: Beacon }> = ({ beacon }) => {
const expiryTime = formatTime(new Date(getBeaconExpiryTimestamp(beacon)));
return <span className="mx_BeaconStatus_expiryTime">{_t("Live until %(expiryTime)s", { expiryTime })}</span>;
return <span className="mx_BeaconStatus_expiryTime">{_t("location_sharing|live_until", { expiryTime })}</span>;
};

const BeaconStatus: React.FC<Props & HTMLProps<HTMLDivElement>> = ({
Expand All @@ -61,13 +61,19 @@ const BeaconStatus: React.FC<Props & HTMLProps<HTMLDivElement>> = ({
)}
<div className="mx_BeaconStatus_description">
{displayStatus === BeaconDisplayStatus.Loading && (
<span className="mx_BeaconStatus_description_status">{_t("Loading live location…")}</span>
<span className="mx_BeaconStatus_description_status">
{_t("location_sharing|loading_live_location")}
</span>
)}
{displayStatus === BeaconDisplayStatus.Stopped && (
<span className="mx_BeaconStatus_description_status">{_t("Live location ended")}</span>
<span className="mx_BeaconStatus_description_status">
{_t("location_sharing|live_location_ended")}
</span>
)}
{displayStatus === BeaconDisplayStatus.Error && (
<span className="mx_BeaconStatus_description_status">{_t("Live location error")}</span>
<span className="mx_BeaconStatus_description_status">
{_t("location_sharing|live_location_error")}
</span>
)}
{displayStatus === BeaconDisplayStatus.Active && beacon && (
<>
Expand Down
6 changes: 4 additions & 2 deletions src/components/views/beacon/BeaconViewDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ const BeaconViewDialog: React.FC<IProps> = ({ initialFocusedBeacon, roomId, matr
)}
{!centerGeoUri && !mapDisplayError && (
<MapFallback data-testid="beacon-view-dialog-map-fallback" className="mx_BeaconViewDialog_map">
<span className="mx_BeaconViewDialog_mapFallbackMessage">{_t("No live locations")}</span>
<span className="mx_BeaconViewDialog_mapFallbackMessage">
{_t("location_sharing|live_locations_empty")}
</span>
<AccessibleButton
kind="primary"
onClick={onFinished}
Expand All @@ -185,7 +187,7 @@ const BeaconViewDialog: React.FC<IProps> = ({ initialFocusedBeacon, roomId, matr
>
<LiveLocationIcon height={12} />
&nbsp;
{_t("View list")}
{_t("action|view_list")}
</AccessibleButton>
)}
<DialogOwnBeaconStatus roomId={roomId} />
Expand Down
6 changes: 3 additions & 3 deletions src/components/views/beacon/DialogSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ const DialogSidebar: React.FC<Props> = ({ beacons, onBeaconClick, requestClose }
return (
<div className="mx_DialogSidebar">
<div className="mx_DialogSidebar_header">
<Heading size="4">{_t("View List")}</Heading>
<Heading size="4">{_t("action|view_list")}</Heading>
<AccessibleButton
className="mx_DialogSidebar_closeButton"
onClick={requestClose}
title={_t("Close sidebar")}
title={_t("location_sharing|close_sidebar")}
data-testid="dialog-sidebar-close"
>
<CloseIcon className="mx_DialogSidebar_closeButtonIcon" />
Expand All @@ -50,7 +50,7 @@ const DialogSidebar: React.FC<Props> = ({ beacons, onBeaconClick, requestClose }
))}
</ol>
) : (
<div className="mx_DialogSidebar_noResults">{_t("No live locations")}</div>
<div className="mx_DialogSidebar_noResults">{_t("location_sharing|live_locations_empty")}</div>
)}
</div>
);
Expand Down
6 changes: 3 additions & 3 deletions src/components/views/beacon/LeftPanelLiveShareWarning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ const chooseBestBeacon = (

const getLabel = (hasStoppingErrors: boolean, hasLocationErrors: boolean): string => {
if (hasStoppingErrors) {
return _t("An error occurred while stopping your live location");
return _t("location_sharing|error_stopping_live_location");
}
if (hasLocationErrors) {
return _t("An error occurred whilst sharing your live location");
return _t("location_sharing|error_sharing_live_location");
}
return _t("You are sharing your live location");
return _t("location_sharing|live_location_active");
};

const useLivenessMonitor = (liveBeaconIds: BeaconIdentifier[], beacons: Map<BeaconIdentifier, Beacon>): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/beacon/OwnBeaconStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const OwnBeaconStatus: React.FC<Props & HTMLProps<HTMLDivElement>> = ({ beacon,
<BeaconStatus
beacon={beacon}
displayStatus={ownDisplayStatus}
label={_t("Live location enabled")}
label={_t("location_sharing|live_location_enabled")}
displayLiveTimeRemaining
{...rest}
>
Expand Down
6 changes: 3 additions & 3 deletions src/components/views/beacon/RoomLiveShareWarning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ import { Action } from "../../../dispatcher/actions";

const getLabel = (hasLocationPublishError: boolean, hasStopSharingError: boolean): string => {
if (hasLocationPublishError) {
return _t("An error occurred whilst sharing your live location, please try again");
return _t("location_sharing|error_sharing_live_location_try_again");
}
if (hasStopSharingError) {
return _t("An error occurred while stopping your live location, please try again");
return _t("location_sharing|error_stopping_live_location_try_again");
}
return _t("You are sharing your live location");
return _t("location_sharing|live_location_active");
};

interface RoomLiveShareWarningInnerProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/beacon/ShareLatestLocation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const ShareLatestLocation: React.FC<Props> = ({ latestLocationState }) => {

return (
<>
<TooltipTarget label={_t("Open in OpenStreetMap")}>
<TooltipTarget label={_t("timeline|context_menu|open_in_osm")}>
<a data-testid="open-location-in-osm" href={mapLink} target="_blank" rel="noreferrer noopener">
<ExternalLinkIcon className="mx_ShareLatestLocation_icon" />
</a>
Expand Down
6 changes: 3 additions & 3 deletions src/components/views/context_menus/DeviceContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import { IProps as IContextMenuProps } from "../../structures/ContextMenu";
import { _t, _td, TranslationKey } from "../../../languageHandler";

const SECTION_NAMES: Record<MediaDeviceKindEnum, TranslationKey> = {
[MediaDeviceKindEnum.AudioInput]: _td("Input devices"),
[MediaDeviceKindEnum.AudioOutput]: _td("Output devices"),
[MediaDeviceKindEnum.VideoInput]: _td("Cameras"),
[MediaDeviceKindEnum.AudioInput]: _td("voip|input_devices"),
[MediaDeviceKindEnum.AudioOutput]: _td("voip|output_devices"),
[MediaDeviceKindEnum.VideoInput]: _td("common|cameras"),
};

interface IDeviceContextMenuDeviceProps {
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/context_menus/LegacyCallContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ export default class LegacyCallContextMenu extends React.Component<IProps> {
};

public render(): React.ReactNode {
const holdUnholdCaption = this.props.call.isRemoteOnHold() ? _t("Resume") : _t("Hold");
const holdUnholdCaption = this.props.call.isRemoteOnHold() ? _t("action|resume") : _t("action|hold");
const handler = this.props.call.isRemoteOnHold() ? this.onUnholdClick : this.onHoldClick;

let transferItem;
if (this.props.call.opponentCanBeTransferred()) {
transferItem = (
<MenuItem className="mx_LegacyCallContextMenu_item" onClick={this.onTransferClick}>
{_t("Transfer")}
{_t("action|transfer")}
</MenuItem>
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/views/context_menus/MessageContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
resendReactionsButton = (
<IconizedContextMenuOption
iconClassName="mx_MessageContextMenu_iconResend"
label={_t("Resend %(unsentCount)s reaction(s)", { unsentCount: unsentReactionsCount })}
label={_t("timeline|context_menu|resent_unsent_reactions", { unsentCount: unsentReactionsCount })}
onClick={this.onResendReactionsClick}
/>
);
Expand All @@ -439,7 +439,7 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
<IconizedContextMenuOption
iconClassName="mx_MessageContextMenu_iconOpenInMapSite"
onClick={null}
label={_t("Open in OpenStreetMap")}
label={_t("timeline|context_menu|open_in_osm")}
element="a"
{...{
href: mapSiteLink,
Expand Down Expand Up @@ -518,7 +518,7 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
endPollButton = (
<IconizedContextMenuOption
iconClassName="mx_MessageContextMenu_iconEndPoll"
label={_t("End Poll")}
label={_t("poll|end_title")}
onClick={this.onEndPollClick}
/>
);
Expand Down
Loading

0 comments on commit e1cfde0

Please sign in to comment.