diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/index.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/index.tsx index 6e143b4523..71cda8814d 100644 --- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/index.tsx +++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/index.tsx @@ -1,9 +1,12 @@ 'use client' import type { FC } from 'react' -import React, { useCallback } from 'react' -import type { AutoUpdateConfig } from './types' +import React, { useCallback, useMemo } from 'react' +import { AUTO_UPDATE_STRATEGY, type AutoUpdateConfig } from './types' import Label from '../label' import StrategyPicker from './strategy-picker' +import { useTranslation } from 'react-i18next' + +const i18nPrefix = 'plugin.autoUpdate' type Props = { payload: AutoUpdateConfig @@ -14,7 +17,18 @@ const AutoUpdateSetting: FC = ({ payload, onChange, }) => { + const { t } = useTranslation() const { strategy_setting } = payload + const strategyDescription = useMemo(() => { + switch (strategy_setting) { + case AUTO_UPDATE_STRATEGY.fixOnly: + return t(`${i18nPrefix}.strategy.fixOnly.selectedDescription`) + case AUTO_UPDATE_STRATEGY.latest: + return t(`${i18nPrefix}.strategy.latest.selectedDescription`) + default: + return '' + } + }, [strategy_setting, t]) const handleChange = useCallback((key: keyof AutoUpdateConfig) => { return (value: AutoUpdateConfig[keyof AutoUpdateConfig]) => { onChange({ @@ -32,15 +46,19 @@ const AutoUpdateSetting: FC = ({
-
-
-
-
-
+ {strategy_setting !== AUTO_UPDATE_STRATEGY.disabled && ( + <> +
+
+
+
+ + )}
) diff --git a/web/i18n/en-US/plugin.ts b/web/i18n/en-US/plugin.ts index 2b6a517866..948be8fc3b 100644 --- a/web/i18n/en-US/plugin.ts +++ b/web/i18n/en-US/plugin.ts @@ -114,6 +114,9 @@ const translation = { noone: 'No one', }, autoUpdate: { + automaticUpdates: 'Automatic updates', + updateTime: 'Update time', + specifyPluginsToUpdate: 'Specify plugins to update', strategy: { disabled: { name: 'Disabled', @@ -122,10 +125,12 @@ const translation = { fixOnly: { name: 'Fix Only', description: 'Auto-update for patch versions only (e.g., 1.0.1 → 1.0.2). Minor version changes won\'t trigger updates.', + selectedDescription: 'Auto-update for patch versions only', }, latest: { name: 'Latest', description: 'Always update to latest version', + selectedDescription: 'Always update to latest version', }, }, }, diff --git a/web/i18n/zh-Hans/plugin.ts b/web/i18n/zh-Hans/plugin.ts index bc3e6b6784..0c03c27431 100644 --- a/web/i18n/zh-Hans/plugin.ts +++ b/web/i18n/zh-Hans/plugin.ts @@ -113,6 +113,27 @@ const translation = { admins: '管理员', noone: '无人', }, + autoUpdate: { + automaticUpdates: '自动更新', + updateTime: '更新时间', + specifyPluginsToUpdate: '指定要更新的插件', + strategy: { + disabled: { + name: '禁用', + description: '插件将不会自动更新', + }, + fixOnly: { + name: '仅修复', + description: '仅自动更新补丁版本(例如,1.0.1 → 1.0.2)。次要版本更改不会触发更新。', + selectedDescription: '仅自动更新补丁版本', + }, + latest: { + name: '最新', + description: '始终更新到最新版本', + selectedDescription: '始终更新到最新版本', + }, + }, + }, pluginInfoModal: { title: '插件信息', repository: '仓库',