Migrate more strings to translation keys (#11608)

This commit is contained in:
Michael Telatynski 2023-09-19 07:17:31 +01:00 committed by GitHub
parent 46072caa3a
commit e9c9377e78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
78 changed files with 2402 additions and 2411 deletions

View file

@ -295,7 +295,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
topSection = (
<div className="mx_UserMenu_contextMenu_header mx_UserMenu_contextMenu_guestPrompts">
{_t(
"Got an account? <a>Sign in</a>",
"auth|sign_in_prompt",
{},
{
a: (sub) => (
@ -307,7 +307,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
)}
{SettingsStore.getValue(UIFeature.Registration)
? _t(
"New here? <a>Create an account</a>",
"auth|create_account_prompt",
{},
{
a: (sub) => (
@ -338,7 +338,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
feedbackButton = (
<IconizedContextMenuOption
iconClassName="mx_UserMenu_iconMessage"
label={_t("Feedback")}
label={_t("common|feedback")}
onClick={this.onProvideFeedback}
/>
);

View file

@ -224,7 +224,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
let errorText: ReactNode;
// Some error strings only apply for logging in
if (error.httpStatus === 400 && username && username.indexOf("@") > 0) {
errorText = _t("This homeserver does not support login using email address.");
errorText = _t("auth|unsupported_auth_email");
} else {
errorText = messageForLoginError(error, this.props.serverConfig);
}
@ -273,7 +273,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
} catch (e) {
logger.error("Problem parsing URL or unhandled error doing .well-known discovery:", e);
let message = _t("Failed to perform homeserver discovery");
let message = _t("auth|failed_homeserver_discovery");
if (e instanceof UserFriendlyError && e.translatedMessage) {
message = e.translatedMessage;
}
@ -398,9 +398,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
if (supportedFlows.length === 0) {
this.setState({
errorText: _t(
"This homeserver doesn't offer any login flows that are supported by this client.",
),
errorText: _t("auth|unsupported_auth"),
});
}
},
@ -532,12 +530,10 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
<div className="mx_AuthBody_paddedFooter">
<div className="mx_AuthBody_paddedFooter_title">
<InlineSpinner w={20} h={20} />
{this.props.isSyncing ? _t("Syncing…") : _t("Signing In…")}
{this.props.isSyncing ? _t("auth|syncing") : _t("auth|signing_in")}
</div>
{this.props.isSyncing && (
<div className="mx_AuthBody_paddedFooter_subtitle">
{_t("If you've joined lots of rooms, this might take a while")}
</div>
<div className="mx_AuthBody_paddedFooter_subtitle">{_t("auth|sync_footer_subtitle")}</div>
)}
</div>
);
@ -545,7 +541,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
footer = (
<span className="mx_AuthBody_changeFlow">
{_t(
"New? <a>Create account</a>",
"auth|create_account_prompt",
{},
{
a: (sub) => (

View file

@ -263,7 +263,7 @@ export default class Registration extends React.Component<IProps, IState> {
} else {
this.setState({
serverErrorIsFatal: true, // fatal because user cannot continue on this server
errorText: _t("Registration has been disabled on this homeserver."),
errorText: _t("auth|registration_disabled"),
// add empty flows array to get rid of spinner
flows: [],
});
@ -271,7 +271,7 @@ export default class Registration extends React.Component<IProps, IState> {
} else {
logger.log("Unable to query for supported registration methods.", e);
this.setState({
errorText: _t("Unable to query for supported registration methods."),
errorText: _t("auth|failed_query_registration_methods"),
// add empty flows array to get rid of spinner
flows: [],
});
@ -326,12 +326,12 @@ export default class Registration extends React.Component<IProps, IState> {
const flows = (response as IAuthData).flows ?? [];
const msisdnAvailable = flows.some((flow) => flow.stages.includes(AuthType.Msisdn));
if (!msisdnAvailable) {
errorText = _t("This server does not support authentication with a phone number.");
errorText = _t("auth|unsupported_auth_msisdn");
}
} else if (response instanceof MatrixError && response.errcode === "M_USER_IN_USE") {
errorText = _t("Someone already has that username, please try another.");
errorText = _t("auth|username_in_use");
} else if (response instanceof MatrixError && response.errcode === "M_THREEPID_IN_USE") {
errorText = _t("That e-mail address or phone number is already in use.");
errorText = _t("auth|3pid_in_use");
}
this.setState({

View file

@ -161,7 +161,7 @@ export default class SoftLogout extends React.Component<IProps, IState> {
e.errcode === "M_FORBIDDEN" &&
(e.httpStatus === 401 || e.httpStatus === 403)
) {
errorText = _t("Incorrect password");
errorText = _t("auth|incorrect_password");
}
this.setState({
@ -173,7 +173,7 @@ export default class SoftLogout extends React.Component<IProps, IState> {
Lifecycle.hydrateSession(credentials).catch((e) => {
logger.error(e);
this.setState({ busy: false, errorText: _t("Failed to re-authenticate") });
this.setState({ busy: false, errorText: _t("auth|failed_soft_logout_auth") });
});
};
@ -239,7 +239,7 @@ export default class SoftLogout extends React.Component<IProps, IState> {
{_t("action|sign_in")}
</AccessibleButton>
<AccessibleButton onClick={this.onForgotPassword} kind="link">
{_t("Forgotten your password?")}
{_t("auth|forgot_password_prompt")}
</AccessibleButton>
</form>
);
@ -270,11 +270,11 @@ export default class SoftLogout extends React.Component<IProps, IState> {
}
if (this.state.loginView === LoginView.Password) {
return this.renderPasswordForm(_t("Enter your password to sign in and regain access to your account."));
return this.renderPasswordForm(_t("auth|soft_logout_intro_password"));
}
if (this.state.loginView === LoginView.SSO || this.state.loginView === LoginView.CAS) {
return this.renderSsoForm(_t("Sign in and regain access to your account."));
return this.renderSsoForm(_t("auth|soft_logout_intro_sso"));
}
if (this.state.loginView === LoginView.PasswordWithSocialSignOn) {
@ -284,7 +284,7 @@ export default class SoftLogout extends React.Component<IProps, IState> {
// Note: "mx_AuthBody_centered" text taken from registration page.
return (
<>
<p>{_t("Sign in and regain access to your account.")}</p>
<p>{_t("auth|soft_logout_intro_sso")}</p>
{this.renderSsoForm(null)}
<h2 className="mx_AuthBody_centered">
{_t("auth|sso_or_username_password", {
@ -298,11 +298,7 @@ export default class SoftLogout extends React.Component<IProps, IState> {
}
// Default: assume unsupported/error
return (
<p>
{_t("You cannot sign in to your account. Please contact your homeserver admin for more information.")}
</p>
);
return <p>{_t("auth|soft_logout_intro_unsupported_auth")}</p>;
}
public render(): React.ReactNode {
@ -310,7 +306,7 @@ export default class SoftLogout extends React.Component<IProps, IState> {
<AuthPage>
<AuthHeader />
<AuthBody>
<h1>{_t("You're signed out")}</h1>
<h1>{_t("auth|soft_logout_heading")}</h1>
<h2>{_t("action|sign_in")}</h2>
<div>{this.renderSignInSection()}</div>

View file

@ -55,20 +55,18 @@ export const CheckEmail: React.FC<CheckEmailProps> = ({
<EMailPromptIcon className="mx_AuthBody_emailPromptIcon--shifted" />
<h1>{_t("Check your email to continue")}</h1>
<div className="mx_AuthBody_text">
<p>
{_t("Follow the instructions sent to <b>%(email)s</b>", { email: email }, { b: (t) => <b>{t}</b> })}
</p>
<p>{_t("auth|check_email_explainer", { email: email }, { b: (t) => <b>{t}</b> })}</p>
<div className="mx_AuthBody_did-not-receive">
<span className="mx_VerifyEMailDialog_text-light">{_t("Wrong email address?")}</span>
<span className="mx_VerifyEMailDialog_text-light">{_t("auth|check_email_wrong_email_prompt")}</span>
<AccessibleButton className="mx_AuthBody_resend-button" kind="link" onClick={onReEnterEmailClick}>
{_t("Re-enter email address")}
{_t("auth|check_email_wrong_email_button")}
</AccessibleButton>
</div>
</div>
{errorText && <ErrorMessage message={errorText} />}
<input onClick={onSubmitForm} type="button" className="mx_Login_submit" value={_t("action|next")} />
<div className="mx_AuthBody_did-not-receive">
<span className="mx_VerifyEMailDialog_text-light">{_t("Did not receive it?")}</span>
<span className="mx_VerifyEMailDialog_text-light">{_t("auth|check_email_resend_prompt")}</span>
<AccessibleButton
className="mx_AuthBody_resend-button"
kind="link"
@ -79,7 +77,7 @@ export const CheckEmail: React.FC<CheckEmailProps> = ({
{_t("action|resend")}
<Tooltip
id={tooltipId}
label={_t("Verification link email resent!")}
label={_t("auth|check_email_resend_tooltip")}
alignment={Alignment.Top}
visible={tooltipVisible}
/>

View file

@ -63,13 +63,9 @@ export const EnterEmail: React.FC<EnterEmailProps> = ({
return (
<>
<EmailIcon className="mx_AuthBody_icon" />
<h1>{_t("Enter your email to reset password")}</h1>
<h1>{_t("auth|enter_email_heading")}</h1>
<p className="mx_AuthBody_text">
{_t(
"<b>%(homeserver)s</b> will send you a verification link to let you reset your password.",
{ homeserver },
{ b: (t) => <b>{t}</b> },
)}
{_t("auth|enter_email_explainer", { homeserver }, { b: (t) => <b>{t}</b> })}
</p>
<form onSubmit={onSubmit}>
<fieldset disabled={loading}>
@ -77,8 +73,8 @@ export const EnterEmail: React.FC<EnterEmailProps> = ({
<EmailField
name="reset_email" // define a name so browser's password autofill gets less confused
label="Email address"
labelRequired={_td("The email address linked to your account must be entered.")}
labelInvalid={_td("The email address doesn't appear to be valid.")}
labelRequired={_td("auth|forgot_password_email_required")}
labelInvalid={_td("auth|forgot_password_email_invalid")}
value={email}
autoFocus={true}
onChange={(event: React.FormEvent<HTMLInputElement>) => onInputChanged("email", event)}
@ -99,7 +95,7 @@ export const EnterEmail: React.FC<EnterEmailProps> = ({
onLoginClick();
}}
>
{_t("Sign in instead")}
{_t("auth|sign_in_instead")}
</AccessibleButton>
</div>
</fieldset>

View file

@ -51,10 +51,10 @@ export const VerifyEmailModal: React.FC<Props> = ({
return (
<>
<EmailPromptIcon className="mx_AuthBody_emailPromptIcon" />
<h1>{_t("Verify your email to continue")}</h1>
<h1>{_t("auth|verify_email_heading")}</h1>
<p>
{_t(
"We need to know its you before resetting your password. Click the link in the email we just sent to <b>%(email)s</b>",
"auth|verify_email_explainer",
{
email,
},
@ -65,7 +65,7 @@ export const VerifyEmailModal: React.FC<Props> = ({
</p>
<div className="mx_AuthBody_did-not-receive">
<span className="mx_VerifyEMailDialog_text-light">{_t("Did not receive it?")}</span>
<span className="mx_VerifyEMailDialog_text-light">{_t("auth|check_email_resend_prompt")}</span>
<AccessibleButton
className="mx_AuthBody_resend-button"
kind="link"
@ -76,7 +76,7 @@ export const VerifyEmailModal: React.FC<Props> = ({
{_t("action|resend")}
<Tooltip
id={tooltipId}
label={_t("Verification link email resent!")}
label={_t("auth|check_email_resend_tooltip")}
alignment={Alignment.Top}
visible={tooltipVisible}
/>
@ -85,9 +85,9 @@ export const VerifyEmailModal: React.FC<Props> = ({
</div>
<div className="mx_AuthBody_did-not-receive">
<span className="mx_VerifyEMailDialog_text-light">{_t("Wrong email address?")}</span>
<span className="mx_VerifyEMailDialog_text-light">{_t("auth|check_email_wrong_email_prompt")}</span>
<AccessibleButton className="mx_AuthBody_resend-button" kind="link" onClick={onReEnterEmailClick}>
{_t("Re-enter email address")}
{_t("auth|check_email_wrong_email_button")}
</AccessibleButton>
</div>

View file

@ -86,7 +86,7 @@ const BetaCard: React.FC<IProps> = ({ title: titleOverride, featureId }) => {
}}
kind="primary"
>
{_t("Feedback")}
{_t("common|feedback")}
</AccessibleButton>
);
}

View file

@ -56,7 +56,7 @@ const FeedbackDialog: React.FC<IProps> = (props: IProps) => {
submitFeedback(label, comment, canContact);
Modal.createDialog(InfoDialog, {
title: _t("Feedback sent"),
title: _t("feedback|sent"),
description: _t("Thank you!"),
});
}
@ -67,13 +67,13 @@ const FeedbackDialog: React.FC<IProps> = (props: IProps) => {
if (hasFeedback) {
feedbackSection = (
<div className="mx_FeedbackDialog_section mx_FeedbackDialog_rateApp">
<h3>{_t("Comment")}</h3>
<h3>{_t("feedback|comment_label")}</h3>
<p>{_t("Your platform and username will be noted to help us use your feedback as much as we can.")}</p>
<p>{_t("feedback|platform_username")}</p>
<Field
id="feedbackComment"
label={_t("Feedback")}
label={_t("common|feedback")}
type="text"
autoComplete="off"
value={comment}
@ -85,7 +85,7 @@ const FeedbackDialog: React.FC<IProps> = (props: IProps) => {
/>
<StyledCheckbox checked={canContact} onChange={toggleCanContact}>
{_t("You may contact me if you want to follow up or to let me test out upcoming ideas")}
{_t("feedback|may_contact_label")}
</StyledCheckbox>
</div>
);
@ -96,7 +96,7 @@ const FeedbackDialog: React.FC<IProps> = (props: IProps) => {
bugReports = (
<p className="mx_FeedbackDialog_section_microcopy">
{_t(
"PRO TIP: If you start a bug, please submit <debugLogsLink>debug logs</debugLogsLink> to help us track down the problem.",
"feedback|pro_type",
{},
{
debugLogsLink: (sub) => (
@ -117,14 +117,14 @@ const FeedbackDialog: React.FC<IProps> = (props: IProps) => {
<QuestionDialog
className="mx_FeedbackDialog"
hasCancelButton={hasFeedback}
title={_t("Feedback")}
title={_t("common|feedback")}
description={
<React.Fragment>
<div className="mx_FeedbackDialog_section mx_FeedbackDialog_reportBug">
<h3>{_t("common|report_a_bug")}</h3>
<p>
{_t(
"Please view <existingIssuesLink>existing bugs on Github</existingIssuesLink> first. No match? <newIssueLink>Start a new one</newIssueLink>.",
"feedback|existing_issue_link",
{},
{
existingIssuesLink: (sub) => {
@ -153,7 +153,7 @@ const FeedbackDialog: React.FC<IProps> = (props: IProps) => {
{feedbackSection}
</React.Fragment>
}
button={hasFeedback ? _t("Send feedback") : _t("action|go_back")}
button={hasFeedback ? _t("feedback|send_feedback_action") : _t("action|go_back")}
buttonDisabled={hasFeedback && !comment}
onFinished={onFinished}
/>

View file

@ -69,14 +69,14 @@ const GenericFeatureFeedbackDialog: React.FC<IProps> = ({
<div className="mx_GenericFeatureFeedbackDialog_subheading">
{subheading}
&nbsp;
{_t("Your platform and username will be noted to help us use your feedback as much as we can.")}
{_t("feedback|platform_username")}
&nbsp;
{children}
</div>
<Field
id="feedbackComment"
label={_t("Feedback")}
label={_t("common|feedback")}
type="text"
autoComplete="off"
value={comment}
@ -95,7 +95,7 @@ const GenericFeatureFeedbackDialog: React.FC<IProps> = ({
</StyledCheckbox>
</React.Fragment>
}
button={_t("Send feedback")}
button={_t("feedback|send_feedback_action")}
buttonDisabled={!comment}
onFinished={sendFeedback}
/>

View file

@ -112,7 +112,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
const stateForError = AutoDiscoveryUtils.authComponentStateForError(e);
if (stateForError.serverErrorIsFatal) {
let error = _t("Unable to validate homeserver");
let error = _t("auth|server_picker_failed_validate_homeserver");
if (e instanceof UserFriendlyError && e.translatedMessage) {
error = e.translatedMessage;
}
@ -129,7 +129,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
return {};
} catch (e) {
logger.error(e);
return { error: _t("Invalid URL") };
return { error: _t("auth|server_picker_invalid_url") };
}
}
},
@ -137,7 +137,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
{
key: "required",
test: ({ value, allowEmpty }) => allowEmpty || !!value,
invalid: () => _t("Specify a homeserver"),
invalid: () => _t("auth|server_picker_required"),
},
{
key: "valid",
@ -176,7 +176,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
public render(): React.ReactNode {
let text: string | undefined;
if (this.defaultServer.hsName === "matrix.org") {
text = _t("Matrix.org is the biggest public homeserver in the world, so it's a good place for many.");
text = _t("auth|server_picker_matrix.org");
}
let defaultServerName: React.ReactNode = this.defaultServer.hsName;
@ -190,7 +190,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
return (
<BaseDialog
title={this.props.title || _t("Sign into your homeserver")}
title={this.props.title || _t("auth|server_picker_title")}
className="mx_ServerPickerDialog"
contentId="mx_ServerPickerDialog"
onFinished={this.props.onFinished}
@ -199,7 +199,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
>
<form className="mx_Dialog_content" id="mx_ServerPickerDialog" onSubmit={this.onSubmit}>
<p>
{_t("We call the places where you can host your account 'homeservers'.")} {text}
{_t("auth|server_picker_intro")} {text}
</p>
<StyledRadioButton
@ -219,12 +219,12 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
checked={!this.state.defaultChosen}
onChange={this.onOtherChosen}
childrenInLabel={false}
aria-label={_t("Other homeserver")}
aria-label={_t("auth|server_picker_custom")}
>
<Field
type="text"
className="mx_ServerPickerDialog_otherHomeserver"
label={_t("Other homeserver")}
label={_t("auth|server_picker_custom")}
onChange={this.onHomeserverChange}
onFocus={this.onOtherChosen}
ref={this.fieldRef}
@ -236,7 +236,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
id="mx_homeserverInput"
/>
</StyledRadioButton>
<p>{_t("Use your preferred Matrix homeserver if you have one, or host your own.")}</p>
<p>{_t("auth|server_picker_explainer")}</p>
<AccessibleButton className="mx_ServerPickerDialog_continue" kind="primary" onClick={this.onSubmit}>
{_t("action|continue")}
@ -248,7 +248,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
target="_blank"
rel="noreferrer noopener"
>
{_t("About homeservers")}
{_t("auth|server_picker_learn_more")}
</ExternalLink>
</form>
</BaseDialog>