From 40711fa6401258d9e77348ddd97bba2153daf369 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 28 Apr 2025 19:54:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E6=94=AF=E6=8C=81=EF=BC=9A=E4=B8=BA=E4=B8=8B=E8=BD=BD=E5=99=A8?= =?UTF-8?q?=E5=92=8C=E8=BF=87=E6=BB=A4=E8=A7=84=E5=88=99=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A4=9A=E8=AF=AD=E8=A8=80=E6=96=87=E6=9C=AC?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E5=8D=87=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/cards/DownloaderCard.vue | 74 +++++++++++--------- src/components/cards/FilterRuleCard.vue | 8 ++- src/components/cards/FilterRuleGroupCard.vue | 55 ++++++++------- src/locales/en-US.ts | 44 ++++++++++++ src/locales/zh-CN.ts | 36 ++++++++++ src/locales/zh-TW.ts | 34 +++++++++ 6 files changed, 189 insertions(+), 62 deletions(-) diff --git a/src/components/cards/DownloaderCard.vue b/src/components/cards/DownloaderCard.vue index 59f78698..349758d5 100644 --- a/src/components/cards/DownloaderCard.vue +++ b/src/components/cards/DownloaderCard.vue @@ -7,6 +7,10 @@ import type { DownloaderInfo } from '@/api/types' import qbittorrent_image from '@images/logos/qbittorrent.png' import transmission_image from '@images/logos/transmission.png' import { cloneDeep } from 'lodash-es' +import { useI18n } from 'vue-i18n' + +// 获取i18n实例 +const { t } = useI18n() // 定义输入 const props = defineProps({ @@ -91,12 +95,12 @@ function openDownloaderInfoDialog() { function saveDownloaderInfo() { // 为空不保存,跳出警告框 if (!downloaderInfo.value.name) { - $toast.error('名称不能为空,请输入后再确定') + $toast.error(t('downloader.nameRequired')) return } // 重名判断 if (props.downloaders.some(item => item.name === downloaderInfo.value.name && item !== props.downloader)) { - $toast.error(`【${downloaderInfo.value.name}】已存在,请替换为其他名称`) + $toast.error(t('downloader.nameDuplicate')) return } // 默认下载器去重 @@ -104,7 +108,7 @@ function saveDownloaderInfo() { props.downloaders.forEach(item => { if (item.default && item !== props.downloader) { item.default = false - $toast.info(`存在默认下载器【${item.name}】,已替换成【${downloaderInfo.value.name}】`) + $toast.info(t('downloader.defaultChanged')) } }) } @@ -180,26 +184,30 @@ onUnmounted(() => { - + - + - + @@ -207,9 +215,9 @@ onUnmounted(() => { @@ -217,8 +225,8 @@ onUnmounted(() => { @@ -227,8 +235,8 @@ onUnmounted(() => { @@ -236,8 +244,8 @@ onUnmounted(() => { @@ -245,8 +253,8 @@ onUnmounted(() => { @@ -254,8 +262,8 @@ onUnmounted(() => { @@ -263,8 +271,8 @@ onUnmounted(() => { @@ -274,9 +282,9 @@ onUnmounted(() => { @@ -284,9 +292,9 @@ onUnmounted(() => { @@ -294,8 +302,8 @@ onUnmounted(() => { @@ -304,8 +312,8 @@ onUnmounted(() => { @@ -315,7 +323,7 @@ onUnmounted(() => { - 确定 + {{ t('common.save') }} diff --git a/src/components/cards/FilterRuleCard.vue b/src/components/cards/FilterRuleCard.vue index f9fc3c6f..21353908 100644 --- a/src/components/cards/FilterRuleCard.vue +++ b/src/components/cards/FilterRuleCard.vue @@ -2,6 +2,10 @@ import { innerFilterRules } from '@/api/constants' import { CustomRule } from '@/api/types' import { cloneDeep } from 'lodash-es' +import { useI18n } from 'vue-i18n' + +// 获取i18n实例 +const { t } = useI18n() // 输入参数 const props = defineProps({ @@ -49,7 +53,7 @@ onMounted(() => { - 优先级 {{ props.pri }} + {{ t('filterRule.priority') }} {{ props.pri }} { variant="underlined" :items="selectFilterOptions" chips - label="" + :label="t('filterRule.rules')" multiple clearable @update:modelValue="filtersChanged" diff --git a/src/components/cards/FilterRuleGroupCard.vue b/src/components/cards/FilterRuleGroupCard.vue index dcad3c86..06d99ed6 100644 --- a/src/components/cards/FilterRuleGroupCard.vue +++ b/src/components/cards/FilterRuleGroupCard.vue @@ -7,6 +7,10 @@ import { useToast } from 'vue-toast-notification' import ImportCodeDialog from '@/components/dialog/ImportCodeDialog.vue' import filter_group_svg from '@images/svg/filter-group.svg' import { cloneDeep } from 'lodash-es' +import { useI18n } from 'vue-i18n' + +// 获取i18n实例 +const { t } = useI18n() // 输入参数 const props = defineProps({ @@ -56,14 +60,14 @@ const groupInfo = ref({ // 媒体类型字典 const mediaTypeItems = [ - { title: '通用', value: '' }, - { title: '电影', value: '电影' }, - { title: '电视剧', value: '电视剧' }, + { title: t('common.all'), value: '' }, + { title: t('mediaType.movie'), value: '电影' }, + { title: t('mediaType.tv'), value: '电视剧' }, ] // 根据选中的媒体类型,获取对应的媒体类别 const getCategories = computed(() => { - const default_value = [{ title: '全部', value: '' }] + const default_value = [{ title: t('common.all'), value: '' }] if (!props.categories || !groupInfo.value.media_type || !props.categories[groupInfo.value.media_type]) { return default_value } @@ -72,11 +76,6 @@ const getCategories = computed(() => { // 规则组规则卡片列表 const filterRuleCards = ref([]) -// 规则组类型,仅用于导入判断 -const filterRuleCardsType = ref({ - pri: '', - rules: [], -}) // 导入代码弹窗 const importCodeDialog = ref(false) @@ -112,10 +111,10 @@ async function shareRules() { try { let success success = copyToClipboard(value) - if (await success) $toast.success('优先级规则已复制到剪贴板!') - else $toast.error('优先级规则复制失败:可能是浏览器不支持或被用户阻止!') + if (await success) $toast.success(t('filterRule.shareSuccess')) + else $toast.error(t('filterRule.shareFailed')) } catch (error) { - $toast.error('优先级规则复制失败!') + $toast.error(t('filterRule.shareFailed')) console.error(error) } } @@ -143,7 +142,7 @@ function saveCodeString(type: string, code: any) { })) } } catch (error) { - $toast.error('导入失败!') + $toast.error(t('filterRule.importFailed')) console.error(error) } } @@ -177,11 +176,11 @@ function opengroupInfoDialog() { // 保存详情数据 function saveGroupInfo() { if (!groupInfo.value.name.trim()) { - $toast.error('规则组名称不能为空') + $toast.error(t('filterRule.nameRequired')) return } if (props.groups.some(item => item.name === groupInfo.value.name && item !== props.group)) { - $toast.error(`规则组名称【${groupInfo.value.name}】已存在,请替换`) + $toast.error(t('filterRule.nameDuplicate')) return } @@ -213,7 +212,7 @@ function onClose() {
{{ props.group.name }}
- {{ props.group.media_type || '通用' }} + {{ props.group.media_type || t('common.all') }} {{ props.group.category }}
@@ -221,7 +220,7 @@ function onClose() {
- + @@ -229,9 +228,9 @@ function onClose() { @@ -239,9 +238,9 @@ function onClose() { @@ -250,8 +249,8 @@ function onClose() { @@ -278,7 +277,7 @@ function onClose() { /> -
请添加或导入规则
+
{{ t('filterRule.add') }}
@@ -291,14 +290,16 @@ function onClose() { - 确定 + + {{ t('common.save') }} +