Migrate translations to keys and switch to Localazy (#26106)

This commit is contained in:
Michael Telatynski 2023-09-05 17:17:25 +01:00 committed by GitHub
parent 00803950bf
commit c525b633bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
98 changed files with 2327 additions and 1922 deletions

View file

@ -153,13 +153,11 @@ async function verifyServerConfig(): Promise<IConfigOptions> {
const incompatibleOptions = [wkConfig, serverName, hsUrl].filter((i) => !!i);
if (hsUrl && (wkConfig || serverName)) {
// noinspection ExceptionCaughtLocallyJS
throw new UserFriendlyError(
"Invalid configuration: a default_hs_url can't be specified along with default_server_name or default_server_config",
);
throw new UserFriendlyError("error|invalid_configuration_mixed_server");
}
if (incompatibleOptions.length < 1) {
// noinspection ExceptionCaughtLocallyJS
throw new UserFriendlyError("Invalid configuration: no default server specified.");
throw new UserFriendlyError("error|invalid_configuration_no_server");
}
if (hsUrl) {

View file

@ -197,16 +197,14 @@ async function start(): Promise<void> {
// Now that we've loaded the theme (CSS), display the config syntax error if needed.
if (error instanceof SyntaxError) {
// This uses the default brand since the app config is unavailable.
return showError(_t("Your Element is misconfigured"), [
_t(
"Your Element configuration contains invalid JSON. Please correct the problem and reload the page.",
),
_t("The message from the parser is: %(message)s", {
message: error.message || _t("Invalid JSON"),
return showError(_t("error|misconfigured"), [
_t("error|invalid_json"),
_t("error|invalid_json_detail", {
message: error.message || _t("error|invalid_json_generic"),
}),
]);
}
return showError(_t("Unable to load config file: please refresh the page to try again."));
return showError(_t("error|cannot_load_config"));
}
// ##################################
@ -230,8 +228,8 @@ async function start(): Promise<void> {
logger.error(err);
// Like the compatibility page, AWOOOOOGA at the user
// This uses the default brand since the app config is unavailable.
await showError(_t("Your Element is misconfigured"), [
extractErrorMessageFromError(err, _t("Unexpected error preparing the app. See console for details.")),
await showError(_t("error|misconfigured"), [
extractErrorMessageFromError(err, _t("error|app_launch_unexpected_error")),
]);
}
}

View file

@ -150,12 +150,12 @@ export default class ElectronPlatform extends VectorBasePlatform {
ToastStore.sharedInstance().addOrReplaceToast({
key,
title: _t("Download Completed"),
title: _t("download_completed"),
props: {
description: name,
acceptLabel: _t("Open"),
acceptLabel: _t("action|open"),
onAccept,
dismissLabel: _t("Dismiss"),
dismissLabel: _t("action|dismiss"),
onDismiss,
numSeconds: 10,
},
@ -313,7 +313,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
public getDefaultDeviceDisplayName(): string {
const brand = SdkConfig.get().brand;
return _t("%(brand)s Desktop: %(platformName)s", {
return _t("desktop_default_device_name", {
brand,
platformName: platformFriendlyName(),
});
@ -390,7 +390,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
// this will get intercepted by electron-main will-navigate
super.startSingleSignOn(mxClient, loginType, fragmentAfterLogin, idpId);
Modal.createDialog(InfoDialog, {
title: _t("Go to your browser to complete Sign In"),
title: _t("auth|sso_complete_in_browser_dialog_title"),
description: <Spinner />,
});
}

View file

@ -85,6 +85,6 @@ export default abstract class VectorBasePlatform extends BasePlatform {
* device Vector is running on
*/
public getDefaultDeviceDisplayName(): string {
return _t("Unknown device");
return _t("unknown_device");
}
}

View file

@ -202,7 +202,7 @@ export default class WebPlatform extends VectorBasePlatform {
let osName = ua.getOS().name || "unknown OS";
// Stylise the value from the parser to match Apple's current branding.
if (osName === "Mac OS") osName = "macOS";
return _t("%(appName)s: %(browserName)s on %(osName)s", {
return _t("web_default_device_name", {
appName,
browserName,
osName,