更新国际化支持:为存储、媒体类型、通知开关及操作步骤等组件添加多语言文本,提升用户体验

This commit is contained in:
jxxghp
2025-04-29 13:24:27 +08:00
parent b75c93231e
commit b772e2d9ef
21 changed files with 566 additions and 386 deletions

View File

@@ -106,7 +106,7 @@ function onClose() {
<VImg :src="filter_svg" cover class="mt-7" max-width="3rem" />
</VCardText>
</VCard>
<VDialog v-if="ruleInfoDialog" v-model="ruleInfoDialog" scrollable max-width="40rem" persistent>
<VDialog v-if="ruleInfoDialog" v-model="ruleInfoDialog" scrollable max-width="40rem">
<VCard :title="t('customRule.title', { id: props.rule.id })" class="rounded-t">
<VDialogCloseBtn v-model="ruleInfoDialog" />
<VDivider />

View File

@@ -219,7 +219,7 @@ function onClose() {
<VImg :src="filter_group_svg" cover class="mt-10" max-width="3rem" />
</VCardText>
</VCard>
<VDialog v-if="groupInfoDialog" v-model="groupInfoDialog" scrollable max-width="80rem" persistent>
<VDialog v-if="groupInfoDialog" v-model="groupInfoDialog" scrollable max-width="80rem">
<VCard :title="`${props.group.name} - ${t('filterRule.title')}`" class="rounded-t">
<VDialogCloseBtn v-model="groupInfoDialog" />
<VDivider />
@@ -228,9 +228,9 @@ function onClose() {
<VCol cols="12" md="6">
<VTextField
v-model="groupInfo.name"
:label="t('filterRule.name')"
:label="t('filterRule.groupName')"
:placeholder="t('filterRule.nameRequired')"
:hint="t('filterRule.name')"
:hint="t('filterRule.groupName')"
persistent-hint
active
/>

View File

@@ -14,7 +14,7 @@ import SubscribeEditDialog from '../dialog/SubscribeEditDialog.vue'
import SearchSiteDialog from '@/components/dialog/SearchSiteDialog.vue'
import SubscribeSeasonDialog from '../dialog/SubscribeSeasonDialog.vue'
import { useI18n } from 'vue-i18n'
import { getMediaTypeText } from '@/types/i18n-type'
import { mediaTypeDict } from '@/api/constants'
// 国际化
const { t } = useI18n()
@@ -402,15 +402,6 @@ function setupIntersectionObserver() {
}
}
onMounted(() => {
setupIntersectionObserver()
})
onBeforeUnmount(() => {
observer.value?.disconnect()
observer.value = null
})
// 计算图片地址
const getImgUrl: Ref<string> = computed(() => {
if (imageLoadError.value) return noImage
@@ -428,6 +419,21 @@ const getImgUrl: Ref<string> = computed(() => {
function onRemoveSubscribe() {
subscribeEditDialog.value = false
}
// 获取媒体类型文本
function getMediaTypeText(type: string | undefined) {
if (!type) return ''
return mediaTypeDict[type]
}
onMounted(() => {
setupIntersectionObserver()
})
onBeforeUnmount(() => {
observer.value?.disconnect()
observer.value = null
})
</script>
<template>

View File

@@ -192,7 +192,7 @@ onMounted(() => {
<VImg :src="getIcon" cover class="mt-7 me-3" max-width="3rem" min-width="3rem" />
</VCardText>
</VCard>
<VDialog v-if="mediaServerInfoDialog" v-model="mediaServerInfoDialog" scrollable max-width="40rem" persistent>
<VDialog v-if="mediaServerInfoDialog" v-model="mediaServerInfoDialog" scrollable max-width="40rem">
<VCard :title="`${props.mediaserver.name} - ${t('common.config')}`" class="rounded-t">
<VDialogCloseBtn v-model="mediaServerInfoDialog" />
<VDivider />

View File

@@ -134,7 +134,7 @@ function onClose() {
<VImg :src="getIcon" cover class="mt-7 me-3" max-width="3rem" />
</VCardText>
</VCard>
<VDialog v-if="notificationInfoDialog" v-model="notificationInfoDialog" scrollable max-width="40rem" persistent>
<VDialog v-if="notificationInfoDialog" v-model="notificationInfoDialog" scrollable max-width="40rem">
<VCard :title="`${props.notification.name} - ${t('notification.config')}`" class="rounded-t">
<VDialogCloseBtn v-model="notificationInfoDialog" />
<VDivider />

View File

@@ -14,6 +14,7 @@ import AlistConfigDialog from '../dialog/AlistConfigDialog.vue'
import { useToast } from 'vue-toast-notification'
import { isNullOrEmptyObject } from '@/@core/utils'
import { useI18n } from 'vue-i18n'
import { storageOptions } from '@/api/constants'
// 国际化
const { t } = useI18n()
@@ -127,6 +128,11 @@ function handleDone() {
emit('done')
}
// 根据存储类型获取文本
function getStorageTypeText(type: string) {
return storageOptions.find((option) => option.value === type)?.title
}
onMounted(() => {
queryStorage()
})
@@ -136,7 +142,7 @@ onMounted(() => {
<VCard variant="tonal" @click="openStorageDialog">
<VCardText class="flex justify-space-between align-center gap-3">
<div class="align-self-start flex-1">
<h5 class="text-h6 mb-1">{{ storage.name }}</h5>
<h5 class="text-h6 mb-1">{{ getStorageTypeText(storage.type) }}</h5>
<div class="mb-3 text-sm" v-if="total">{{ formatBytes(used, 1) }} / {{ formatBytes(total, 1) }}</div>
<div v-else-if="isNullOrEmptyObject(storage.config)">{{ t('storage.notConfigured') }}</div>
</div>