chore: restructure locale keys

This commit is contained in:
Lewis Crichton 2024-06-08 19:51:56 +01:00
parent d1242633e5
commit 22e5396684
No known key found for this signature in database
12 changed files with 106 additions and 133 deletions

View file

@ -55,8 +55,8 @@ async function syncSettings() {
) {
// show a notification letting them know and tell them how to fix it
showNotification({
title: $t("vencord.utils.cloud.integrations.title"),
body: $t("vencord.utils.cloud.integrations.reauthenticate"),
title: $t("vencord.cloudIntegrations"),
body: $t("vencord.cloud.integrations.reauthenticate"),
color: "var(--yellow-360)",
onClick: () => SettingsRouter.open("VencordCloud")
});
@ -76,8 +76,8 @@ async function syncSettings() {
// there was an error to notify the user, but besides that we only want to show one notification instead of all
// of the possible ones it has (such as when your settings are newer).
showNotification({
title: $t("vencord.utils.cloud.settings.title"),
body: $t("vencord.utils.cloud.settings.updated"),
title: $t("vencord.cloudSettings"),
body: $t("vencord.cloud.settings.updated"),
color: "var(--green-360)",
onClick: relaunch
});

View file

@ -86,11 +86,11 @@ const ErrorBoundary = LazyComponent(() => {
{...this.state}
/>;
const msg = this.props.message || $t("vencord.components.errorBoundary.error");
const msg = this.props.message || $t("vencord.errorBoundaryDescription");
return (
<ErrorCard style={{ overflow: "hidden" }}>
<h1>{$t("vencord.components.errorBoundary.ohNo")}</h1>
<h1>{$t("vencord.ohNo")}</h1>
<p>{msg}</p>
<code>
{this.state.message}

View file

@ -13,7 +13,7 @@ import { Link } from "@components/Link";
import { DevsById } from "@utils/constants";
import { fetchUserProfile, getTheme, Theme } from "@utils/discord";
import { ModalContent, ModalRoot, openModal } from "@utils/modal";
import { Translate } from "@utils/translation";
import { $t, Translate } from "@utils/translation";
import { Forms, MaskedLink, showToast, Tooltip, useEffect, useMemo, UserProfileStore, useStateFromStores } from "@webpack/common";
import { User } from "discord-types/general";
@ -74,8 +74,6 @@ function ContributorModal({ user }: { user: User; }) {
.sort((a, b) => Number(a.required ?? false) - Number(b.required ?? false));
}, [user.id, user.username]);
const ContributedHyperLink = <Link href="https://vencord.dev/source">contributed</Link>;
return (
<>
<div className={cl("header")}>
@ -109,7 +107,7 @@ function ContributorModal({ user }: { user: User; }) {
</div>
<Forms.FormText>
<Translate i18nKey="vencord.components.pluginSettings.contributorModal.contributed" variables={{ count: plugins.length }}>
<Translate i18nKey="vencord.pluginContributed" variables={{ count: plugins.length }}>
<Link href="https://vencord.dev/source" />
</Translate>
</Forms.FormText>
@ -121,7 +119,7 @@ function ContributorModal({ user }: { user: User; }) {
key={p.name}
plugin={p}
disabled={p.required ?? false}
onRestartNeeded={() => showToast("Restart to apply changes!")}
onRestartNeeded={() => showToast($t("vencord.pluginRestart"))}
/>
)}
</div>

View file

@ -33,6 +33,7 @@ import { Margins } from "@utils/margins";
import { classes, isObjectEmpty } from "@utils/misc";
import { openModalLazy } from "@utils/modal";
import { useAwaiter } from "@utils/react";
import { $t } from "@utils/translation";
import { Plugin } from "@utils/types";
import { findByPropsLazy } from "@webpack";
import { Alerts, Button, Card, Forms, lodash, Parser, React, Select, Text, TextInput, Toasts, Tooltip } from "@webpack/common";
@ -272,7 +273,7 @@ export default function PluginSettings() {
if (isRequired) {
const tooltipText = p.required
? "This plugin is required for Vencord to function."
? $t("vencord.requiredPlugin")
: makeDependencyList(depMap[p.name]?.filter(d => settings.plugins[d].enabled));
requiredPlugins.push(

View file

@ -68,7 +68,7 @@ export function AddonCard({ disabled, isNew, name, infoButton, footer, author, e
>
{name}
</div>
</div>{isNew && <Badge text={$t("vencord.components.vencordSettings.addonCard.new")} color="#ED4245" />}
</div>{isNew && <Badge text={$t("vencord.new")} color="#ED4245" />}
</Text>
{!!author && (
<Text variant="text-md/normal" className={cl("author")}>

View file

@ -21,6 +21,6 @@ import { maybePromptToUpdate } from "@utils/updater";
export function handleComponentFailed() {
maybePromptToUpdate(
$t("vencord.components.componentFailed")
$t("vencord.failureUpdate")
);
}

View file

@ -84,8 +84,8 @@ export async function authorizeCloud() {
var { clientId, redirectUri } = await oauthConfiguration.json();
} catch {
showNotification({
title: $t("vencord.utils.cloud.integrations.title"),
body: $t("vencord.utils.cloud.integrations.setupFailure.oauth")
title: $t("vencord.cloudIntegrations"),
body: $t("vencord.cloud.integrations.setupFailure.oauth")
});
Settings.cloud.authenticated = false;
return;
@ -114,22 +114,22 @@ export async function authorizeCloud() {
cloudLogger.info("Authorized with secret");
await setAuthorization(secret);
showNotification({
title: $t("vencord.utils.cloud.integrations.title"),
body: $t("vencord.utils.cloud.integrations.enabled")
title: $t("vencord.cloudIntegrations"),
body: $t("vencord.cloud.integrations.enabled")
});
Settings.cloud.authenticated = true;
} else {
showNotification({
title: $t("vencord.utils.cloud.integrations.title"),
body: $t("vencord.utils.cloud.integrations.setupFailure.missingSecret")
title: $t("vencord.cloudIntegrations"),
body: $t("vencord.cloud.integrations.setupFailure.missingSecret")
});
Settings.cloud.authenticated = false;
}
} catch (e: any) {
cloudLogger.error("Failed to authorize", e);
showNotification({
title: $t("vencord.utils.cloud.integrations.title"),
body: $t("vencord.utils.cloud.integrations.setupFailure.generic", { error: e.toString() })
title: $t("vencord.cloudIntegrations"),
body: $t("vencord.cloud.integrations.setupFailure.generic", { error: e.toString() })
});
Settings.cloud.authenticated = false;
}

View file

@ -37,12 +37,12 @@ export function sleep(ms: number): Promise<void> {
}
export function copyWithToast(text: string, toastMessage?: string) {
toastMessage ??= $t("vencord.utils.misc.clipboard.copied");
toastMessage ??= $t("vencord.copiedToClipboard");
if (Clipboard.SUPPORTS_COPY) {
Clipboard.copy(text);
} else {
toastMessage = $t("vencord.utils.misc.clipboard.noSupport");
toastMessage = $t("vencord.clipboardNotSupported");
}
Toasts.show({
message: toastMessage,

View file

@ -69,10 +69,10 @@ const toast = (type: number, message: string) =>
});
const toastSuccess = () =>
toast(Toasts.Type.SUCCESS, $t("vencord.utils.settingsSync.imported"));
toast(Toasts.Type.SUCCESS, $t("vencord.importedSettings"));
const toastFailure = (err: any) =>
toast(Toasts.Type.FAILURE, $t("vencord.utils.settingsSync.failedToImport", { error: String(err) }));
toast(Toasts.Type.FAILURE, $t("vencord.failedToImport", { error: String(err) }));
export async function uploadSettingsBackup(showToast = true): Promise<void> {
if (IS_DISCORD_DESKTOP) {
@ -129,8 +129,8 @@ export async function putCloudSettings(manual?: boolean) {
if (!res.ok) {
cloudSettingsLogger.error(`Failed to sync up, API returned ${res.status}`);
showNotification({
title: $t("vencord.utils.cloud.settings.title"),
body: $t("vencord.utils.cloud.settings.syncErrorUp.api", { status: res.status.toString() }),
title: $t("vencord.cloudSettings"),
body: $t("vencord.cloud.settings.syncErrorUp.api", { status: res.status.toString() }),
color: "var(--red-360)"
});
return;
@ -144,16 +144,16 @@ export async function putCloudSettings(manual?: boolean) {
if (manual) {
showNotification({
title: $t("vencord.utils.cloud.settings.title"),
body: $t("vencord.utils.cloud.settings.syncSuccess"),
title: $t("vencord.cloudSettings"),
body: $t("vencord.cloud.settings.syncSuccess"),
noPersist: true,
});
}
} catch (e: any) {
cloudSettingsLogger.error("Failed to sync up", e);
showNotification({
title: $t("vencord.utils.cloud.settings.title"),
body: $t("vencord.utils.cloud.settings.syncErrorUp.generic", { error: e.toString() }),
title: $t("vencord.cloudSettings"),
body: $t("vencord.cloud.settings.syncErrorUp.generic", { error: e.toString() }),
color: "var(--red-360)"
});
}
@ -174,8 +174,8 @@ export async function getCloudSettings(shouldNotify = true, force = false) {
cloudSettingsLogger.info("No settings on the cloud");
if (shouldNotify)
showNotification({
title: $t("vencord.utils.cloud.settings.title"),
body: $t("vencord.utils.cloud.settings.nothingOnline"),
title: $t("vencord.cloudSettings"),
body: $t("vencord.cloud.settings.nothingOnline"),
noPersist: true
});
return false;
@ -185,8 +185,8 @@ export async function getCloudSettings(shouldNotify = true, force = false) {
cloudSettingsLogger.info("Settings up to date");
if (shouldNotify)
showNotification({
title: $t("vencord.utils.cloud.settings.title"),
body: $t("vencord.utils.cloud.settings.upToDate"),
title: $t("vencord.cloudSettings"),
body: $t("vencord.cloud.settings.upToDate"),
noPersist: true
});
return false;
@ -195,8 +195,8 @@ export async function getCloudSettings(shouldNotify = true, force = false) {
if (!res.ok) {
cloudSettingsLogger.error(`Failed to sync down, API returned ${res.status}`);
showNotification({
title: $t("vencord.utils.cloud.settings.title"),
body: $t("vencord.utils.cloud.settings.syncErrorDown.api", { status: res.status.toString() }),
title: $t("vencord.cloudSettings"),
body: $t("vencord.cloud.settings.syncErrorDown.api", { status: res.status.toString() }),
color: "var(--red-360)"
});
return false;
@ -209,8 +209,8 @@ export async function getCloudSettings(shouldNotify = true, force = false) {
if (!force && written < localWritten) {
if (shouldNotify)
showNotification({
title: $t("vencord.utils.cloud.settings.title"),
body: $t("vencord.utils.cloud.settings.localNewer"),
title: $t("vencord.cloudSettings"),
body: $t("vencord.cloud.settings.localNewer"),
noPersist: true,
});
return;
@ -228,8 +228,8 @@ export async function getCloudSettings(shouldNotify = true, force = false) {
cloudSettingsLogger.info("Settings loaded from cloud successfully");
if (shouldNotify)
showNotification({
title: $t("vencord.utils.cloud.settings.title"),
body: $t("vencord.utils.cloud.settings.updated"),
title: $t("vencord.cloudSettings"),
body: $t("vencord.cloud.settings.updated"),
color: "var(--green-360)",
onClick: IS_WEB ? () => location.reload() : relaunch,
noPersist: true
@ -239,8 +239,8 @@ export async function getCloudSettings(shouldNotify = true, force = false) {
} catch (e: any) {
cloudSettingsLogger.error("Failed to sync down", e);
showNotification({
title: $t("vencord.utils.cloud.settings.title"),
body: $t("vencord.utils.cloud.settings.syncErrorDown.generic", { error: e.toString() }),
title: $t("vencord.cloudSettings"),
body: $t("vencord.cloud.settings.syncErrorDown.generic", { error: e.toString() }),
color: "var(--red-360)"
});
@ -258,8 +258,8 @@ export async function deleteCloudSettings() {
if (!res.ok) {
cloudSettingsLogger.error(`Failed to delete, API returned ${res.status}`);
showNotification({
title: $t("vencord.utils.cloud.settings.title"),
body: $t("vencord.utils.cloud.settings.deleteError.api", { error: res.status.toString() }),
title: $t("vencord.cloudSettings"),
body: $t("vencord.cloud.settings.deleteError.api", { error: res.status.toString() }),
color: "var(--red-360)"
});
return;
@ -267,15 +267,15 @@ export async function deleteCloudSettings() {
cloudSettingsLogger.info("Settings deleted from cloud successfully");
showNotification({
title: $t("vencord.utils.cloud.settings.title"),
body: $t("vencord.utils.cloud.settings.deleted"),
title: $t("vencord.cloudSettings"),
body: $t("vencord.cloud.settings.deleted"),
color: "var(--green-360)"
});
} catch (e: any) {
cloudSettingsLogger.error("Failed to delete", e);
showNotification({
title: $t("vencord.utils.cloud.settings.title"),
body: $t("vencord.utils.cloud.settings.deleteError.generic", { error: e.toString() }),
title: $t("vencord.cloudSettings"),
body: $t("vencord.cloud.settings.deleteError.generic", { error: e.toString() }),
color: "var(--red-360)"
});
}

View file

@ -71,7 +71,7 @@ export async function maybePromptToUpdate(confirmMessage: string, checkForDev =
const isOutdated = await checkForUpdates();
if (isOutdated) {
const wantsUpdate = confirm(confirmMessage);
if (wantsUpdate && isNewer) return alert($t("vencord.utils.updater.gitNewer"));
if (wantsUpdate && isNewer) return alert($t("vencord.gitCopyNewer"));
if (wantsUpdate) {
await update();
relaunch();
@ -79,6 +79,6 @@ export async function maybePromptToUpdate(confirmMessage: string, checkForDev =
}
} catch (err) {
UpdateLogger.error(err);
alert($t("vencord.utils.updater.failed"));
alert($t("vencord.updaterRepeatFailed"));
}
}

View file

@ -1,13 +1,7 @@
{
"components": {
"pluginSettings": {
"contributorModal": {
"contributed": {
"pluginContributed": {
"zero": "Diese Person hat keine Plugins erstellt. Sie haben wahrscheinlich auf andere Weise <0>zu Vencord beigetragen</0>!",
"one": "Diese Person hat zu einem Plugin <0>beigetragen</0>!",
"other": "Diese Person hat zu {count} Plugins <0>beigetragen</0>!"
}
}
}
}
}

View file

@ -1,24 +1,14 @@
{
"components": {
"componentFailed": "Uh Oh! Failed to render this Page. However, there is an update available that might fix it. Would you like to update and restart now?",
"errorBoundary": {
"error": "An error occurred while rendering this Component. More info can be found below and in your console.",
"ohNo": "Oh no!"
},
"pluginSettings": {
"contributorModal": {
"contributed": {
"zero": "This person has not made any plugins. They likely <0>contributed</0> to Vencord in other ways!",
"ohNo": "Oh no!",
"errorBoundaryDescription": "An error occurred while rendering this Component. More info can be found below and in your console.",
"failureUpdate": "Uh Oh! Failed to render this Page. However, there is an update available that might fix it. Would you like to update and restart now?",
"pluginRestart": "Restart to apply changes!",
"requiredPlugin": "This plugin is required for Vencord to function.",
"new": "NEW",
"pluginContributed": {
"one": "This person has <0>contributed</0> to one plugin!",
"other": "This person has <0>contributed</0> to {count} plugins!"
}
}
},
"vencordSettings": {
"addonCard": {
"new": "NEW"
}
}
"other": "This person has <0>contributed</0> to {count} plugins!",
"zero": "This person has not made any plugins. They likely <0>contributed</0> to Vencord in other ways!"
},
"update": {
"available": "A Vencord update is available!",
@ -26,7 +16,8 @@
"clickToView": "Click here to view the update",
"updated": "Vencord has been updated!"
},
"utils": {
"cloudIntegrations": "Cloud Integrations",
"cloudSettings": "Cloud Settings",
"cloud": {
"integrations": {
"enabled": "Cloud integrations enabled!",
@ -35,8 +26,7 @@
"generic": "Setup failed ({error}).",
"missingSecret": "Setup failed (no secret returned?).",
"oauth": "Setup failed (couldn't retrieve OAuth configuration)."
},
"title": "Cloud Integrations"
}
},
"settings": {
"deleteError": {
@ -55,24 +45,14 @@
"generic": "Could not synchronize settings to the cloud ({error})."
},
"syncSuccess": "Synchronized settings to the cloud!",
"title": "Cloud Settings",
"upToDate": "Your settings are up to date.",
"updated": "Your settings have been updated! Click here to restart to fully apply changes!"
}
},
"misc": {
"clipboard": {
"copied": "Copied to clipboard!",
"noSupport": "Your browser does not support copying to clipboard"
}
},
"settingsSync": {
"copiedToClipboard": "Copied to clipboard!",
"clipboardNotSupported": "Your browser does not support copying to clipboard",
"failedToImport": "Failed to import settings: {error}",
"imported": "Settings successfully imported. Restart to apply changes!"
},
"updater": {
"failed": "That also failed :( Try updating or re-installing with the installer!",
"gitNewer": "Your local copy has more recent commits. Please stash or reset them."
}
}
"importedSettings": "Settings successfully imported. Restart to apply changes!",
"updaterRepeatFailed": "That also failed :( Try updating or re-installing with the installer!",
"gitCopyNewer": "Your local copy has more recent commits. Please stash or reset them."
}