更新国际化支持:为工作流侧边栏及相关组件添加多语言文本,提升用户体验

This commit is contained in:
jxxghp
2025-04-29 08:15:19 +08:00
parent 48513efbe0
commit 2ae843fb3e
6 changed files with 74 additions and 1 deletions

1
components.d.ts vendored
View File

@@ -2,6 +2,7 @@
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
// biome-ignore lint: disable
export {}
/* prettier-ignore */

View File

@@ -3,6 +3,7 @@ import api from '@/api'
import useDragAndDrop from '@core/utils/workflow'
import { useDisplay } from 'vuetify'
import { useI18n } from 'vue-i18n'
import { getActionStepText } from '@/types/i18n-type'
interface ActionItem {
name: string
@@ -145,7 +146,7 @@ onMounted(() => {
<VIcon :icon="getActionIcon(action.type)" size="18" />
</VAvatar>
<div v-if="!isSidebarCollapsed || display.smAndDown.value" class="component-info">
<div class="component-name">{{ action.name }}</div>
<div class="component-name">{{ getActionStepText(action.name) }}</div>
<div class="component-desc">
{{ display.smAndDown.value ? t('workflow.clickToAdd') : t('workflow.dragToCanvas') }}
</div>

View File

@@ -55,6 +55,21 @@ export default {
plugin: 'Plugin',
other: 'Other',
},
actionStep: {
addDownload: 'Add Download',
addSubscribe: 'Add Subscribe',
fetchDownloads: 'Fetch Downloads',
fetchMedias: 'Fetch Media',
fetchRss: 'Fetch RSS',
fetchTorrents: 'Fetch Torrents',
filterMedias: 'Filter Media',
filterTorrents: 'Filter Torrents',
scanFile: 'Scan Directory',
scrapeFile: 'Scrape File',
sendEvent: 'Send Event',
sendMessage: 'Send Message',
transferFile: 'Transfer File',
},
theme: {
light: 'Light',
dark: 'Dark',

View File

@@ -55,6 +55,21 @@ export default {
plugin: '插件',
other: '其它',
},
actionStep: {
addDownload: '添加下载',
addSubscribe: '添加订阅',
fetchDownloads: '获取下载任务',
fetchMedias: '获取媒体',
fetchRss: '获取RSS资源',
fetchTorrents: '获取站点资源',
filterMedias: '过滤媒体',
filterTorrents: '过滤资源',
scanFile: '扫描目录',
scrapeFile: '刮削文件',
sendEvent: '发送事件',
sendMessage: '发送消息',
transferFile: '整理文件',
},
theme: {
light: '浅色',
dark: '深色',

View File

@@ -55,6 +55,21 @@ export default {
plugin: '插件',
other: '其它',
},
actionStep: {
addDownload: '添加下載',
addSubscribe: '添加訂閱',
fetchDownloads: '獲取下載任務',
fetchMedias: '獲取媒體數據',
fetchRss: '獲取RSS資源',
fetchTorrents: '獲取站點資源',
filterMedias: '過濾媒體數據',
filterTorrents: '過濾資源',
scanFile: '掃描目錄',
scrapeFile: '刮削文件',
sendEvent: '發送事件',
sendMessage: '發送消息',
transferFile: '整理文件',
},
theme: {
light: '淺色',
dark: '深色',

View File

@@ -42,3 +42,29 @@ export function getNotificationSwitchText(label: string | undefined) {
return t(switchMap[label])
}
}
// actionStep
export function getActionStepText(label: string | undefined) {
if (!label) return ''
const { t } = useI18n()
const stepMap: Record<string, string> = {
'添加下载': 'actionStep.addDownload',
'添加订阅': 'actionStep.addSubscribe',
'获取下载任务': 'actionStep.fetchDownloads',
'获取媒体数据': 'actionStep.fetchMedias',
'获取RSS资源': 'actionStep.fetchRss',
'搜索站点资源': 'actionStep.fetchTorrents',
'过滤媒体数据': 'actionStep.filterMedias',
'过滤资源': 'actionStep.filterTorrents',
'扫描目录': 'actionStep.scanFile',
'刮削文件': 'actionStep.scrapeFile',
'发送事件': 'actionStep.sendEvent',
'发送消息': 'actionStep.sendMessage',
'整理文件': 'actionStep.transferFile',
}
if (label in stepMap) {
return t(stepMap[label])
}
}