更新国际化支持:修正媒体类型文本函数名称并添加通知开关相关文本,提升用户体验

This commit is contained in:
jxxghp
2025-04-28 20:29:11 +08:00
parent 8854affc4c
commit fa6ba8b1fc
6 changed files with 128 additions and 76 deletions

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 { getMeidaTypeText } from '@/types/i18n-type'
import { getMediaTypeText } from '@/types/i18n-type'
// 国际化
const { t } = useI18n()
@@ -487,7 +487,7 @@ function onRemoveSubscribe() {
:class="getChipColor(props.media?.type || '')"
class="absolute left-2 top-2 bg-opacity-80 text-white font-bold"
>
{{ getMeidaTypeText(props.media?.type) }}
{{ getMediaTypeText(props.media?.type) }}
</VChip>
<!-- 本地存在标识 -->
<ExistIcon v-if="isExists && !hover.isHovering" />

View File

@@ -28,27 +28,6 @@ export default {
user: 'User',
config: 'Configuration',
},
mediaserver: {
enableMediaServer: 'Enable Media Server',
nameRequired: 'Required; cannot be duplicated',
serverAlias: 'Media server alias',
host: 'Host',
hostPlaceholder: 'http(s)://ip:port',
hostHint: 'Server address, format: http(s)://ip:port',
playHost: 'External Playback URL',
playHostPlaceholder: 'http(s)://domain:port',
playHostHint: 'URL for playback page redirection, format: http(s)://domain:port',
apiKey: 'API Key',
embyApiKeyHint: 'API key generated in Emby Settings -> Advanced -> API Keys',
jellyfinApiKeyHint: 'API key generated in Jellyfin Settings -> Advanced -> API Keys',
plexToken: 'X-Plex-Token',
plexTokenHint: 'X-Plex-Token obtained from Plex request URL in browser F12 -> Network',
username: 'Username',
password: 'Password',
syncLibraries: 'Sync Libraries',
syncLibrariesHint: 'Only selected libraries will be synchronized',
nameExists: '【{name}】 already exists, please use a different name',
},
mediaType: {
movie: 'Movie',
tv: 'TV Show',
@@ -56,6 +35,16 @@ export default {
collection: 'Collection',
unknown: 'Unknown',
},
notificationSwitch: {
resourceDownload: 'Resource Download',
organize: 'Organize',
subscribe: 'Subscribe',
site: 'Site',
mediaServer: 'Media Server',
manual: 'Manual',
plugin: 'Plugin',
other: 'Other',
},
theme: {
light: 'Light',
dark: 'Dark',
@@ -1756,4 +1745,25 @@ export default {
unknown: 'Unknown',
},
},
mediaserver: {
enableMediaServer: 'Enable Media Server',
nameRequired: 'Required; cannot be duplicated',
serverAlias: 'Media server alias',
host: 'Host',
hostPlaceholder: 'http(s)://ip:port',
hostHint: 'Server address, format: http(s)://ip:port',
playHost: 'External Playback URL',
playHostPlaceholder: 'http(s)://domain:port',
playHostHint: 'URL for playback page redirection, format: http(s)://domain:port',
apiKey: 'API Key',
embyApiKeyHint: 'API key generated in Emby Settings -> Advanced -> API Keys',
jellyfinApiKeyHint: 'API key generated in Jellyfin Settings -> Advanced -> API Keys',
plexToken: 'X-Plex-Token',
plexTokenHint: 'X-Plex-Token obtained from Plex request URL in browser F12 -> Network',
username: 'Username',
password: 'Password',
syncLibraries: 'Sync Libraries',
syncLibrariesHint: 'Only selected libraries will be synchronized',
nameExists: '【{name}】 already exists, please use a different name',
},
}

View File

@@ -28,27 +28,6 @@ export default {
user: '用户',
config: '配置',
},
mediaserver: {
enableMediaServer: '启用媒体服务器',
nameRequired: '必填;不可与其他名称重名',
serverAlias: '媒体服务器的别名',
host: '地址',
hostPlaceholder: 'http(s)://ip:port',
hostHint: '服务端地址格式http(s)://ip:port',
playHost: '外网播放地址',
playHostPlaceholder: 'http(s)://domain:port',
playHostHint: '跳转播放页面使用的地址格式http(s)://domain:port',
apiKey: 'API密钥',
embyApiKeyHint: 'Emby设置->高级->API密钥中生成的密钥',
jellyfinApiKeyHint: 'Jellyfin设置->高级->API密钥中生成的密钥',
plexToken: 'X-Plex-Token',
plexTokenHint: '浏览器F12->网络从Plex请求URL中获取的X-Plex-Token',
username: '用户名',
password: '密码',
syncLibraries: '同步媒体库',
syncLibrariesHint: '只有选中的媒体库才会被同步',
nameExists: '【{name}】已存在,请替换为其他名称',
},
mediaType: {
movie: '电影',
tv: '电视剧',
@@ -56,6 +35,16 @@ export default {
collection: '合集',
unknown: '未知',
},
notificationSwitch: {
resourceDownload: '资源下载',
organize: '整理入库',
subscribe: '订阅',
site: '站点',
mediaServer: '媒体服务器',
manual: '手动处理',
plugin: '插件',
other: '其它',
},
theme: {
light: '浅色',
dark: '深色',
@@ -1726,4 +1715,25 @@ export default {
mediaType: '媒体类型',
category: '媒体类别',
},
mediaserver: {
enableMediaServer: '启用媒体服务器',
nameRequired: '必填;不可与其他名称重名',
serverAlias: '媒体服务器的别名',
host: '地址',
hostPlaceholder: 'http(s)://ip:port',
hostHint: '服务端地址格式http(s)://ip:port',
playHost: '外网播放地址',
playHostPlaceholder: 'http(s)://domain:port',
playHostHint: '跳转播放页面使用的地址格式http(s)://domain:port',
apiKey: 'API密钥',
embyApiKeyHint: 'Emby设置->高级->API密钥中生成的密钥',
jellyfinApiKeyHint: 'Jellyfin设置->高级->API密钥中生成的密钥',
plexToken: 'X-Plex-Token',
plexTokenHint: '浏览器F12->网络从Plex请求URL中获取的X-Plex-Token',
username: '用户名',
password: '密码',
syncLibraries: '同步媒体库',
syncLibrariesHint: '只有选中的媒体库才会被同步',
nameExists: '【{name}】已存在,请替换为其他名称',
},
}

View File

@@ -28,27 +28,6 @@ export default {
user: '用戶',
config: '配置',
},
mediaserver: {
enableMediaServer: '啟用媒體伺服器',
nameRequired: '必填;不可與其他名稱重名',
serverAlias: '媒體伺服器的別名',
host: '地址',
hostPlaceholder: 'http(s)://ip:port',
hostHint: '服務端地址格式http(s)://ip:port',
playHost: '外網播放地址',
playHostPlaceholder: 'http(s)://domain:port',
playHostHint: '跳轉播放頁面使用的地址格式http(s)://domain:port',
apiKey: 'API密鑰',
embyApiKeyHint: 'Emby設置->高級->API密鑰中生成的密鑰',
jellyfinApiKeyHint: 'Jellyfin設置->高級->API密鑰中生成的密鑰',
plexToken: 'X-Plex-Token',
plexTokenHint: '瀏覽器F12->網絡從Plex請求URL中獲取的X-Plex-Token',
username: '用戶名',
password: '密碼',
syncLibraries: '同步媒體庫',
syncLibrariesHint: '只有選中的媒體庫才會被同步',
nameExists: '【{name}】已存在,請替換為其他名稱',
},
mediaType: {
movie: '電影',
tv: '電視劇',
@@ -56,6 +35,16 @@ export default {
collection: '合集',
unknown: '未知',
},
notificationSwitch: {
resourceDownload: '資源下載',
organize: '整理入庫',
subscribe: '訂閱',
site: '站點',
mediaServer: '媒體伺服器',
manual: '手動處理',
plugin: '插件',
other: '其它',
},
theme: {
light: '淺色',
dark: '深色',
@@ -1721,4 +1710,25 @@ export default {
shareSuccess: '規則已複製到剪貼板',
shareFailed: '規則複製失敗',
},
mediaserver: {
enableMediaServer: '啟用媒體伺服器',
nameRequired: '必填;不可與其他名稱重名',
serverAlias: '媒體伺服器的別名',
host: '地址',
hostPlaceholder: 'http(s)://ip:port',
hostHint: '服務端地址格式http(s)://ip:port',
playHost: '外網播放地址',
playHostPlaceholder: 'http(s)://domain:port',
playHostHint: '跳轉播放頁面使用的地址格式http(s)://domain:port',
apiKey: 'API密鑰',
embyApiKeyHint: 'Emby設置->高級->API密鑰中生成的密鑰',
jellyfinApiKeyHint: 'Jellyfin設置->高級->API密鑰中生成的密鑰',
plexToken: 'X-Plex-Token',
plexTokenHint: '瀏覽器F12->網絡從Plex請求URL中獲取的X-Plex-Token',
username: '用戶名',
password: '密碼',
syncLibraries: '同步媒體庫',
syncLibrariesHint: '只有選中的媒體庫才會被同步',
nameExists: '【{name}】已存在,請替換為其他名稱',
},
}

View File

@@ -1,5 +1,5 @@
// 将中文标签转换为当前语言的标签
export function getMeidaTypeText(label: string | undefined) {
// MediaType
export function getMediaTypeText(label: string | undefined) {
if (!label) return ''
const { t } = useI18n()
@@ -21,3 +21,24 @@ export function getMeidaTypeText(label: string | undefined) {
// 对于未知的类型,直接返回原始标签
return label
}
// notificationSwitch
export function getNotificationSwitchText(label: string | undefined) {
if (!label) return ''
const { t } = useI18n()
const switchMap: Record<string, string> = {
'资源下载': 'notificationSwitch.resourceDownload',
'整理入库': 'notificationSwitch.organize',
'订阅': 'notificationSwitch.subscribe',
'站点': 'notificationSwitch.site',
'媒体服务器': 'notificationSwitch.mediaServer',
'手动处理': 'notificationSwitch.manual',
'插件': 'notificationSwitch.plugin',
'其它': 'notificationSwitch.other',
}
if (label in switchMap) {
return t(switchMap[label])
}
}

View File

@@ -6,6 +6,7 @@ import type { NotificationConf, NotificationSwitchConf } from '@/api/types'
import NotificationChannelCard from '@/components/cards/NotificationChannelCard.vue'
import ProgressDialog from '@/components/dialog/ProgressDialog.vue'
import { useI18n } from 'vue-i18n'
import { getNotificationSwitchText } from '@/types/i18n-type'
// 国际化
const { t } = useI18n()
@@ -22,35 +23,35 @@ const progressDialog = ref(false)
// 消息类型开关
const notificationSwitchs = ref<NotificationSwitchConf[]>([
{
type: t('setting.notification.resourceDownload'),
type: '资源下载',
action: 'all',
},
{
type: t('setting.notification.mediaImport'),
type: '整理入库',
action: 'all',
},
{
type: t('setting.notification.subscription'),
type: '订阅',
action: 'all',
},
{
type: t('setting.notification.site'),
type: '站点',
action: 'admin',
},
{
type: t('setting.notification.mediaServer'),
type: '媒体服务器',
action: 'admin',
},
{
type: t('setting.notification.manualProcess'),
type: '手动处理',
action: 'admin',
},
{
type: t('setting.notification.plugin'),
type: '插件',
action: 'admin',
},
{
type: t('setting.notification.other'),
type: '其它',
action: 'admin',
},
])
@@ -256,7 +257,7 @@ onMounted(() => {
<tbody>
<tr v-for="(item, index) in notificationSwitchs" :key="index">
<td>
{{ item.type }}
{{ getNotificationSwitchText(item.type) }}
</td>
<td>
<VRadioGroup v-model="item.action" inline>