Migrate more strings to translation keys (#11651)

This commit is contained in:
Michael Telatynski 2023-09-22 16:39:40 +01:00 committed by GitHub
parent 560449676b
commit f4d056fd38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
127 changed files with 8916 additions and 8272 deletions

View file

@ -17,19 +17,19 @@ limitations under the License.
import React, { ReactNode } from "react";
import { MatrixError, ConnectionError } from "matrix-js-sdk/src/matrix";
import { _t, _td, Tags, TranslatedString, TranslationKey } from "../languageHandler";
import { _t, _td, lookupString, Tags, TranslatedString, TranslationKey } from "../languageHandler";
import SdkConfig from "../SdkConfig";
import { ValidatedServerConfig } from "./ValidatedServerConfig";
import ExternalLink from "../components/views/elements/ExternalLink";
export const resourceLimitStrings = {
"monthly_active_user": _td("This homeserver has hit its Monthly Active User limit."),
"hs_blocked": _td("This homeserver has been blocked by its administrator."),
"": _td("This homeserver has exceeded one of its resource limits."),
"monthly_active_user": _td("error|mau"),
"hs_blocked": _td("error|hs_blocked"),
"": _td("error|resource_limits"),
};
export const adminContactStrings = {
"": _td("Please <a>contact your service administrator</a> to continue using this service."),
"": _td("error|admin_contact"),
};
/**
@ -67,7 +67,7 @@ export function messageForResourceLimitError(
}
};
if (errString.includes("<a>")) {
if (lookupString(errString).includes("<a>")) {
return _t(errString, {}, Object.assign({ a: linkSub }, extraTranslations));
} else {
return _t(errString, {}, extraTranslations!);
@ -93,7 +93,7 @@ export function messageForSyncError(err: Error): ReactNode {
</div>
);
} else {
return <div>{_t("Unable to connect to Homeserver. Retrying…")}</div>;
return <div>{_t("error|sync")}</div>;
}
}
@ -126,7 +126,7 @@ export function messageForLoginError(
<div>
<div>{_t("auth|incorrect_credentials")}</div>
<div className="mx_Login_smallError">
{_t("Please note you are logging into the %(hs)s server, not matrix.org.", {
{_t("auth|incorrect_credentials_detail", {
hs: serverConfig.hsName,
})}
</div>
@ -144,7 +144,7 @@ export function messageForConnectionError(
err: Error,
serverConfig: Pick<ValidatedServerConfig, "hsName" | "hsUrl">,
): ReactNode {
let errorText = _t("There was a problem communicating with the homeserver, please try again later.");
let errorText = _t("error|connection");
if (err instanceof ConnectionError) {
if (
@ -154,7 +154,7 @@ export function messageForConnectionError(
return (
<span>
{_t(
"Can't connect to homeserver via HTTP when an HTTPS URL is in your browser bar. Either use HTTPS or <a>enable unsafe scripts</a>.",
"error|mixed_content",
{},
{
a: (sub) => {
@ -177,7 +177,7 @@ export function messageForConnectionError(
return (
<span>
{_t(
"Can't connect to homeserver - please check your connectivity, ensure your <a>homeserver's SSL certificate</a> is trusted, and that a browser extension is not blocking requests.",
"error|tls",
{},
{
a: (sub) => (