更新国际化支持:为订阅历史对话框及相关组件添加多语言文本,提升用户体验

This commit is contained in:
jxxghp
2025-04-28 22:14:24 +08:00
parent 4682cdb1a8
commit 7879a75ba8
4 changed files with 37 additions and 38 deletions
@@ -4,6 +4,11 @@ import { Subscribe } from '@/api/types'
import { formatDateDifference } from '@core/utils/formatters' import { formatDateDifference } from '@core/utils/formatters'
import { useDisplay } from 'vuetify' import { useDisplay } from 'vuetify'
import ProgressDialog from './ProgressDialog.vue' import ProgressDialog from './ProgressDialog.vue'
import { useI18n } from 'vue-i18n'
import { getMediaTypeText } from '@/types/i18n-type'
// 国际化
const { t } = useI18n()
// 显示器宽度 // 显示器宽度
const display = useDisplay() const display = useDisplay()
@@ -38,7 +43,7 @@ const isRefreshed = ref(false)
const progressDialog = ref(false) const progressDialog = ref(false)
// 进度文字 // 进度文字
const progressText = ref('正在重新订阅...') const progressText = ref('')
// 调用API查询列表 // 调用API查询列表
async function loadHistory({ done }: { done: any }) { async function loadHistory({ done }: { done: any }) {
@@ -82,8 +87,11 @@ async function loadHistory({ done }: { done: any }) {
// 重新订阅 // 重新订阅
async function reSubscribe(item: Subscribe) { async function reSubscribe(item: Subscribe) {
if (item.type === '电影') progressText.value = `正在重新订阅 ${item.name} ...` if (item.type === '电影') {
else progressText.value = `正在重新订阅 ${item.name}${item.season} 季 ...` progressText.value = t('dialog.subscribeHistory.resubscribeMovie', { name: item.name })
} else {
progressText.value = t('dialog.subscribeHistory.resubscribeTv', { name: item.name, season: item.season })
}
progressDialog.value = true progressDialog.value = true
try { try {
const result: { [key: string]: any } = await api.post('subscribe/', item) const result: { [key: string]: any } = await api.post('subscribe/', item)
@@ -111,7 +119,7 @@ async function deleteHistory(item: Subscribe) {
// 弹出菜单 // 弹出菜单
const dropdownItems = ref([ const dropdownItems = ref([
{ {
title: '重新订阅', title: t('dialog.subscribeHistory.resubscribe'),
value: 1, value: 1,
color: '', color: '',
props: { props: {
@@ -120,7 +128,7 @@ const dropdownItems = ref([
}, },
}, },
{ {
title: '删除', title: t('common.delete'),
value: 2, value: 2,
color: 'error', color: 'error',
props: { props: {
@@ -135,7 +143,7 @@ const dropdownItems = ref([
<VDialog scrollable max-width="50rem" :fullscreen="!display.mdAndUp.value"> <VDialog scrollable max-width="50rem" :fullscreen="!display.mdAndUp.value">
<VCard class="mx-auto" width="100%"> <VCard class="mx-auto" width="100%">
<VCardItem> <VCardItem>
<VCardTitle>{{ props.type + '订阅历史' }}</VCardTitle> <VCardTitle>{{ t('dialog.subscribeHistory.title', { type: getMediaTypeText(props.type) }) }}</VCardTitle>
</VCardItem> </VCardItem>
<VDivider /> <VDivider />
<VDialogCloseBtn @click="emit('close')" /> <VDialogCloseBtn @click="emit('close')" />
@@ -165,7 +173,8 @@ const dropdownItems = ref([
</VImg> </VImg>
</template> </template>
<VListItemTitle v-if="item.type == '电视剧'"> <VListItemTitle v-if="item.type == '电视剧'">
{{ item.name }} <span class="text-sm"> {{ item.season }} </span> {{ item.name }}
<span class="text-sm">{{ t('dialog.subscribeHistory.season', { season: item.season }) }}</span>
</VListItemTitle> </VListItemTitle>
<VListItemTitle v-else> <VListItemTitle v-else>
{{ item.name }} {{ item.name }}
@@ -199,7 +208,9 @@ const dropdownItems = ref([
</template> </template>
</VInfiniteScroll> </VInfiniteScroll>
</VList> </VList>
<VCardText v-if="historyList.length === 0 && isRefreshed" class="text-center"> 没有已完成的订阅 </VCardText> <VCardText v-if="historyList.length === 0 && isRefreshed" class="text-center">{{
t('dialog.subscribeHistory.noData')
}}</VCardText>
</VCard> </VCard>
<!-- 进度框 --> <!-- 进度框 -->
<ProgressDialog v-if="progressDialog" v-model="progressDialog" :text="progressText" /> <ProgressDialog v-if="progressDialog" v-model="progressDialog" :text="progressText" />
+6 -10
View File
@@ -1529,16 +1529,12 @@ export default {
season: 'Season {number}', season: 'Season {number}',
}, },
subscribeHistory: { subscribeHistory: {
title: 'Subscription History', title: '{type} Subscription History',
name: 'Name', resubscribe: 'Resubscribe',
time: 'Time', resubscribeMovie: 'Resubscribing {name}...',
type: 'Type', resubscribeTv: 'Resubscribing {name} Season {season}...',
mediaName: 'Media Name', season: 'Season {season}',
message: 'Message', noData: 'No completed subscriptions',
torrents: 'Torrents',
episodes: 'Episodes',
noRecords: 'No records',
close: 'Close',
}, },
subscribeSeason: { subscribeSeason: {
title: 'Select Season', title: 'Select Season',
+6 -10
View File
@@ -1506,16 +1506,12 @@ export default {
season: '第 {number} 季', season: '第 {number} 季',
}, },
subscribeHistory: { subscribeHistory: {
title: '订阅历史', title: '{type}订阅历史',
name: '名称', resubscribe: '重新订阅',
time: '时间', resubscribeMovie: '正在重新订阅 {name}...',
type: '类型', resubscribeTv: '正在重新订阅 {name} 第 {season} 季...',
mediaName: '媒体名称', season: '第 {season} 季',
message: '消息', noData: '没有已完成的订阅',
torrents: '种子',
episodes: '集数',
noRecords: '无记录',
close: '关闭',
}, },
subscribeSeason: { subscribeSeason: {
title: '选择季', title: '选择季',
+6 -10
View File
@@ -1503,16 +1503,12 @@ export default {
season: '第 {number} 季', season: '第 {number} 季',
}, },
subscribeHistory: { subscribeHistory: {
title: '訂閱歷史', title: '{type}訂閱歷史',
name: '名稱', resubscribe: '重新訂閱',
time: '時間', resubscribeMovie: '正在重新訂閱 {name}...',
type: '類型', resubscribeTv: '正在重新訂閱 {name} 第 {season} 季...',
mediaName: '媒體名稱', season: '第 {season} 季',
message: '消息', noData: '沒有已完成的訂閱',
torrents: '種子',
episodes: '集數',
noRecords: '無記錄',
close: '關閉',
}, },
subscribeSeason: { subscribeSeason: {
title: '選擇季', title: '選擇季',