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

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
+11 -9
View File
@@ -397,21 +397,23 @@ export default {
backButton: 'Go Back', backButton: 'Go Back',
}, },
torrent: { torrent: {
selectAll: 'Select All',
clear: 'Clear',
clearFilters: 'Clear Filters',
confirm: 'Confirm',
resources: 'resources',
noResults: 'No results found',
sortDefault: 'Default', sortDefault: 'Default',
sortSite: 'Site', sortSite: 'Site',
sortSize: 'Size', sortSize: 'Size',
sortSeeder: 'Seeders', sortSeeder: 'Seeder',
filterSite: 'Site', filterSite: 'Site',
filterSeason: 'Season/Episode', filterSeason: 'Season',
filterFreeState: 'Promotion Status', filterFreeState: 'Free State',
filterVideoCode: 'Video Codec', filterVideoCode: 'Video Code',
filterEdition: 'Quality', filterEdition: 'Edition',
filterResolution: 'Resolution', filterResolution: 'Resolution',
filterReleaseGroup: 'Release Group', filterReleaseGroup: 'Release Group',
clearFilters: 'Clear',
selectAll: 'Select All',
loadMore: 'Load More',
noMatchingResults: 'No matching results',
}, },
calendar: { calendar: {
episode: 'Episode {number}', episode: 'Episode {number}',
+7 -5
View File
@@ -397,21 +397,23 @@ export default {
backButton: '返回', backButton: '返回',
}, },
torrent: { torrent: {
selectAll: '全选',
clear: '清除',
clearFilters: '清除筛选',
confirm: '确定',
resources: '个资源',
noResults: '没有找到匹配的资源',
sortDefault: '默认', sortDefault: '默认',
sortSite: '站点', sortSite: '站点',
sortSize: '大小', sortSize: '大小',
sortSeeder: '做种数', sortSeeder: '做种数',
filterSite: '站点', filterSite: '站点',
filterSeason: '季', filterSeason: '季',
filterFreeState: '促销状态', filterFreeState: '促销状态',
filterVideoCode: '视频编码', filterVideoCode: '视频编码',
filterEdition: '质量', filterEdition: '质量',
filterResolution: '分辨率', filterResolution: '分辨率',
filterReleaseGroup: '制作组', filterReleaseGroup: '制作组',
clearFilters: '清除',
selectAll: '全选',
loadMore: '加载更多',
noMatchingResults: '没有匹配的结果',
}, },
calendar: { calendar: {
episode: '第{number}集', episode: '第{number}集',
+6 -8
View File
@@ -397,10 +397,6 @@ export default {
backButton: '返回', backButton: '返回',
}, },
torrent: { torrent: {
sortDefault: '默認',
sortSite: '站點',
sortSize: '大小',
sortSeeder: '做種數',
filterSite: '站點', filterSite: '站點',
filterSeason: '季集', filterSeason: '季集',
filterFreeState: '促銷狀態', filterFreeState: '促銷狀態',
@@ -408,10 +404,12 @@ export default {
filterEdition: '質量', filterEdition: '質量',
filterResolution: '分辨率', filterResolution: '分辨率',
filterReleaseGroup: '製作組', filterReleaseGroup: '製作組',
clearFilters: '清除', sortDefault: '默認',
selectAll: '全選', sortSite: '站點',
loadMore: '加載更多', sortSize: '大小',
noMatchingResults: '沒有匹配的結果', sortSeeder: '做種數',
resources: '個資源',
noResults: '暫無符合條件的資源',
}, },
calendar: { calendar: {
episode: '第{number}集', episode: '第{number}集',
+18 -8
View File
@@ -363,7 +363,7 @@ function loadMore({ done }: { done: any }) {
<VCard class="view-header rounded-xl"> <VCard class="view-header rounded-xl">
<div class="d-flex align-center flex-wrap pa-3"> <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"> <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> </VChip>
<!-- 排序选择 --> <!-- 排序选择 -->
<div class="sort-container me-4"> <div class="sort-container me-4">
@@ -401,7 +401,9 @@ function loadMore({ done }: { done: any }) {
<VCard max-width="25rem"> <VCard max-width="25rem">
<VCardText class="filter-menu-content"> <VCardText class="filter-menu-content">
<div class="flex justify-between"> <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 <VBtn
v-if="filterForm[key].length > 0" v-if="filterForm[key].length > 0"
variant="text" variant="text"
@@ -409,7 +411,7 @@ function loadMore({ done }: { done: any }) {
color="error" color="error"
@click="clearFilter(key)" @click="clearFilter(key)"
> >
清除 {{ t('torrent.clear') }}
</VBtn> </VBtn>
</div> </div>
<VChipGroup v-model="filterForm[key]" column multiple class="filter-options"> <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" prepend-icon="mdi-close-circle-outline"
rounded="pill" rounded="pill"
> >
清除筛选 {{ t('torrent.clearFilters') }}
</VBtn> </VBtn>
</div> </div>
</div> </div>
@@ -482,7 +484,7 @@ function loadMore({ done }: { done: any }) {
class="search-count me-auto" class="search-count me-auto"
prepend-icon="mdi-magnify" prepend-icon="mdi-magnify"
> >
{{ props.items?.length || 0 }} 个资源 {{ props.items?.length || 0 }} {{ t('torrent.resources') }}
</VChip> </VChip>
<!-- 排序选择 --> <!-- 排序选择 -->
@@ -541,9 +543,11 @@ function loadMore({ done }: { done: any }) {
color="error" color="error"
@click="clearFilter(currentFilter)" @click="clearFilter(currentFilter)"
> >
清除 {{ t('torrent.clear') }}
</VBtn>
<VBtn variant="text" size="small" color="primary" @click="selectAll(currentFilter)">
{{ t('torrent.selectAll') }}
</VBtn> </VBtn>
<VBtn variant="text" size="small" color="primary" @click="selectAll(currentFilter)"> 全选 </VBtn>
</VCardTitle> </VCardTitle>
<VDivider /> <VDivider />
<VCardText class="filter-menu-content pt-4"> <VCardText class="filter-menu-content pt-4">
@@ -563,7 +567,7 @@ function loadMore({ done }: { done: any }) {
</VCardText> </VCardText>
<VCardActions> <VCardActions>
<VSpacer /> <VSpacer />
<VBtn variant="elevated" color="primary" @click="filterMenuOpen = false"> 确定 </VBtn> <VBtn variant="elevated" color="primary" @click="filterMenuOpen = false"> {{ t('torrent.confirm') }} </VBtn>
</VCardActions> </VCardActions>
</VCard> </VCard>
</VDialog> </VDialog>
@@ -581,6 +585,12 @@ function loadMore({ done }: { done: any }) {
/> />
</div> </div>
</VInfiniteScroll> </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> </template>
<style scoped> <style scoped>
+23 -17
View File
@@ -1,6 +1,10 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { Context } from '@/api/types' import type { Context } from '@/api/types'
import TorrentItem from '@/components/cards/TorrentItem.vue' import TorrentItem from '@/components/cards/TorrentItem.vue'
import { useI18n } from 'vue-i18n'
// 国际化
const { t } = useI18n()
// 定义输入参数 // 定义输入参数
const props = defineProps({ const props = defineProps({
@@ -27,21 +31,21 @@ const filterForm: Record<string, string[]> = reactive({
// 过滤项映射(保持中文标题) // 过滤项映射(保持中文标题)
const filterTitles: Record<string, string> = { const filterTitles: Record<string, string> = {
site: '站点', site: t('torrent.filterSite'),
season: '季集', season: t('torrent.filterSeason'),
freeState: '促销状态', freeState: t('torrent.filterFreeState'),
videoCode: '视频编码', videoCode: t('torrent.filterVideoCode'),
edition: '质量', edition: t('torrent.filterEdition'),
resolution: '分辨率', resolution: t('torrent.filterResolution'),
releaseGroup: '制作组', releaseGroup: t('torrent.filterReleaseGroup'),
} }
// 排序中文名 // 排序中文名
const sortTitles: Record<string, string> = { const sortTitles: Record<string, string> = {
default: '默认', default: t('torrent.sortDefault'),
site: '站点', site: t('torrent.sortSite'),
size: '大小', size: t('torrent.sortSize'),
seeder: '做种数', seeder: t('torrent.sortSeeder'),
} }
// 统一存储过滤选项 // 统一存储过滤选项
@@ -340,7 +344,7 @@ onMounted(() => {
<VCard class="view-header mb-3"> <VCard class="view-header mb-3">
<div class="d-flex align-center flex-wrap pa-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"> <VChip color="primary" variant="flat" size="small" class="search-count me-3" prepend-icon="mdi-magnify">
{{ dataList.length }} 个资源 {{ dataList.length }} {{ t('torrent.resources') }}
</VChip> </VChip>
<div class="filter-bar"> <div class="filter-bar">
<!-- 排序选择 --> <!-- 排序选择 -->
@@ -377,7 +381,9 @@ onMounted(() => {
<VCard max-width="20rem"> <VCard max-width="20rem">
<VCardText class="filter-menu-content"> <VCardText class="filter-menu-content">
<div class="flex justify-between"> <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 <VBtn
v-if="filterForm[key].length > 0" v-if="filterForm[key].length > 0"
variant="text" variant="text"
@@ -385,7 +391,7 @@ onMounted(() => {
color="error" color="error"
@click="clearFilter(key)" @click="clearFilter(key)"
> >
清除 {{ t('torrent.clear') }}
</VBtn> </VBtn>
</div> </div>
<VChipGroup v-model="filterForm[key]" column multiple class="filter-options"> <VChipGroup v-model="filterForm[key]" column multiple class="filter-options">
@@ -416,7 +422,7 @@ onMounted(() => {
class="filter-btn" class="filter-btn"
prepend-icon="mdi-close-circle-outline" prepend-icon="mdi-close-circle-outline"
> >
清除筛选 {{ t('torrent.clearFilters') }}
</VBtn> </VBtn>
</div> </div>
</div> </div>
@@ -538,7 +544,7 @@ onMounted(() => {
</VCardText> </VCardText>
<VCardActions> <VCardActions>
<VSpacer /> <VSpacer />
<VBtn variant="elevated" color="primary" @click="filterMenuOpen = false"> 确定 </VBtn> <VBtn variant="elevated" color="primary" @click="filterMenuOpen = false"> {{ t('torrent.confirm') }} </VBtn>
</VCardActions> </VCardActions>
</VCard> </VCard>
</VDialog> </VDialog>
@@ -548,7 +554,7 @@ onMounted(() => {
<!-- 无结果时显示 --> <!-- 无结果时显示 -->
<div v-if="displayDataList.length === 0" class="no-results"> <div v-if="displayDataList.length === 0" class="no-results">
<VIcon icon="mdi-file-search-outline" size="64" color="grey-lighten-1" /> <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> </div>
<!-- 资源列表 --> <!-- 资源列表 -->
<VInfiniteScroll <VInfiniteScroll