chore: BIKESHEDDING IS OVER, T PREVAILS

This commit is contained in:
Lewis Crichton 2024-06-11 22:31:06 +01:00
parent 8c4aed699d
commit b92a21ac7d
No known key found for this signature in database
17 changed files with 139 additions and 139 deletions

View file

@ -95,7 +95,7 @@ function isTranslationExpression(node: Node): node is CallExpression {
const literal = node.expression as LiteralExpression; const literal = node.expression as LiteralExpression;
if (literal.text !== "$t") return false; if (literal.text !== "t") return false;
return true; return true;
} }

View file

@ -38,7 +38,7 @@ import { patches, PMLogger, startAllPlugins } from "./plugins";
import { localStorage } from "./utils/localStorage"; import { localStorage } from "./utils/localStorage";
import { relaunch } from "./utils/native"; import { relaunch } from "./utils/native";
import { getCloudSettings, putCloudSettings } from "./utils/settingsSync"; import { getCloudSettings, putCloudSettings } from "./utils/settingsSync";
import { $t } from "./utils/translation"; import { t } from "./utils/translation";
import { checkForUpdates, update, UpdateLogger } from "./utils/updater"; import { checkForUpdates, update, UpdateLogger } from "./utils/updater";
import { onceReady } from "./webpack"; import { onceReady } from "./webpack";
import { SettingsRouter } from "./webpack/common"; 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 // show a notification letting them know and tell them how to fix it
showNotification({ showNotification({
title: $t("vencord.cloudIntegrations"), title: t("vencord.cloudIntegrations"),
body: $t("vencord.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.cloudSettings"), title: t("vencord.cloudSettings"),
body: $t("vencord.cloud.settings.updated"), body: t("vencord.cloud.settings.updated"),
color: "var(--green-360)", color: "var(--green-360)",
onClick: relaunch onClick: relaunch
}); });
@ -100,8 +100,8 @@ async function init() {
await update(); await update();
if (Settings.autoUpdateNotification) if (Settings.autoUpdateNotification)
setTimeout(() => showNotification({ setTimeout(() => showNotification({
title: $t("vencord.update.updated"), title: t("vencord.update.updated"),
body: $t("vencord.update.clickToRestart"), body: t("vencord.update.clickToRestart"),
permanent: true, permanent: true,
noPersist: true, noPersist: true,
onClick: relaunch onClick: relaunch
@ -110,8 +110,8 @@ async function init() {
} }
setTimeout(() => showNotification({ setTimeout(() => showNotification({
title: $t("vencord.update.available"), title: t("vencord.update.available"),
body: $t("vencord.update.clickToView"), body: t("vencord.update.clickToView"),
permanent: true, permanent: true,
noPersist: true, noPersist: true,
onClick: openUpdaterModal! onClick: openUpdaterModal!

View file

@ -19,7 +19,7 @@
import { Logger } from "@utils/Logger"; import { Logger } from "@utils/Logger";
import { Margins } from "@utils/margins"; import { Margins } from "@utils/margins";
import { LazyComponent } from "@utils/react"; import { LazyComponent } from "@utils/react";
import { $t } from "@utils/translation"; import { t } from "@utils/translation";
import { React } from "@webpack/common"; import { React } from "@webpack/common";
import { ErrorCard } from "./ErrorCard"; import { ErrorCard } from "./ErrorCard";
@ -86,11 +86,11 @@ const ErrorBoundary = LazyComponent(() => {
{...this.state} {...this.state}
/>; />;
const msg = this.props.message || $t("vencord.errorBoundaryDescription"); const msg = this.props.message || t("vencord.errorBoundaryDescription");
return ( return (
<ErrorCard style={{ overflow: "hidden" }}> <ErrorCard style={{ overflow: "hidden" }}>
<h1>{$t("vencord.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 { $t, 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";
@ -119,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($t("vencord.pluginRestart"))} onRestartNeeded={() => showToast(t("vencord.pluginRestart"))}
/> />
)} )}
</div> </div>

View file

@ -24,7 +24,7 @@ import { proxyLazy } from "@utils/lazy";
import { Margins } from "@utils/margins"; import { Margins } from "@utils/margins";
import { classes, isObjectEmpty } from "@utils/misc"; import { classes, isObjectEmpty } from "@utils/misc";
import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize } from "@utils/modal"; 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 { OptionType, Plugin } from "@utils/types";
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack"; import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
import { Button, Clickable, FluxDispatcher, Forms, React, Text, Tooltip, UserStore, UserUtils } from "@webpack/common"; 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() { function renderSettings() {
if (!hasSettings || !plugin.options) { if (!hasSettings || !plugin.options) {
return <Forms.FormText>{$t("vencord.noSettings")}</Forms.FormText>; return <Forms.FormText>{t("vencord.noSettings")}</Forms.FormText>;
} else { } else {
const options = Object.entries(plugin.options).map(([key, setting]) => { const options = Object.entries(plugin.options).map(([key, setting]) => {
if (setting.hidden) return null; if (setting.hidden) return null;
@ -228,7 +228,7 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti
</div> </div>
)} )}
<Forms.FormSection className={Margins.bottom16}> <Forms.FormSection className={Margins.bottom16}>
<Forms.FormTitle tag="h3">{$t("vencord.settings")}</Forms.FormTitle> <Forms.FormTitle tag="h3">{t("vencord.settings")}</Forms.FormTitle>
{renderSettings()} {renderSettings()}
</Forms.FormSection> </Forms.FormSection>
</ModalContent> </ModalContent>
@ -243,7 +243,7 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti
> >
Cancel Cancel
</Button> </Button>
<Tooltip text={$t("vencord.settingsErrors")} shouldShow={!canSubmit()}> <Tooltip text={t("vencord.settingsErrors")} shouldShow={!canSubmit()}>
{({ onMouseEnter, onMouseLeave }) => ( {({ onMouseEnter, onMouseLeave }) => (
<Button <Button
size={Button.Sizes.SMALL} size={Button.Sizes.SMALL}
@ -253,12 +253,12 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti
onMouseLeave={onMouseLeave} onMouseLeave={onMouseLeave}
disabled={!canSubmit()} disabled={!canSubmit()}
> >
{$t("vencord.saveAndClose")} {t("vencord.saveAndClose")}
</Button> </Button>
)} )}
</Tooltip> </Tooltip>
</Flex> </Flex>
{saveError && <Text variant="text-md/semibold" style={{ color: "var(--text-danger)" }}>{$t("vencord.settingsSaveError", { saveError })}</Text>} {saveError && <Text variant="text-md/semibold" style={{ color: "var(--text-danger)" }}>{t("vencord.settingsSaveError", { saveError })}</Text>}
</Flex> </Flex>
</ModalFooter>} </ModalFooter>}
</ModalRoot> </ModalRoot>

View file

@ -33,7 +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 { 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";
@ -66,19 +66,19 @@ function ReloadRequiredCard({ required }: { required: boolean; }) {
<Card className={cl("info-card", { "restart-card": required })}> <Card className={cl("info-card", { "restart-card": required })}>
{required ? ( {required ? (
<> <>
<Forms.FormTitle tag="h5">{$t("vencord.pluginHeader.reloadHeader")}</Forms.FormTitle> <Forms.FormTitle tag="h5">{t("vencord.pluginHeader.reloadHeader")}</Forms.FormTitle>
<Forms.FormText className={cl("dep-text")}> <Forms.FormText className={cl("dep-text")}>
{$t("vencord.pluginHeader.reloadDescription")} {t("vencord.pluginHeader.reloadDescription")}
</Forms.FormText> </Forms.FormText>
<Button onClick={() => location.reload()}> <Button onClick={() => location.reload()}>
{$t("vencord.pluginHeader.restart")} {t("vencord.pluginHeader.restart")}
</Button> </Button>
</> </>
) : ( ) : (
<> <>
<Forms.FormTitle tag="h5">{$t("vencord.pluginHeader.managementHeader")}</Forms.FormTitle> <Forms.FormTitle tag="h5">{t("vencord.pluginHeader.managementHeader")}</Forms.FormTitle>
<Forms.FormText>{$t("vencord.pluginHeader.iconInformation")}</Forms.FormText> <Forms.FormText>{t("vencord.pluginHeader.iconInformation")}</Forms.FormText>
<Forms.FormText>{$t("vencord.pluginHeader.cogWheel")}</Forms.FormText> <Forms.FormText>{t("vencord.pluginHeader.cogWheel")}</Forms.FormText>
</> </>
)} )}
</Card> </Card>
@ -184,7 +184,7 @@ export default function PluginSettings() {
React.useEffect(() => { React.useEffect(() => {
return () => void (changes.hasChanges && Alerts.show({ return () => void (changes.hasChanges && Alerts.show({
title: $t("vencord.restartRequired"), title: t("vencord.restartRequired"),
body: ( body: (
<> <>
<p>$t("vencord.pluginsNeedRestart")</p> <p>$t("vencord.pluginsNeedRestart")</p>
@ -196,8 +196,8 @@ export default function PluginSettings() {
))}</div> ))}</div>
</> </>
), ),
confirmText: $t("vencord.restartNow"), confirmText: t("vencord.restartNow"),
cancelText: $t("vencord.restartLater"), cancelText: t("vencord.restartLater"),
onConfirm: () => location.reload() onConfirm: () => location.reload()
})); }));
}, []); }, []);
@ -273,7 +273,7 @@ export default function PluginSettings() {
if (isRequired) { if (isRequired) {
const tooltipText = p.required const tooltipText = p.required
? $t("vencord.requiredPlugin") ? 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(
@ -303,7 +303,7 @@ export default function PluginSettings() {
} }
} else { } else {
plugins = requiredPlugins = <Text variant="text-md/normal">{$t("vencord.noSearchResults")}</Text>; plugins = requiredPlugins = <Text variant="text-md/normal">{t("vencord.noSearchResults")}</Text>;
} }
return ( return (
@ -311,18 +311,18 @@ export default function PluginSettings() {
<ReloadRequiredCard required={changes.hasChanges} /> <ReloadRequiredCard required={changes.hasChanges} />
<Forms.FormTitle tag="h5" className={classes(Margins.top20, Margins.bottom8)}> <Forms.FormTitle tag="h5" className={classes(Margins.top20, Margins.bottom8)}>
{$t("vencord.pluginFilters")} {t("vencord.pluginFilters")}
</Forms.FormTitle> </Forms.FormTitle>
<div className={cl("filter-controls")}> <div className={cl("filter-controls")}>
<TextInput autoFocus value={searchValue.value} placeholder={$t("vencord.search.placeholder")} onChange={onSearch} className={Margins.bottom20} /> <TextInput autoFocus value={searchValue.value} placeholder={t("vencord.search.placeholder")} onChange={onSearch} className={Margins.bottom20} />
<div className={InputStyles.inputWrapper}> <div className={InputStyles.inputWrapper}>
<Select <Select
options={[ options={[
{ label: $t("vencord.search.all"), value: SearchStatus.ALL, default: true }, { label: t("vencord.search.all"), value: SearchStatus.ALL, default: true },
{ label: $t("vencord.search.enabled"), value: SearchStatus.ENABLED }, { label: t("vencord.search.enabled"), value: SearchStatus.ENABLED },
{ label: $t("vencord.search.disabled"), value: SearchStatus.DISABLED }, { label: t("vencord.search.disabled"), value: SearchStatus.DISABLED },
{ label: $t("vencord.search.new"), value: SearchStatus.NEW } { label: t("vencord.search.new"), value: SearchStatus.NEW }
]} ]}
serialize={String} serialize={String}
select={onStatusChange} select={onStatusChange}
@ -332,7 +332,7 @@ export default function PluginSettings() {
</div> </div>
</div> </div>
<Forms.FormTitle className={Margins.top20}>{$t("vencord.plugins")}</Forms.FormTitle> <Forms.FormTitle className={Margins.top20}>{t("vencord.plugins")}</Forms.FormTitle>
<div className={cl("grid")}> <div className={cl("grid")}>
{plugins} {plugins}
@ -341,7 +341,7 @@ export default function PluginSettings() {
<Forms.FormDivider className={Margins.top20} /> <Forms.FormDivider className={Margins.top20} />
<Forms.FormTitle tag="h5" className={classes(Margins.top20, Margins.bottom8)}> <Forms.FormTitle tag="h5" className={classes(Margins.top20, Margins.bottom8)}>
{$t("vencord.requiredPlugins")} {t("vencord.requiredPlugins")}
</Forms.FormTitle> </Forms.FormTitle>
<div className={cl("grid")}> <div className={cl("grid")}>
{requiredPlugins} {requiredPlugins}
@ -353,7 +353,7 @@ export default function PluginSettings() {
function makeDependencyList(deps: string[]) { function makeDependencyList(deps: string[]) {
return ( return (
<React.Fragment> <React.Fragment>
<Forms.FormText>{$t("vencord.pluginRequiredBy")}</Forms.FormText> <Forms.FormText>{t("vencord.pluginRequiredBy")}</Forms.FormText>
{deps.map((dep: string) => <Forms.FormText className={cl("dep-text")}>{dep}</Forms.FormText>)} {deps.map((dep: string) => <Forms.FormText className={cl("dep-text")}>{dep}</Forms.FormText>)}
</React.Fragment> </React.Fragment>
); );

View file

@ -21,7 +21,7 @@ import "./addonCard.css";
import { classNameFactory } from "@api/Styles"; import { classNameFactory } from "@api/Styles";
import { Badge } from "@components/Badge"; import { Badge } from "@components/Badge";
import { Switch } from "@components/Switch"; import { Switch } from "@components/Switch";
import { $t } from "@utils/translation"; import { t } from "@utils/translation";
import { Text, useRef } from "@webpack/common"; import { Text, useRef } from "@webpack/common";
import type { MouseEventHandler, ReactNode } from "react"; import type { MouseEventHandler, ReactNode } from "react";
@ -68,7 +68,7 @@ export function AddonCard({ disabled, isNew, name, infoButton, footer, author, e
> >
{name} {name}
</div> </div>
</div>{isNew && <Badge text={$t("vencord.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

@ -20,7 +20,7 @@ import { Flex } from "@components/Flex";
import { Margins } from "@utils/margins"; import { Margins } from "@utils/margins";
import { classes } from "@utils/misc"; import { classes } from "@utils/misc";
import { downloadSettingsBackup, uploadSettingsBackup } from "@utils/settingsSync"; import { downloadSettingsBackup, uploadSettingsBackup } from "@utils/settingsSync";
import { $t } from "@utils/translation"; import { t } from "@utils/translation";
import { Button, Card, Text } from "@webpack/common"; import { Button, Card, Text } from "@webpack/common";
import { SettingsTab, wrapTab } from "./shared"; import { SettingsTab, wrapTab } from "./shared";
@ -30,19 +30,19 @@ function BackupRestoreTab() {
<SettingsTab title="Backup & Restore"> <SettingsTab title="Backup & Restore">
<Card className={classes("vc-settings-card", "vc-backup-restore-card")}> <Card className={classes("vc-settings-card", "vc-backup-restore-card")}>
<Flex flexDirection="column"> <Flex flexDirection="column">
<strong>{$t("vencord.warning")}</strong> <strong>{t("vencord.warning")}</strong>
<span>{$t("vencord.backupAndRestore.importWarning")}</span> <span>{t("vencord.backupAndRestore.importWarning")}</span>
</Flex> </Flex>
</Card> </Card>
<Text variant="text-md/normal" className={Margins.bottom8}> <Text variant="text-md/normal" className={Margins.bottom8}>
{$t("vencord.backupAndRestore.description")} {t("vencord.backupAndRestore.description")}
</Text> </Text>
<Text variant="text-md/normal" className={Margins.bottom8}> <Text variant="text-md/normal" className={Margins.bottom8}>
{$t("vencord.backupAndRestore.exportContains")} {t("vencord.backupAndRestore.exportContains")}
<ul> <ul>
<li>&mdash; {$t("vencord.backupAndRestore.customQuickcss")}</li> <li>&mdash; {t("vencord.backupAndRestore.customQuickcss")}</li>
<li>&mdash; {$t("vencord.backupAndRestore.themeLinks")}</li> <li>&mdash; {t("vencord.backupAndRestore.themeLinks")}</li>
<li>&mdash; {$t("vencord.backupAndRestore.pluginSettings")}</li> <li>&mdash; {t("vencord.backupAndRestore.pluginSettings")}</li>
</ul> </ul>
</Text> </Text>
<Flex> <Flex>
@ -50,13 +50,13 @@ function BackupRestoreTab() {
onClick={() => uploadSettingsBackup()} onClick={() => uploadSettingsBackup()}
size={Button.Sizes.SMALL} size={Button.Sizes.SMALL}
> >
{$t("vencord.backupAndRestore.importSettings")} {t("vencord.backupAndRestore.importSettings")}
</Button> </Button>
<Button <Button
onClick={downloadSettingsBackup} onClick={downloadSettingsBackup}
size={Button.Sizes.SMALL} size={Button.Sizes.SMALL}
> >
{$t("vencord.backupAndRestore.exportSettings")} {t("vencord.backupAndRestore.exportSettings")}
</Button> </Button>
</Flex> </Flex>
</SettingsTab> </SettingsTab>

View file

@ -23,7 +23,7 @@ import { Link } from "@components/Link";
import { authorizeCloud, cloudLogger, deauthorizeCloud, getCloudAuth, getCloudUrl } from "@utils/cloud"; import { authorizeCloud, cloudLogger, deauthorizeCloud, getCloudAuth, getCloudUrl } from "@utils/cloud";
import { Margins } from "@utils/margins"; import { Margins } from "@utils/margins";
import { deleteCloudSettings, getCloudSettings, putCloudSettings } from "@utils/settingsSync"; import { deleteCloudSettings, getCloudSettings, putCloudSettings } from "@utils/settingsSync";
import { $t, Translate } from "@utils/translation"; import { t, Translate } from "@utils/translation";
import { Alerts, Button, Forms, Switch, Tooltip } from "@webpack/common"; import { Alerts, Button, Forms, Switch, Tooltip } from "@webpack/common";
import { SettingsTab, wrapTab } from "./shared"; import { SettingsTab, wrapTab } from "./shared";
@ -46,8 +46,8 @@ async function eraseAllData() {
if (!res.ok) { if (!res.ok) {
cloudLogger.error(`Failed to erase data, API returned ${res.status}`); cloudLogger.error(`Failed to erase data, API returned ${res.status}`);
showNotification({ showNotification({
title: $t("vencord.cloudIntegrations"), title: t("vencord.cloudIntegrations"),
body: $t("vencord.cloud.integrations.eraseError", { status: res.status }), body: t("vencord.cloud.integrations.eraseError", { status: res.status }),
color: "var(--red-360)" color: "var(--red-360)"
}); });
return; return;
@ -57,8 +57,8 @@ async function eraseAllData() {
await deauthorizeCloud(); await deauthorizeCloud();
showNotification({ showNotification({
title: $t("vencord.cloudIntegrations"), title: t("vencord.cloudIntegrations"),
body: $t("vencord.cloud.integrations.eraseSuccess"), body: t("vencord.cloud.integrations.eraseSuccess"),
color: "var(--green-360)" color: "var(--green-360)"
}); });
} }
@ -70,7 +70,7 @@ function SettingsSyncSection() {
return ( return (
<Forms.FormSection title="Settings Sync" className={Margins.top16}> <Forms.FormSection title="Settings Sync" className={Margins.top16}>
<Forms.FormText variant="text-md/normal" className={Margins.bottom20}> <Forms.FormText variant="text-md/normal" className={Margins.bottom20}>
{$t("vencord.cloud.settings.description")} {t("vencord.cloud.settings.description")}
</Forms.FormText> </Forms.FormText>
<Switch <Switch
key="cloud-sync" key="cloud-sync"
@ -78,15 +78,15 @@ function SettingsSyncSection() {
value={cloud.settingsSync} value={cloud.settingsSync}
onChange={v => { cloud.settingsSync = v; }} onChange={v => { cloud.settingsSync = v; }}
> >
{$t("vencord.settingsSync")} {t("vencord.settingsSync")}
</Switch> </Switch>
<div className="vc-cloud-settings-sync-grid"> <div className="vc-cloud-settings-sync-grid">
<Button <Button
size={Button.Sizes.SMALL} size={Button.Sizes.SMALL}
disabled={!sectionEnabled} disabled={!sectionEnabled}
onClick={() => putCloudSettings(true)} onClick={() => putCloudSettings(true)}
>{$t("vencord.cloud.settings.syncToCloud")}</Button> >{t("vencord.cloud.settings.syncToCloud")}</Button>
<Tooltip text={$t("vencord.cloud.settings.overwriteWarning")}> <Tooltip text={t("vencord.cloud.settings.overwriteWarning")}>
{({ onMouseLeave, onMouseEnter }) => ( {({ onMouseLeave, onMouseEnter }) => (
<Button <Button
onMouseLeave={onMouseLeave} onMouseLeave={onMouseLeave}
@ -95,7 +95,7 @@ function SettingsSyncSection() {
color={Button.Colors.RED} color={Button.Colors.RED}
disabled={!sectionEnabled} disabled={!sectionEnabled}
onClick={() => getCloudSettings(true, true)} onClick={() => getCloudSettings(true, true)}
>{$t("vencord.cloud.settings.syncFromCloud")}</Button> >{t("vencord.cloud.settings.syncFromCloud")}</Button>
)} )}
</Tooltip> </Tooltip>
<Button <Button
@ -103,7 +103,7 @@ function SettingsSyncSection() {
color={Button.Colors.RED} color={Button.Colors.RED}
disabled={!sectionEnabled} disabled={!sectionEnabled}
onClick={() => deleteCloudSettings()} onClick={() => deleteCloudSettings()}
>{$t("vencord.cloud.settings.deleteCloudSettings")}</Button> >{t("vencord.cloud.settings.deleteCloudSettings")}</Button>
</div> </div>
</Forms.FormSection> </Forms.FormSection>
); );
@ -125,13 +125,13 @@ function CloudTab() {
key="backend" key="backend"
value={settings.cloud.authenticated} value={settings.cloud.authenticated}
onChange={v => { v && authorizeCloud(); if (!v) settings.cloud.authenticated = v; }} onChange={v => { v && authorizeCloud(); if (!v) settings.cloud.authenticated = v; }}
note={$t("vencord.cloud.integrations.authorizationNote")} note={t("vencord.cloud.integrations.authorizationNote")}
> >
{$t("vencord.cloud.integrations.enable")} {t("vencord.cloud.integrations.enable")}
</Switch> </Switch>
<Forms.FormTitle tag="h5">{$t("vencord.cloud.integrations.backendUrl")}</Forms.FormTitle> <Forms.FormTitle tag="h5">{t("vencord.cloud.integrations.backendUrl")}</Forms.FormTitle>
<Forms.FormText className={Margins.bottom8}> <Forms.FormText className={Margins.bottom8}>
{$t("vencord.cloud.integrations.backendNote")} {t("vencord.cloud.integrations.backendNote")}
</Forms.FormText> </Forms.FormText>
<CheckedTextInput <CheckedTextInput
key="backendUrl" key="backendUrl"
@ -145,14 +145,14 @@ function CloudTab() {
color={Button.Colors.RED} color={Button.Colors.RED}
disabled={!settings.cloud.authenticated} disabled={!settings.cloud.authenticated}
onClick={() => Alerts.show({ onClick={() => Alerts.show({
title: $t("vencord.areYouSure"), title: t("vencord.areYouSure"),
body: $t("vencord.cloud.integrations.eraseWarning"), body: t("vencord.cloud.integrations.eraseWarning"),
onConfirm: eraseAllData, onConfirm: eraseAllData,
confirmText: $t("vencord.cloud.integrations.eraseIt"), confirmText: t("vencord.cloud.integrations.eraseIt"),
confirmColor: "vc-cloud-erase-data-danger-btn", confirmColor: "vc-cloud-erase-data-danger-btn",
cancelText: $t("vencord.nevermind") cancelText: t("vencord.nevermind")
})} })}
>{$t("vencord.cloud.integrations.eraseAllData")}</Button> >{t("vencord.cloud.integrations.eraseAllData")}</Button>
<Forms.FormDivider className={Margins.top16} /> <Forms.FormDivider className={Margins.top16} />
</Forms.FormSection > </Forms.FormSection >
<SettingsSyncSection /> <SettingsSyncSection />

View file

@ -29,7 +29,7 @@ import { classes } from "@utils/misc";
import { openModal } from "@utils/modal"; import { openModal } from "@utils/modal";
import { showItemInFolder } from "@utils/native"; import { showItemInFolder } from "@utils/native";
import { useAwaiter } from "@utils/react"; import { useAwaiter } from "@utils/react";
import { $t } from "@utils/translation"; import { t } from "@utils/translation";
import { findByPropsLazy, findLazy } from "@webpack"; import { findByPropsLazy, findLazy } from "@webpack";
import { Button, Card, Forms, React, showToast, TabBar, TextArea, useEffect, useRef, useState } from "@webpack/common"; import { Button, Card, Forms, React, showToast, TabBar, TextArea, useEffect, useRef, useState } from "@webpack/common";
import type { ComponentType, Ref, SyntheticEvent } from "react"; import type { ComponentType, Ref, SyntheticEvent } from "react";
@ -203,17 +203,17 @@ function ThemesTab() {
return ( return (
<> <>
<Card className="vc-settings-card"> <Card className="vc-settings-card">
<Forms.FormTitle tag="h5">{$t("vencord.themes.findThemes")}</Forms.FormTitle> <Forms.FormTitle tag="h5">{t("vencord.themes.findThemes")}</Forms.FormTitle>
<div style={{ marginBottom: ".5em", display: "flex", flexDirection: "column" }}> <div style={{ marginBottom: ".5em", display: "flex", flexDirection: "column" }}>
<Link style={{ marginRight: ".5em" }} href="https://betterdiscord.app/themes"> <Link style={{ marginRight: ".5em" }} href="https://betterdiscord.app/themes">
{$t("vencord.themes.betterDiscord")} {t("vencord.themes.betterDiscord")}
</Link> </Link>
<Link href="https://github.com/search?q=discord+theme">GitHub</Link> <Link href="https://github.com/search?q=discord+theme">GitHub</Link>
</div> </div>
<Forms.FormText>{$t("vencord.themes.betterDiscordNote")}</Forms.FormText> <Forms.FormText>{t("vencord.themes.betterDiscordNote")}</Forms.FormText>
</Card> </Card>
<Forms.FormSection title={$t("vencord.themes.local")}> <Forms.FormSection title={t("vencord.themes.local")}>
<Card className="vc-settings-quick-actions-card"> <Card className="vc-settings-quick-actions-card">
<> <>
{IS_WEB ? {IS_WEB ?
@ -222,7 +222,7 @@ function ThemesTab() {
size={Button.Sizes.SMALL} size={Button.Sizes.SMALL}
disabled={themeDirPending} disabled={themeDirPending}
> >
{$t("vencord.themes.upload")} {t("vencord.themes.upload")}
<FileInput <FileInput
ref={fileInputRef} ref={fileInputRef}
onChange={onFileUpload} onChange={onFileUpload}
@ -236,20 +236,20 @@ function ThemesTab() {
size={Button.Sizes.SMALL} size={Button.Sizes.SMALL}
disabled={themeDirPending} disabled={themeDirPending}
> >
{$t("vencord.themes.openFolder")} {t("vencord.themes.openFolder")}
</Button> </Button>
)} )}
<Button <Button
onClick={refreshLocalThemes} onClick={refreshLocalThemes}
size={Button.Sizes.SMALL} size={Button.Sizes.SMALL}
> >
{$t("vencord.themes.loadMissing")} {t("vencord.themes.loadMissing")}
</Button> </Button>
<Button <Button
onClick={() => VencordNative.quickCss.openEditor()} onClick={() => VencordNative.quickCss.openEditor()}
size={Button.Sizes.SMALL} size={Button.Sizes.SMALL}
> >
{$t("vencord.themes.editQuickCss")} {t("vencord.themes.editQuickCss")}
</Button> </Button>
{Vencord.Settings.plugins.ClientTheme.enabled && ( {Vencord.Settings.plugins.ClientTheme.enabled && (
@ -263,7 +263,7 @@ function ThemesTab() {
))} ))}
size={Button.Sizes.SMALL} size={Button.Sizes.SMALL}
> >
{$t("clientTheme.edit")} {t("clientTheme.edit")}
</Button> </Button>
)} )}
</> </>
@ -304,12 +304,12 @@ function ThemesTab() {
return ( return (
<> <>
<Card className="vc-settings-card vc-text-selectable"> <Card className="vc-settings-card vc-text-selectable">
<Forms.FormTitle tag="h5">{$t("vencord.themes.pasteLinks")}</Forms.FormTitle> <Forms.FormTitle tag="h5">{t("vencord.themes.pasteLinks")}</Forms.FormTitle>
<Forms.FormText>{$t("vencord.themes.oneLinkPerLine")}</Forms.FormText> <Forms.FormText>{t("vencord.themes.oneLinkPerLine")}</Forms.FormText>
<Forms.FormText>{$t("vencord.themes.useDirect")}</Forms.FormText> <Forms.FormText>{t("vencord.themes.useDirect")}</Forms.FormText>
</Card> </Card>
<Forms.FormSection title={$t("vencord.themes.online")} tag="h5"> <Forms.FormSection title={t("vencord.themes.online")} tag="h5">
<TextArea <TextArea
value={themeText} value={themeText}
onChange={setThemeText} onChange={setThemeText}
@ -338,13 +338,13 @@ function ThemesTab() {
className="vc-settings-tab-bar-item" className="vc-settings-tab-bar-item"
id={ThemeTab.LOCAL} id={ThemeTab.LOCAL}
> >
{$t("vencord.themes.local")} {t("vencord.themes.local")}
</TabBar.Item> </TabBar.Item>
<TabBar.Item <TabBar.Item
className="vc-settings-tab-bar-item" className="vc-settings-tab-bar-item"
id={ThemeTab.ONLINE} id={ThemeTab.ONLINE}
> >
{$t("vencord.themes.online")} {t("vencord.themes.online")}
</TabBar.Item> </TabBar.Item>
</TabBar> </TabBar>

View file

@ -16,11 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { $t } from "@utils/translation"; import { t } from "@utils/translation";
import { maybePromptToUpdate } from "@utils/updater"; import { maybePromptToUpdate } from "@utils/updater";
export function handleComponentFailed() { export function handleComponentFailed() {
maybePromptToUpdate( maybePromptToUpdate(
$t("vencord.failureUpdate") t("vencord.failureUpdate")
); );
} }

View file

@ -10,7 +10,7 @@ import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { Margins } from "@utils/margins"; import { Margins } from "@utils/margins";
import { classes } from "@utils/misc"; import { classes } from "@utils/misc";
import { $t } from "@utils/translation"; import { t } from "@utils/translation";
import definePlugin, { OptionType, StartAt } from "@utils/types"; import definePlugin, { OptionType, StartAt } from "@utils/types";
import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack"; import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack";
import { Button, Forms, useStateFromStores } from "@webpack/common"; import { Button, Forms, useStateFromStores } from "@webpack/common";
@ -113,7 +113,7 @@ const settings = definePluginSettings({
export default definePlugin({ export default definePlugin({
name: "ClientTheme", name: "ClientTheme",
authors: [Devs.F53, Devs.Nuckyz], authors: [Devs.F53, Devs.Nuckyz],
description: $t("clientTheme.description"), description: t("clientTheme.description"),
settings, settings,
startAt: StartAt.DOMContentLoaded, startAt: StartAt.DOMContentLoaded,

View file

@ -23,7 +23,7 @@ import { OAuth2AuthorizeModal, UserStore } from "@webpack/common";
import { Logger } from "./Logger"; import { Logger } from "./Logger";
import { openModal } from "./modal"; import { openModal } from "./modal";
import { $t } from "./translation"; import { t } from "./translation";
export const cloudLogger = new Logger("Cloud", "#39b7e0"); export const cloudLogger = new Logger("Cloud", "#39b7e0");
export const getCloudUrl = () => new URL(Settings.cloud.url); export const getCloudUrl = () => new URL(Settings.cloud.url);
@ -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.cloudIntegrations"), title: t("vencord.cloudIntegrations"),
body: $t("vencord.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.cloudIntegrations"), title: t("vencord.cloudIntegrations"),
body: $t("vencord.cloud.integrations.enabled") body: t("vencord.cloud.integrations.enabled")
}); });
Settings.cloud.authenticated = true; Settings.cloud.authenticated = true;
} else { } else {
showNotification({ showNotification({
title: $t("vencord.cloudIntegrations"), title: t("vencord.cloudIntegrations"),
body: $t("vencord.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.cloudIntegrations"), title: t("vencord.cloudIntegrations"),
body: $t("vencord.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

@ -19,7 +19,7 @@
import { Clipboard, Toasts } from "@webpack/common"; import { Clipboard, Toasts } from "@webpack/common";
import { DevsById } from "./constants"; import { DevsById } from "./constants";
import { $t } from "./translation"; import { t } from "./translation";
/** /**
* Calls .join(" ") on the arguments * Calls .join(" ") on the arguments
@ -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.copiedToClipboard"); toastMessage ??= t("vencord.copiedToClipboard");
if (Clipboard.SUPPORTS_COPY) { if (Clipboard.SUPPORTS_COPY) {
Clipboard.copy(text); Clipboard.copy(text);
} else { } else {
toastMessage = $t("vencord.clipboardNotSupported"); toastMessage = t("vencord.clipboardNotSupported");
} }
Toasts.show({ Toasts.show({
message: toastMessage, message: toastMessage,

View file

@ -24,7 +24,7 @@ import { deflateSync, inflateSync } from "fflate";
import { getCloudAuth, getCloudUrl } from "./cloud"; import { getCloudAuth, getCloudUrl } from "./cloud";
import { Logger } from "./Logger"; import { Logger } from "./Logger";
import { relaunch } from "./native"; import { relaunch } from "./native";
import { $t } from "./translation"; import { t } from "./translation";
import { chooseFile, saveFile } from "./web"; import { chooseFile, saveFile } from "./web";
export async function importSettings(data: string) { export async function importSettings(data: string) {
@ -69,10 +69,10 @@ const toast = (type: number, message: string) =>
}); });
const toastSuccess = () => const toastSuccess = () =>
toast(Toasts.Type.SUCCESS, $t("vencord.importedSettings")); toast(Toasts.Type.SUCCESS, t("vencord.importedSettings"));
const toastFailure = (err: any) => const toastFailure = (err: any) =>
toast(Toasts.Type.FAILURE, $t("vencord.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.cloudSettings"), title: t("vencord.cloudSettings"),
body: $t("vencord.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.cloudSettings"), title: t("vencord.cloudSettings"),
body: $t("vencord.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.cloudSettings"), title: t("vencord.cloudSettings"),
body: $t("vencord.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.cloudSettings"), title: t("vencord.cloudSettings"),
body: $t("vencord.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.cloudSettings"), title: t("vencord.cloudSettings"),
body: $t("vencord.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.cloudSettings"), title: t("vencord.cloudSettings"),
body: $t("vencord.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.cloudSettings"), title: t("vencord.cloudSettings"),
body: $t("vencord.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.cloudSettings"), title: t("vencord.cloudSettings"),
body: $t("vencord.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.cloudSettings"), title: t("vencord.cloudSettings"),
body: $t("vencord.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.cloudSettings"), title: t("vencord.cloudSettings"),
body: $t("vencord.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.cloudSettings"), title: t("vencord.cloudSettings"),
body: $t("vencord.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.cloudSettings"), title: t("vencord.cloudSettings"),
body: $t("vencord.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

@ -100,7 +100,7 @@ function _t(key: string, bundle: any): Translation {
* @param variables The variables to interpolate into the resultant string. If dealing with plurals, `count` must be set. * @param variables The variables to interpolate into the resultant string. If dealing with plurals, `count` must be set.
* @returns A translated string. * @returns A translated string.
*/ */
export function $t(key: string, variables?: Record<string, any>): string { export function t(key: string, variables?: Record<string, any>): string {
const getter = (): string => { const getter = (): string => {
const translation = _t(key, loadedLocale); const translation = _t(key, loadedLocale);
@ -153,13 +153,13 @@ interface TranslateProps {
} }
/** /**
* A translation component. Follows the same rules as {@link $t}, but lets you add components to strings. * A translation component. Follows the same rules as {@link t}, but lets you add components to strings.
* @param param0 Component props. * @param param0 Component props.
*/ */
export function Translate({ i18nKey, variables, children: trueChildren }: TranslateProps): JSX.Element { export function Translate({ i18nKey, variables, children: trueChildren }: TranslateProps): JSX.Element {
const children = [trueChildren].flat(); const children = [trueChildren].flat();
const translation = $t(i18nKey, variables); const translation = t(i18nKey, variables);
const parts = translation.split(/(<\d+>.*?<\/\d+>)/g); const parts = translation.split(/(<\d+>.*?<\/\d+>)/g);

View file

@ -20,7 +20,7 @@ import gitHash from "~git-hash";
import { Logger } from "./Logger"; import { Logger } from "./Logger";
import { relaunch } from "./native"; import { relaunch } from "./native";
import { $t } from "./translation"; import { t } from "./translation";
import { IpcRes } from "./types"; import { IpcRes } from "./types";
export const UpdateLogger = /* #__PURE__*/ new Logger("Updater", "white"); export const UpdateLogger = /* #__PURE__*/ new Logger("Updater", "white");
@ -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.gitCopyNewer")); 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.updaterRepeatFailed")); alert(t("vencord.updaterRepeatFailed"));
} }
} }