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 // show a notification letting them know and tell them how to fix it
showNotification({ showNotification({
title: $t("vencord.utils.cloud.integrations.title"), title: $t("vencord.cloudIntegrations"),
body: $t("vencord.utils.cloud.integrations.reauthenticate"), body: $t("vencord.cloud.integrations.reauthenticate"),
color: "var(--yellow-360)", color: "var(--yellow-360)",
onClick: () => SettingsRouter.open("VencordCloud") 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 // 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). // of the possible ones it has (such as when your settings are newer).
showNotification({ showNotification({
title: $t("vencord.utils.cloud.settings.title"), title: $t("vencord.cloudSettings"),
body: $t("vencord.utils.cloud.settings.updated"), body: $t("vencord.cloud.settings.updated"),
color: "var(--green-360)", color: "var(--green-360)",
onClick: relaunch onClick: relaunch
}); });

View file

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

View file

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

View file

@ -33,6 +33,7 @@ import { Margins } from "@utils/margins";
import { classes, isObjectEmpty } from "@utils/misc"; import { classes, isObjectEmpty } from "@utils/misc";
import { openModalLazy } from "@utils/modal"; import { openModalLazy } from "@utils/modal";
import { useAwaiter } from "@utils/react"; import { useAwaiter } from "@utils/react";
import { $t } from "@utils/translation";
import { Plugin } from "@utils/types"; import { Plugin } from "@utils/types";
import { findByPropsLazy } from "@webpack"; import { findByPropsLazy } from "@webpack";
import { Alerts, Button, Card, Forms, lodash, Parser, React, Select, Text, TextInput, Toasts, Tooltip } from "@webpack/common"; 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) { if (isRequired) {
const tooltipText = p.required 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)); : makeDependencyList(depMap[p.name]?.filter(d => settings.plugins[d].enabled));
requiredPlugins.push( requiredPlugins.push(

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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