summaryrefslogtreecommitdiff
path: root/frontend/src/components/settings/pages/plugin_list
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/components/settings/pages/plugin_list')
-rw-r--r--frontend/src/components/settings/pages/plugin_list/index.tsx35
1 files changed, 26 insertions, 9 deletions
diff --git a/frontend/src/components/settings/pages/plugin_list/index.tsx b/frontend/src/components/settings/pages/plugin_list/index.tsx
index ac954601..d7ff7bd9 100644
--- a/frontend/src/components/settings/pages/plugin_list/index.tsx
+++ b/frontend/src/components/settings/pages/plugin_list/index.tsx
@@ -10,8 +10,10 @@ import {
showContextMenu,
} from 'decky-frontend-lib';
import { useEffect, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { FaDownload, FaEllipsisH, FaRecycle } from 'react-icons/fa';
+import { InstallType } from '../../../../plugin';
import { StorePluginVersion, getPluginList, requestPluginInstall } from '../../../../store';
import { useSetting } from '../../../../utils/hooks/useSetting';
import { useDeckyState } from '../../../DeckyState';
@@ -25,19 +27,33 @@ async function reinstallPlugin(pluginName: string, currentVersion?: string) {
const remotePlugin = serverData?.find((x) => x.name == pluginName);
if (remotePlugin && remotePlugin.versions?.length > 0) {
const currentVersionData = remotePlugin.versions.find((version) => version.name == currentVersion);
- if (currentVersionData) requestPluginInstall(pluginName, currentVersionData);
+ if (currentVersionData) requestPluginInstall(pluginName, currentVersionData, InstallType.REINSTALL);
}
}
function PluginInteractables(props: { entry: ReorderableEntry<PluginData> }) {
const data = props.entry.data;
+ const { t } = useTranslation();
let pluginName = labelToName(props.entry.label, data?.version);
const showCtxMenu = (e: MouseEvent | GamepadEvent) => {
showContextMenu(
- <Menu label="Plugin Actions">
- <MenuItem onSelected={() => window.DeckyPluginLoader.importPlugin(pluginName, data?.version)}>Reload</MenuItem>
- <MenuItem onSelected={() => window.DeckyPluginLoader.uninstallPlugin(pluginName)}>Uninstall</MenuItem>
+ <Menu label={t('PluginListIndex.plugin_actions')}>
+ <MenuItem onSelected={() => window.DeckyPluginLoader.importPlugin(pluginName, data?.version)}>
+ {t('PluginListIndex.reload')}
+ </MenuItem>
+ <MenuItem
+ onSelected={() =>
+ window.DeckyPluginLoader.uninstallPlugin(
+ pluginName,
+ t('PluginLoader.plugin_uninstall.title', { name: pluginName }),
+ t('PluginLoader.plugin_uninstall.button'),
+ t('PluginLoader.plugin_uninstall.desc', { name: pluginName }),
+ )
+ }
+ >
+ {t('PluginListIndex.uninstall')}
+ </MenuItem>
</Menu>,
e.currentTarget ?? window,
);
@@ -48,11 +64,11 @@ function PluginInteractables(props: { entry: ReorderableEntry<PluginData> }) {
{data?.update ? (
<DialogButton
style={{ height: '40px', minWidth: '60px', marginRight: '10px' }}
- onClick={() => requestPluginInstall(pluginName, data?.update as StorePluginVersion)}
- onOKButton={() => requestPluginInstall(pluginName, data?.update as StorePluginVersion)}
+ onClick={() => requestPluginInstall(pluginName, data?.update as StorePluginVersion, InstallType.UPDATE)}
+ onOKButton={() => requestPluginInstall(pluginName, data?.update as StorePluginVersion, InstallType.UPDATE)}
>
<div style={{ display: 'flex', flexDirection: 'row' }}>
- Update to {data?.update?.name}
+ {t('PluginListIndex.update_to', { name: data?.update?.name })}
<FaDownload style={{ paddingLeft: '2rem' }} />
</div>
</DialogButton>
@@ -63,7 +79,7 @@ function PluginInteractables(props: { entry: ReorderableEntry<PluginData> }) {
onOKButton={() => reinstallPlugin(pluginName, data?.version)}
>
<div style={{ display: 'flex', flexDirection: 'row' }}>
- Reinstall
+ {t('PluginListIndex.reinstall')}
<FaRecycle style={{ paddingLeft: '5.3rem' }} />
</div>
</DialogButton>
@@ -90,6 +106,7 @@ export default function PluginList() {
'pluginOrder',
plugins.map((plugin) => plugin.name),
);
+ const { t } = useTranslation();
useEffect(() => {
window.DeckyPluginLoader.checkPluginUpdates();
@@ -115,7 +132,7 @@ export default function PluginList() {
if (plugins.length === 0) {
return (
<div>
- <p>No plugins installed</p>
+ <p>{t('PluginListIndex.no_plugin')}</p>
</div>
);
}