From b92a21ac7d91323738491ee47c7adcf09dc28370 Mon Sep 17 00:00:00 2001 From: Lewis Crichton Date: Tue, 11 Jun 2024 22:31:06 +0100 Subject: [PATCH] chore: BIKESHEDDING IS OVER, T PREVAILS --- scripts/generatePluginList.ts | 2 +- src/Vencord.ts | 18 +++---- src/components/ErrorBoundary.tsx | 6 +-- .../PluginSettings/ContributorModal.tsx | 4 +- src/components/PluginSettings/PluginModal.tsx | 12 ++--- src/components/PluginSettings/index.tsx | 42 +++++++-------- src/components/VencordSettings/AddonCard.tsx | 4 +- .../VencordSettings/BackupAndRestoreTab.tsx | 20 +++---- src/components/VencordSettings/CloudTab.tsx | 40 +++++++------- src/components/VencordSettings/ThemesTab.tsx | 32 +++++------ src/components/handleComponentFailed.ts | 4 +- src/plugins/clientTheme/index.tsx | 4 +- src/utils/cloud.tsx | 18 +++---- src/utils/misc.tsx | 6 +-- src/utils/settingsSync.ts | 54 +++++++++---------- src/utils/translation.tsx | 6 +-- src/utils/updater.ts | 6 +-- 17 files changed, 139 insertions(+), 139 deletions(-) diff --git a/scripts/generatePluginList.ts b/scripts/generatePluginList.ts index 9bf54961d..09c715bd4 100644 --- a/scripts/generatePluginList.ts +++ b/scripts/generatePluginList.ts @@ -95,7 +95,7 @@ function isTranslationExpression(node: Node): node is CallExpression { const literal = node.expression as LiteralExpression; - if (literal.text !== "$t") return false; + if (literal.text !== "t") return false; return true; } diff --git a/src/Vencord.ts b/src/Vencord.ts index d2fd47c92..42c231181 100644 --- a/src/Vencord.ts +++ b/src/Vencord.ts @@ -38,7 +38,7 @@ import { patches, PMLogger, startAllPlugins } from "./plugins"; import { localStorage } from "./utils/localStorage"; import { relaunch } from "./utils/native"; import { getCloudSettings, putCloudSettings } from "./utils/settingsSync"; -import { $t } from "./utils/translation"; +import { t } from "./utils/translation"; import { checkForUpdates, update, UpdateLogger } from "./utils/updater"; import { onceReady } from "./webpack"; import { SettingsRouter } from "./webpack/common"; @@ -55,8 +55,8 @@ async function syncSettings() { ) { // show a notification letting them know and tell them how to fix it showNotification({ - title: $t("vencord.cloudIntegrations"), - body: $t("vencord.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.cloudSettings"), - body: $t("vencord.cloud.settings.updated"), + title: t("vencord.cloudSettings"), + body: t("vencord.cloud.settings.updated"), color: "var(--green-360)", onClick: relaunch }); @@ -100,8 +100,8 @@ async function init() { await update(); if (Settings.autoUpdateNotification) setTimeout(() => showNotification({ - title: $t("vencord.update.updated"), - body: $t("vencord.update.clickToRestart"), + title: t("vencord.update.updated"), + body: t("vencord.update.clickToRestart"), permanent: true, noPersist: true, onClick: relaunch @@ -110,8 +110,8 @@ async function init() { } setTimeout(() => showNotification({ - title: $t("vencord.update.available"), - body: $t("vencord.update.clickToView"), + title: t("vencord.update.available"), + body: t("vencord.update.clickToView"), permanent: true, noPersist: true, onClick: openUpdaterModal! diff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsx index 445a303a3..2241ae2ec 100644 --- a/src/components/ErrorBoundary.tsx +++ b/src/components/ErrorBoundary.tsx @@ -19,7 +19,7 @@ import { Logger } from "@utils/Logger"; import { Margins } from "@utils/margins"; import { LazyComponent } from "@utils/react"; -import { $t } from "@utils/translation"; +import { t } from "@utils/translation"; import { React } from "@webpack/common"; import { ErrorCard } from "./ErrorCard"; @@ -86,11 +86,11 @@ const ErrorBoundary = LazyComponent(() => { {...this.state} />; - const msg = this.props.message || $t("vencord.errorBoundaryDescription"); + const msg = this.props.message || t("vencord.errorBoundaryDescription"); return ( -

{$t("vencord.ohNo")}

+

{t("vencord.ohNo")}

{msg}

{this.state.message} diff --git a/src/components/PluginSettings/ContributorModal.tsx b/src/components/PluginSettings/ContributorModal.tsx index 1de8b1b68..3707d364f 100644 --- a/src/components/PluginSettings/ContributorModal.tsx +++ b/src/components/PluginSettings/ContributorModal.tsx @@ -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 { $t, 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"; @@ -119,7 +119,7 @@ function ContributorModal({ user }: { user: User; }) { key={p.name} plugin={p} disabled={p.required ?? false} - onRestartNeeded={() => showToast($t("vencord.pluginRestart"))} + onRestartNeeded={() => showToast(t("vencord.pluginRestart"))} /> )} diff --git a/src/components/PluginSettings/PluginModal.tsx b/src/components/PluginSettings/PluginModal.tsx index 88f6fa341..904cda193 100644 --- a/src/components/PluginSettings/PluginModal.tsx +++ b/src/components/PluginSettings/PluginModal.tsx @@ -24,7 +24,7 @@ import { proxyLazy } from "@utils/lazy"; import { Margins } from "@utils/margins"; import { classes, isObjectEmpty } from "@utils/misc"; import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize } from "@utils/modal"; -import { $t } from "@utils/translation"; +import { t } from "@utils/translation"; import { OptionType, Plugin } from "@utils/types"; import { findByPropsLazy, findComponentByCodeLazy } from "@webpack"; import { Button, Clickable, FluxDispatcher, Forms, React, Text, Tooltip, UserStore, UserUtils } from "@webpack/common"; @@ -130,7 +130,7 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti function renderSettings() { if (!hasSettings || !plugin.options) { - return {$t("vencord.noSettings")}; + return {t("vencord.noSettings")}; } else { const options = Object.entries(plugin.options).map(([key, setting]) => { if (setting.hidden) return null; @@ -228,7 +228,7 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti )} - {$t("vencord.settings")} + {t("vencord.settings")} {renderSettings()} @@ -243,7 +243,7 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti > Cancel - + {({ onMouseEnter, onMouseLeave }) => ( )} - {saveError && {$t("vencord.settingsSaveError", { saveError })}} + {saveError && {t("vencord.settingsSaveError", { saveError })}} } diff --git a/src/components/PluginSettings/index.tsx b/src/components/PluginSettings/index.tsx index d2c48eeb1..23286e35c 100644 --- a/src/components/PluginSettings/index.tsx +++ b/src/components/PluginSettings/index.tsx @@ -33,7 +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 { 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"; @@ -66,19 +66,19 @@ function ReloadRequiredCard({ required }: { required: boolean; }) { {required ? ( <> - {$t("vencord.pluginHeader.reloadHeader")} + {t("vencord.pluginHeader.reloadHeader")} - {$t("vencord.pluginHeader.reloadDescription")} + {t("vencord.pluginHeader.reloadDescription")} ) : ( <> - {$t("vencord.pluginHeader.managementHeader")} - {$t("vencord.pluginHeader.iconInformation")} - {$t("vencord.pluginHeader.cogWheel")} + {t("vencord.pluginHeader.managementHeader")} + {t("vencord.pluginHeader.iconInformation")} + {t("vencord.pluginHeader.cogWheel")} )} @@ -184,7 +184,7 @@ export default function PluginSettings() { React.useEffect(() => { return () => void (changes.hasChanges && Alerts.show({ - title: $t("vencord.restartRequired"), + title: t("vencord.restartRequired"), body: ( <>

$t("vencord.pluginsNeedRestart")

@@ -196,8 +196,8 @@ export default function PluginSettings() { ))} ), - confirmText: $t("vencord.restartNow"), - cancelText: $t("vencord.restartLater"), + confirmText: t("vencord.restartNow"), + cancelText: t("vencord.restartLater"), onConfirm: () => location.reload() })); }, []); @@ -273,7 +273,7 @@ export default function PluginSettings() { if (isRequired) { const tooltipText = p.required - ? $t("vencord.requiredPlugin") + ? t("vencord.requiredPlugin") : makeDependencyList(depMap[p.name]?.filter(d => settings.plugins[d].enabled)); requiredPlugins.push( @@ -303,7 +303,7 @@ export default function PluginSettings() { } } else { - plugins = requiredPlugins = {$t("vencord.noSearchResults")}; + plugins = requiredPlugins = {t("vencord.noSearchResults")}; } return ( @@ -311,18 +311,18 @@ export default function PluginSettings() { - {$t("vencord.pluginFilters")} + {t("vencord.pluginFilters")}
- +