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

Commit e9c9377

Browse files
authored
Migrate more strings to translation keys (#11608)
1 parent 46072ca commit e9c9377

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+2402
-2411
lines changed

src/Registration.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ export async function startAnyRegistrationFlow(
5353
const modal = Modal.createDialog(QuestionDialog, {
5454
hasCancelButton: true,
5555
quitOnly: true,
56-
title: SettingsStore.getValue(UIFeature.Registration) ? _t("Sign In or Create Account") : _t("action|sign_in"),
56+
title: SettingsStore.getValue(UIFeature.Registration) ? _t("auth|sign_in_or_register") : _t("action|sign_in"),
5757
description: SettingsStore.getValue(UIFeature.Registration)
58-
? _t("Use your account or create a new one to continue.")
59-
: _t("Use your account to continue."),
58+
? _t("auth|sign_in_or_register_description")
59+
: _t("auth|sign_in_description"),
6060
button: _t("action|sign_in"),
6161
extraButtons: SettingsStore.getValue(UIFeature.Registration)
6262
? [
@@ -67,7 +67,7 @@ export async function startAnyRegistrationFlow(
6767
dis.dispatch({ action: "start_registration", screenAfterLogin: options.screen_after });
6868
}}
6969
>
70-
{_t("Create Account")}
70+
{_t("auth|register_action")}
7171
</button>,
7272
]
7373
: [],

src/components/structures/UserMenu.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
295295
topSection = (
296296
<div className="mx_UserMenu_contextMenu_header mx_UserMenu_contextMenu_guestPrompts">
297297
{_t(
298-
"Got an account? <a>Sign in</a>",
298+
"auth|sign_in_prompt",
299299
{},
300300
{
301301
a: (sub) => (
@@ -307,7 +307,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
307307
)}
308308
{SettingsStore.getValue(UIFeature.Registration)
309309
? _t(
310-
"New here? <a>Create an account</a>",
310+
"auth|create_account_prompt",
311311
{},
312312
{
313313
a: (sub) => (
@@ -338,7 +338,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
338338
feedbackButton = (
339339
<IconizedContextMenuOption
340340
iconClassName="mx_UserMenu_iconMessage"
341-
label={_t("Feedback")}
341+
label={_t("common|feedback")}
342342
onClick={this.onProvideFeedback}
343343
/>
344344
);

src/components/structures/auth/Login.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
224224
let errorText: ReactNode;
225225
// Some error strings only apply for logging in
226226
if (error.httpStatus === 400 && username && username.indexOf("@") > 0) {
227-
errorText = _t("This homeserver does not support login using email address.");
227+
errorText = _t("auth|unsupported_auth_email");
228228
} else {
229229
errorText = messageForLoginError(error, this.props.serverConfig);
230230
}
@@ -273,7 +273,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
273273
} catch (e) {
274274
logger.error("Problem parsing URL or unhandled error doing .well-known discovery:", e);
275275

276-
let message = _t("Failed to perform homeserver discovery");
276+
let message = _t("auth|failed_homeserver_discovery");
277277
if (e instanceof UserFriendlyError && e.translatedMessage) {
278278
message = e.translatedMessage;
279279
}
@@ -398,9 +398,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
398398

399399
if (supportedFlows.length === 0) {
400400
this.setState({
401-
errorText: _t(
402-
"This homeserver doesn't offer any login flows that are supported by this client.",
403-
),
401+
errorText: _t("auth|unsupported_auth"),
404402
});
405403
}
406404
},
@@ -532,20 +530,18 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
532530
<div className="mx_AuthBody_paddedFooter">
533531
<div className="mx_AuthBody_paddedFooter_title">
534532
<InlineSpinner w={20} h={20} />
535-
{this.props.isSyncing ? _t("Syncing…") : _t("Signing In…")}
533+
{this.props.isSyncing ? _t("auth|syncing") : _t("auth|signing_in")}
536534
</div>
537535
{this.props.isSyncing && (
538-
<div className="mx_AuthBody_paddedFooter_subtitle">
539-
{_t("If you've joined lots of rooms, this might take a while")}
540-
</div>
536+
<div className="mx_AuthBody_paddedFooter_subtitle">{_t("auth|sync_footer_subtitle")}</div>
541537
)}
542538
</div>
543539
);
544540
} else if (SettingsStore.getValue(UIFeature.Registration)) {
545541
footer = (
546542
<span className="mx_AuthBody_changeFlow">
547543
{_t(
548-
"New? <a>Create account</a>",
544+
"auth|create_account_prompt",
549545
{},
550546
{
551547
a: (sub) => (

src/components/structures/auth/Registration.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,15 @@ export default class Registration extends React.Component<IProps, IState> {
263263
} else {
264264
this.setState({
265265
serverErrorIsFatal: true, // fatal because user cannot continue on this server
266-
errorText: _t("Registration has been disabled on this homeserver."),
266+
errorText: _t("auth|registration_disabled"),
267267
// add empty flows array to get rid of spinner
268268
flows: [],
269269
});
270270
}
271271
} else {
272272
logger.log("Unable to query for supported registration methods.", e);
273273
this.setState({
274-
errorText: _t("Unable to query for supported registration methods."),
274+
errorText: _t("auth|failed_query_registration_methods"),
275275
// add empty flows array to get rid of spinner
276276
flows: [],
277277
});
@@ -326,12 +326,12 @@ export default class Registration extends React.Component<IProps, IState> {
326326
const flows = (response as IAuthData).flows ?? [];
327327
const msisdnAvailable = flows.some((flow) => flow.stages.includes(AuthType.Msisdn));
328328
if (!msisdnAvailable) {
329-
errorText = _t("This server does not support authentication with a phone number.");
329+
errorText = _t("auth|unsupported_auth_msisdn");
330330
}
331331
} else if (response instanceof MatrixError && response.errcode === "M_USER_IN_USE") {
332-
errorText = _t("Someone already has that username, please try another.");
332+
errorText = _t("auth|username_in_use");
333333
} else if (response instanceof MatrixError && response.errcode === "M_THREEPID_IN_USE") {
334-
errorText = _t("That e-mail address or phone number is already in use.");
334+
errorText = _t("auth|3pid_in_use");
335335
}
336336

337337
this.setState({

src/components/structures/auth/SoftLogout.tsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export default class SoftLogout extends React.Component<IProps, IState> {
161161
e.errcode === "M_FORBIDDEN" &&
162162
(e.httpStatus === 401 || e.httpStatus === 403)
163163
) {
164-
errorText = _t("Incorrect password");
164+
errorText = _t("auth|incorrect_password");
165165
}
166166

167167
this.setState({
@@ -173,7 +173,7 @@ export default class SoftLogout extends React.Component<IProps, IState> {
173173

174174
Lifecycle.hydrateSession(credentials).catch((e) => {
175175
logger.error(e);
176-
this.setState({ busy: false, errorText: _t("Failed to re-authenticate") });
176+
this.setState({ busy: false, errorText: _t("auth|failed_soft_logout_auth") });
177177
});
178178
};
179179

@@ -239,7 +239,7 @@ export default class SoftLogout extends React.Component<IProps, IState> {
239239
{_t("action|sign_in")}
240240
</AccessibleButton>
241241
<AccessibleButton onClick={this.onForgotPassword} kind="link">
242-
{_t("Forgotten your password?")}
242+
{_t("auth|forgot_password_prompt")}
243243
</AccessibleButton>
244244
</form>
245245
);
@@ -270,11 +270,11 @@ export default class SoftLogout extends React.Component<IProps, IState> {
270270
}
271271

272272
if (this.state.loginView === LoginView.Password) {
273-
return this.renderPasswordForm(_t("Enter your password to sign in and regain access to your account."));
273+
return this.renderPasswordForm(_t("auth|soft_logout_intro_password"));
274274
}
275275

276276
if (this.state.loginView === LoginView.SSO || this.state.loginView === LoginView.CAS) {
277-
return this.renderSsoForm(_t("Sign in and regain access to your account."));
277+
return this.renderSsoForm(_t("auth|soft_logout_intro_sso"));
278278
}
279279

280280
if (this.state.loginView === LoginView.PasswordWithSocialSignOn) {
@@ -284,7 +284,7 @@ export default class SoftLogout extends React.Component<IProps, IState> {
284284
// Note: "mx_AuthBody_centered" text taken from registration page.
285285
return (
286286
<>
287-
<p>{_t("Sign in and regain access to your account.")}</p>
287+
<p>{_t("auth|soft_logout_intro_sso")}</p>
288288
{this.renderSsoForm(null)}
289289
<h2 className="mx_AuthBody_centered">
290290
{_t("auth|sso_or_username_password", {
@@ -298,19 +298,15 @@ export default class SoftLogout extends React.Component<IProps, IState> {
298298
}
299299

300300
// Default: assume unsupported/error
301-
return (
302-
<p>
303-
{_t("You cannot sign in to your account. Please contact your homeserver admin for more information.")}
304-
</p>
305-
);
301+
return <p>{_t("auth|soft_logout_intro_unsupported_auth")}</p>;
306302
}
307303

308304
public render(): React.ReactNode {
309305
return (
310306
<AuthPage>
311307
<AuthHeader />
312308
<AuthBody>
313-
<h1>{_t("You're signed out")}</h1>
309+
<h1>{_t("auth|soft_logout_heading")}</h1>
314310

315311
<h2>{_t("action|sign_in")}</h2>
316312
<div>{this.renderSignInSection()}</div>

src/components/structures/auth/forgot-password/CheckEmail.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,18 @@ export const CheckEmail: React.FC<CheckEmailProps> = ({
5555
<EMailPromptIcon className="mx_AuthBody_emailPromptIcon--shifted" />
5656
<h1>{_t("Check your email to continue")}</h1>
5757
<div className="mx_AuthBody_text">
58-
<p>
59-
{_t("Follow the instructions sent to <b>%(email)s</b>", { email: email }, { b: (t) => <b>{t}</b> })}
60-
</p>
58+
<p>{_t("auth|check_email_explainer", { email: email }, { b: (t) => <b>{t}</b> })}</p>
6159
<div className="mx_AuthBody_did-not-receive">
62-
<span className="mx_VerifyEMailDialog_text-light">{_t("Wrong email address?")}</span>
60+
<span className="mx_VerifyEMailDialog_text-light">{_t("auth|check_email_wrong_email_prompt")}</span>
6361
<AccessibleButton className="mx_AuthBody_resend-button" kind="link" onClick={onReEnterEmailClick}>
64-
{_t("Re-enter email address")}
62+
{_t("auth|check_email_wrong_email_button")}
6563
</AccessibleButton>
6664
</div>
6765
</div>
6866
{errorText && <ErrorMessage message={errorText} />}
6967
<input onClick={onSubmitForm} type="button" className="mx_Login_submit" value={_t("action|next")} />
7068
<div className="mx_AuthBody_did-not-receive">
71-
<span className="mx_VerifyEMailDialog_text-light">{_t("Did not receive it?")}</span>
69+
<span className="mx_VerifyEMailDialog_text-light">{_t("auth|check_email_resend_prompt")}</span>
7270
<AccessibleButton
7371
className="mx_AuthBody_resend-button"
7472
kind="link"
@@ -79,7 +77,7 @@ export const CheckEmail: React.FC<CheckEmailProps> = ({
7977
{_t("action|resend")}
8078
<Tooltip
8179
id={tooltipId}
82-
label={_t("Verification link email resent!")}
80+
label={_t("auth|check_email_resend_tooltip")}
8381
alignment={Alignment.Top}
8482
visible={tooltipVisible}
8583
/>

src/components/structures/auth/forgot-password/EnterEmail.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,18 @@ export const EnterEmail: React.FC<EnterEmailProps> = ({
6363
return (
6464
<>
6565
<EmailIcon className="mx_AuthBody_icon" />
66-
<h1>{_t("Enter your email to reset password")}</h1>
66+
<h1>{_t("auth|enter_email_heading")}</h1>
6767
<p className="mx_AuthBody_text">
68-
{_t(
69-
"<b>%(homeserver)s</b> will send you a verification link to let you reset your password.",
70-
{ homeserver },
71-
{ b: (t) => <b>{t}</b> },
72-
)}
68+
{_t("auth|enter_email_explainer", { homeserver }, { b: (t) => <b>{t}</b> })}
7369
</p>
7470
<form onSubmit={onSubmit}>
7571
<fieldset disabled={loading}>
7672
<div className="mx_AuthBody_fieldRow">
7773
<EmailField
7874
name="reset_email" // define a name so browser's password autofill gets less confused
7975
label="Email address"
80-
labelRequired={_td("The email address linked to your account must be entered.")}
81-
labelInvalid={_td("The email address doesn't appear to be valid.")}
76+
labelRequired={_td("auth|forgot_password_email_required")}
77+
labelInvalid={_td("auth|forgot_password_email_invalid")}
8278
value={email}
8379
autoFocus={true}
8480
onChange={(event: React.FormEvent<HTMLInputElement>) => onInputChanged("email", event)}
@@ -99,7 +95,7 @@ export const EnterEmail: React.FC<EnterEmailProps> = ({
9995
onLoginClick();
10096
}}
10197
>
102-
{_t("Sign in instead")}
98+
{_t("auth|sign_in_instead")}
10399
</AccessibleButton>
104100
</div>
105101
</fieldset>

src/components/structures/auth/forgot-password/VerifyEmailModal.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ export const VerifyEmailModal: React.FC<Props> = ({
5151
return (
5252
<>
5353
<EmailPromptIcon className="mx_AuthBody_emailPromptIcon" />
54-
<h1>{_t("Verify your email to continue")}</h1>
54+
<h1>{_t("auth|verify_email_heading")}</h1>
5555
<p>
5656
{_t(
57-
"We need to know it’s you before resetting your password. Click the link in the email we just sent to <b>%(email)s</b>",
57+
"auth|verify_email_explainer",
5858
{
5959
email,
6060
},
@@ -65,7 +65,7 @@ export const VerifyEmailModal: React.FC<Props> = ({
6565
</p>
6666

6767
<div className="mx_AuthBody_did-not-receive">
68-
<span className="mx_VerifyEMailDialog_text-light">{_t("Did not receive it?")}</span>
68+
<span className="mx_VerifyEMailDialog_text-light">{_t("auth|check_email_resend_prompt")}</span>
6969
<AccessibleButton
7070
className="mx_AuthBody_resend-button"
7171
kind="link"
@@ -76,7 +76,7 @@ export const VerifyEmailModal: React.FC<Props> = ({
7676
{_t("action|resend")}
7777
<Tooltip
7878
id={tooltipId}
79-
label={_t("Verification link email resent!")}
79+
label={_t("auth|check_email_resend_tooltip")}
8080
alignment={Alignment.Top}
8181
visible={tooltipVisible}
8282
/>
@@ -85,9 +85,9 @@ export const VerifyEmailModal: React.FC<Props> = ({
8585
</div>
8686

8787
<div className="mx_AuthBody_did-not-receive">
88-
<span className="mx_VerifyEMailDialog_text-light">{_t("Wrong email address?")}</span>
88+
<span className="mx_VerifyEMailDialog_text-light">{_t("auth|check_email_wrong_email_prompt")}</span>
8989
<AccessibleButton className="mx_AuthBody_resend-button" kind="link" onClick={onReEnterEmailClick}>
90-
{_t("Re-enter email address")}
90+
{_t("auth|check_email_wrong_email_button")}
9191
</AccessibleButton>
9292
</div>
9393

src/components/views/beta/BetaCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const BetaCard: React.FC<IProps> = ({ title: titleOverride, featureId }) => {
8686
}}
8787
kind="primary"
8888
>
89-
{_t("Feedback")}
89+
{_t("common|feedback")}
9090
</AccessibleButton>
9191
);
9292
}

0 commit comments

Comments
 (0)