更新国际化支持:为种子列表和卡片视图添加多语言文本,优化用户体验

This commit is contained in:
jxxghp
2025-04-28 17:19:59 +08:00
parent 6f78e8196b
commit bc841a630f
5 changed files with 65 additions and 47 deletions

View File

@@ -397,21 +397,23 @@ export default {
backButton: 'Go Back',
},
torrent: {
selectAll: 'Select All',
clear: 'Clear',
clearFilters: 'Clear Filters',
confirm: 'Confirm',
resources: 'resources',
noResults: 'No results found',
sortDefault: 'Default',
sortSite: 'Site',
sortSize: 'Size',
sortSeeder: 'Seeders',
sortSeeder: 'Seeder',
filterSite: 'Site',
filterSeason: 'Season/Episode',
filterFreeState: 'Promotion Status',
filterVideoCode: 'Video Codec',
filterEdition: 'Quality',
filterSeason: 'Season',
filterFreeState: 'Free State',
filterVideoCode: 'Video Code',
filterEdition: 'Edition',
filterResolution: 'Resolution',
filterReleaseGroup: 'Release Group',
clearFilters: 'Clear',
selectAll: 'Select All',
loadMore: 'Load More',
noMatchingResults: 'No matching results',
},
calendar: {
episode: 'Episode {number}',

View File

@@ -397,21 +397,23 @@ export default {
backButton: '返回',
},
torrent: {
selectAll: '全选',
clear: '清除',
clearFilters: '清除筛选',
confirm: '确定',
resources: '个资源',
noResults: '没有找到匹配的资源',
sortDefault: '默认',
sortSite: '站点',
sortSize: '大小',
sortSeeder: '做种数',
filterSite: '站点',
filterSeason: '季',
filterSeason: '季',
filterFreeState: '促销状态',
filterVideoCode: '视频编码',
filterEdition: '质量',
filterResolution: '分辨率',
filterReleaseGroup: '制作组',
clearFilters: '清除',
selectAll: '全选',
loadMore: '加载更多',
noMatchingResults: '没有匹配的结果',
},
calendar: {
episode: '第{number}集',

View File

@@ -397,10 +397,6 @@ export default {
backButton: '返回',
},
torrent: {
sortDefault: '默認',
sortSite: '站點',
sortSize: '大小',
sortSeeder: '做種數',
filterSite: '站點',
filterSeason: '季集',
filterFreeState: '促銷狀態',
@@ -408,10 +404,12 @@ export default {
filterEdition: '質量',
filterResolution: '分辨率',
filterReleaseGroup: '製作組',
clearFilters: '清除',
selectAll: '全選',
loadMore: '加載更多',
noMatchingResults: '沒有匹配的結果',
sortDefault: '默認',
sortSite: '站點',
sortSize: '大小',
sortSeeder: '做種數',
resources: '個資源',
noResults: '暫無符合條件的資源',
},
calendar: {
episode: '第{number}集',

View File

@@ -363,7 +363,7 @@ function loadMore({ done }: { done: any }) {
<VCard class="view-header rounded-xl">
<div class="d-flex align-center flex-wrap pa-3">
<VChip color="primary" variant="elevated" size="small" class="search-count me-3" prepend-icon="mdi-magnify">
{{ props.items?.length || 0 }} 个资源
{{ props.items?.length || 0 }} {{ t('torrent.resources') }}
</VChip>
<!-- 排序选择 -->
<div class="sort-container me-4">
@@ -401,7 +401,9 @@ function loadMore({ done }: { done: any }) {
<VCard max-width="25rem">
<VCardText class="filter-menu-content">
<div class="flex justify-between">
<VBtn variant="text" size="small" color="primary" @click="selectAll(key)"> 全选 </VBtn>
<VBtn variant="text" size="small" color="primary" @click="selectAll(key)">
{{ t('torrent.selectAll') }}
</VBtn>
<VBtn
v-if="filterForm[key].length > 0"
variant="text"
@@ -409,7 +411,7 @@ function loadMore({ done }: { done: any }) {
color="error"
@click="clearFilter(key)"
>
清除
{{ t('torrent.clear') }}
</VBtn>
</div>
<VChipGroup v-model="filterForm[key]" column multiple class="filter-options">
@@ -441,7 +443,7 @@ function loadMore({ done }: { done: any }) {
prepend-icon="mdi-close-circle-outline"
rounded="pill"
>
清除筛选
{{ t('torrent.clearFilters') }}
</VBtn>
</div>
</div>
@@ -482,7 +484,7 @@ function loadMore({ done }: { done: any }) {
class="search-count me-auto"
prepend-icon="mdi-magnify"
>
{{ props.items?.length || 0 }} 个资源
{{ props.items?.length || 0 }} {{ t('torrent.resources') }}
</VChip>
<!-- 排序选择 -->
@@ -541,9 +543,11 @@ function loadMore({ done }: { done: any }) {
color="error"
@click="clearFilter(currentFilter)"
>
清除
{{ t('torrent.clear') }}
</VBtn>
<VBtn variant="text" size="small" color="primary" @click="selectAll(currentFilter)">
{{ t('torrent.selectAll') }}
</VBtn>
<VBtn variant="text" size="small" color="primary" @click="selectAll(currentFilter)"> 全选 </VBtn>
</VCardTitle>
<VDivider />
<VCardText class="filter-menu-content pt-4">
@@ -563,7 +567,7 @@ function loadMore({ done }: { done: any }) {
</VCardText>
<VCardActions>
<VSpacer />
<VBtn variant="elevated" color="primary" @click="filterMenuOpen = false"> 确定 </VBtn>
<VBtn variant="elevated" color="primary" @click="filterMenuOpen = false"> {{ t('torrent.confirm') }} </VBtn>
</VCardActions>
</VCard>
</VDialog>
@@ -581,6 +585,12 @@ function loadMore({ done }: { done: any }) {
/>
</div>
</VInfiniteScroll>
<!-- 无结果时显示 -->
<div v-if="displayDataList.length === 0" class="no-results">
<VIcon icon="mdi-file-search-outline" size="64" color="grey-lighten-1" />
<div class="text-h6 text-grey mt-4">{{ t('torrent.noResults') }}</div>
</div>
</template>
<style scoped>

View File

@@ -1,6 +1,10 @@
<script lang="ts" setup>
import type { Context } from '@/api/types'
import TorrentItem from '@/components/cards/TorrentItem.vue'
import { useI18n } from 'vue-i18n'
// 国际化
const { t } = useI18n()
// 定义输入参数
const props = defineProps({
@@ -27,21 +31,21 @@ const filterForm: Record<string, string[]> = reactive({
// 过滤项映射(保持中文标题)
const filterTitles: Record<string, string> = {
site: '站点',
season: '季集',
freeState: '促销状态',
videoCode: '视频编码',
edition: '质量',
resolution: '分辨率',
releaseGroup: '制作组',
site: t('torrent.filterSite'),
season: t('torrent.filterSeason'),
freeState: t('torrent.filterFreeState'),
videoCode: t('torrent.filterVideoCode'),
edition: t('torrent.filterEdition'),
resolution: t('torrent.filterResolution'),
releaseGroup: t('torrent.filterReleaseGroup'),
}
// 排序中文名
const sortTitles: Record<string, string> = {
default: '默认',
site: '站点',
size: '大小',
seeder: '做种数',
default: t('torrent.sortDefault'),
site: t('torrent.sortSite'),
size: t('torrent.sortSize'),
seeder: t('torrent.sortSeeder'),
}
// 统一存储过滤选项
@@ -340,7 +344,7 @@ onMounted(() => {
<VCard class="view-header mb-3">
<div class="d-flex align-center flex-wrap pa-3">
<VChip color="primary" variant="flat" size="small" class="search-count me-3" prepend-icon="mdi-magnify">
{{ dataList.length }} 个资源
{{ dataList.length }} {{ t('torrent.resources') }}
</VChip>
<div class="filter-bar">
<!-- 排序选择 -->
@@ -377,7 +381,9 @@ onMounted(() => {
<VCard max-width="20rem">
<VCardText class="filter-menu-content">
<div class="flex justify-between">
<VBtn variant="text" size="small" color="primary" @click="selectAll(key)"> 全选 </VBtn>
<VBtn variant="text" size="small" color="primary" @click="selectAll(key)">
{{ t('torrent.selectAll') }}
</VBtn>
<VBtn
v-if="filterForm[key].length > 0"
variant="text"
@@ -385,7 +391,7 @@ onMounted(() => {
color="error"
@click="clearFilter(key)"
>
清除
{{ t('torrent.clear') }}
</VBtn>
</div>
<VChipGroup v-model="filterForm[key]" column multiple class="filter-options">
@@ -416,7 +422,7 @@ onMounted(() => {
class="filter-btn"
prepend-icon="mdi-close-circle-outline"
>
清除筛选
{{ t('torrent.clearFilters') }}
</VBtn>
</div>
</div>
@@ -538,7 +544,7 @@ onMounted(() => {
</VCardText>
<VCardActions>
<VSpacer />
<VBtn variant="elevated" color="primary" @click="filterMenuOpen = false"> 确定 </VBtn>
<VBtn variant="elevated" color="primary" @click="filterMenuOpen = false"> {{ t('torrent.confirm') }} </VBtn>
</VCardActions>
</VCard>
</VDialog>
@@ -548,7 +554,7 @@ onMounted(() => {
<!-- 无结果时显示 -->
<div v-if="displayDataList.length === 0" class="no-results">
<VIcon icon="mdi-file-search-outline" size="64" color="grey-lighten-1" />
<div class="text-h6 text-grey mt-4">暂无符合条件的资源</div>
<div class="text-h6 text-grey mt-4">{{ t('torrent.noResults') }}</div>
</div>
<!-- 资源列表 -->
<VInfiniteScroll