Migrate more strings to translation keys (#11671)
This commit is contained in:
parent
13aed62a91
commit
4d0d024e86
125 changed files with 7066 additions and 6607 deletions
|
@ -47,7 +47,7 @@ const REACHABILITY_TIMEOUT = 10000; // ms
|
|||
async function checkIdentityServerUrl(u: string): Promise<string | null> {
|
||||
const parsedUrl = parseUrl(u);
|
||||
|
||||
if (parsedUrl.protocol !== "https:") return _t("Identity server URL must be HTTPS");
|
||||
if (parsedUrl.protocol !== "https:") return _t("identity_server|url_not_https");
|
||||
|
||||
// XXX: duplicated logic from js-sdk but it's quite tied up in the validation logic in the
|
||||
// js-sdk so probably as easy to duplicate it than to separate it out so we can reuse it
|
||||
|
@ -56,12 +56,12 @@ async function checkIdentityServerUrl(u: string): Promise<string | null> {
|
|||
if (response.ok) {
|
||||
return null;
|
||||
} else if (response.status < 200 || response.status >= 300) {
|
||||
return _t("Not a valid identity server (status code %(code)s)", { code: response.status });
|
||||
return _t("identity_server|error_invalid", { code: response.status });
|
||||
} else {
|
||||
return _t("Could not connect to identity server");
|
||||
return _t("identity_server|error_connection");
|
||||
}
|
||||
} catch (e) {
|
||||
return _t("Could not connect to identity server");
|
||||
return _t("identity_server|error_connection");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ export default class SetIdServer extends React.Component<IProps, IState> {
|
|||
return (
|
||||
<div>
|
||||
<InlineSpinner />
|
||||
{_t("Checking server")}
|
||||
{_t("identity_server|checking")}
|
||||
</div>
|
||||
);
|
||||
} else if (this.state.error) {
|
||||
|
@ -191,9 +191,9 @@ export default class SetIdServer extends React.Component<IProps, IState> {
|
|||
// 3PIDs that would be left behind.
|
||||
if (save && currentClientIdServer && fullUrl !== currentClientIdServer) {
|
||||
const [confirmed] = await this.showServerChangeWarning({
|
||||
title: _t("Change identity server"),
|
||||
title: _t("identity_server|change"),
|
||||
unboundMessage: _t(
|
||||
"Disconnect from the identity server <current /> and connect to <new /> instead?",
|
||||
"identity_server|change_prompt",
|
||||
{},
|
||||
{
|
||||
current: (sub) => <b>{abbreviateUrl(currentClientIdServer)}</b>,
|
||||
|
@ -210,7 +210,7 @@ export default class SetIdServer extends React.Component<IProps, IState> {
|
|||
}
|
||||
} catch (e) {
|
||||
logger.error(e);
|
||||
errStr = _t("Terms of service not accepted or the identity server is invalid.");
|
||||
errStr = _t("identity_server|error_invalid_or_terms");
|
||||
}
|
||||
}
|
||||
this.setState({
|
||||
|
@ -226,9 +226,7 @@ export default class SetIdServer extends React.Component<IProps, IState> {
|
|||
title: _t("terms|identity_server_no_terms_title"),
|
||||
description: (
|
||||
<div>
|
||||
<span className="warning">
|
||||
{_t("The identity server you have chosen does not have any terms of service.")}
|
||||
</span>
|
||||
<span className="warning">{_t("identity_server|no_terms")}</span>
|
||||
<span> {_t("terms|identity_server_no_terms_description_2")}</span>
|
||||
</div>
|
||||
),
|
||||
|
@ -241,9 +239,9 @@ export default class SetIdServer extends React.Component<IProps, IState> {
|
|||
this.setState({ disconnectBusy: true });
|
||||
try {
|
||||
const [confirmed] = await this.showServerChangeWarning({
|
||||
title: _t("Disconnect identity server"),
|
||||
title: _t("identity_server|disconnect"),
|
||||
unboundMessage: _t(
|
||||
"Disconnect from the identity server <idserver />?",
|
||||
"identity_server|disconnect_server",
|
||||
{},
|
||||
{ idserver: (sub) => <b>{abbreviateUrl(this.state.currentClientIdServer)}</b> },
|
||||
),
|
||||
|
@ -294,54 +292,34 @@ export default class SetIdServer extends React.Component<IProps, IState> {
|
|||
if (!currentServerReachable) {
|
||||
message = (
|
||||
<div>
|
||||
<p>
|
||||
{_t(
|
||||
"You should <b>remove your personal data</b> from identity server <idserver /> before disconnecting. Unfortunately, identity server <idserver /> is currently offline or cannot be reached.",
|
||||
{},
|
||||
messageElements,
|
||||
)}
|
||||
</p>
|
||||
<p>{_t("You should:")}</p>
|
||||
<p>{_t("identity_server|disconnect_offline_warning", {}, messageElements)}</p>
|
||||
<p>{_t("identity_server|suggestions")}</p>
|
||||
<ul>
|
||||
<li>{_t("identity_server|suggestions_1")}</li>
|
||||
<li>
|
||||
{_t(
|
||||
"check your browser plugins for anything that might block the identity server (such as Privacy Badger)",
|
||||
)}
|
||||
</li>
|
||||
<li>
|
||||
{_t(
|
||||
"contact the administrators of identity server <idserver />",
|
||||
"identity_server|suggestions_2",
|
||||
{},
|
||||
{
|
||||
idserver: messageElements.idserver,
|
||||
},
|
||||
)}
|
||||
</li>
|
||||
<li>{_t("wait and try again later")}</li>
|
||||
<li>{_t("identity_server|suggestions_3")}</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
danger = true;
|
||||
button = _t("Disconnect anyway");
|
||||
button = _t("identity_server|disconnect_anyway");
|
||||
} else if (boundThreepids.length) {
|
||||
message = (
|
||||
<div>
|
||||
<p>
|
||||
{_t(
|
||||
"You are still <b>sharing your personal data</b> on the identity server <idserver />.",
|
||||
{},
|
||||
messageElements,
|
||||
)}
|
||||
</p>
|
||||
<p>
|
||||
{_t(
|
||||
"We recommend that you remove your email addresses and phone numbers from the identity server before disconnecting.",
|
||||
)}
|
||||
</p>
|
||||
<p>{_t("identity_server|disconnect_personal_data_warning_1", {}, messageElements)}</p>
|
||||
<p>{_t("identity_server|disconnect_personal_data_warning_2")}</p>
|
||||
</div>
|
||||
);
|
||||
danger = true;
|
||||
button = _t("Disconnect anyway");
|
||||
button = _t("identity_server|disconnect_anyway");
|
||||
} else {
|
||||
message = unboundMessage;
|
||||
}
|
||||
|
@ -382,37 +360,31 @@ export default class SetIdServer extends React.Component<IProps, IState> {
|
|||
let sectionTitle;
|
||||
let bodyText;
|
||||
if (idServerUrl) {
|
||||
sectionTitle = _t("Identity server (%(server)s)", { server: abbreviateUrl(idServerUrl) });
|
||||
sectionTitle = _t("identity_server|url", { server: abbreviateUrl(idServerUrl) });
|
||||
bodyText = _t(
|
||||
"You are currently using <server></server> to discover and be discoverable by existing contacts you know. You can change your identity server below.",
|
||||
"identity_server|description_connected",
|
||||
{},
|
||||
{ server: (sub) => <b>{abbreviateUrl(idServerUrl)}</b> },
|
||||
);
|
||||
if (this.props.missingTerms) {
|
||||
bodyText = _t(
|
||||
"If you don't want to use <server /> to discover and be discoverable by existing contacts you know, enter another identity server below.",
|
||||
"identity_server|change_server_prompt",
|
||||
{},
|
||||
{ server: (sub) => <b>{abbreviateUrl(idServerUrl)}</b> },
|
||||
);
|
||||
}
|
||||
} else {
|
||||
sectionTitle = _t("common|identity_server");
|
||||
bodyText = _t(
|
||||
"You are not currently using an identity server. To discover and be discoverable by existing contacts you know, add one below.",
|
||||
);
|
||||
bodyText = _t("identity_server|description_disconnected");
|
||||
}
|
||||
|
||||
let discoSection;
|
||||
if (idServerUrl) {
|
||||
let discoButtonContent: React.ReactNode = _t("action|disconnect");
|
||||
let discoBodyText = _t(
|
||||
"Disconnecting from your identity server will mean you won't be discoverable by other users and you won't be able to invite others by email or phone.",
|
||||
);
|
||||
let discoBodyText = _t("identity_server|disconnect_warning");
|
||||
if (this.props.missingTerms) {
|
||||
discoBodyText = _t(
|
||||
"Using an identity server is optional. If you choose not to use an identity server, you won't be discoverable by other users and you won't be able to invite others by email or phone.",
|
||||
);
|
||||
discoButtonContent = _t("Do not use an identity server");
|
||||
discoBodyText = _t("identity_server|description_optional");
|
||||
discoButtonContent = _t("identity_server|do_not_use");
|
||||
}
|
||||
if (this.state.disconnectBusy) {
|
||||
discoButtonContent = <InlineSpinner />;
|
||||
|
@ -431,7 +403,7 @@ export default class SetIdServer extends React.Component<IProps, IState> {
|
|||
<SettingsFieldset legend={sectionTitle} description={bodyText}>
|
||||
<form className="mx_SetIdServer" onSubmit={this.checkIdServer}>
|
||||
<Field
|
||||
label={_t("Enter a new identity server")}
|
||||
label={_t("identity_server|url_field_label")}
|
||||
type="text"
|
||||
autoComplete="off"
|
||||
placeholder={this.state.defaultIdServer}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue