mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-08-01 03:17:43 +08:00
更新国际化支持
This commit is contained in:
1
src/types/colorthief.d.ts
vendored
1
src/types/colorthief.d.ts
vendored
@@ -1 +0,0 @@
|
||||
|
||||
23
src/types/i18n-type.ts
Normal file
23
src/types/i18n-type.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
// 将中文标签转换为当前语言的标签
|
||||
export function getMeidaTypeText(label: string | undefined) {
|
||||
if (!label) return ''
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
// 常见的媒体类型及其映射
|
||||
const typeMap: Record<string, string> = {
|
||||
'电影': 'mediaType.movie',
|
||||
'电视剧': 'mediaType.tv',
|
||||
'动漫': 'mediaType.anime',
|
||||
'合集': 'mediaType.collection',
|
||||
'未知': 'mediaType.unknown',
|
||||
}
|
||||
|
||||
// 如果是已知类型,使用i18n翻译
|
||||
if (label in typeMap) {
|
||||
return t(typeMap[label])
|
||||
}
|
||||
|
||||
// 对于未知的类型,直接返回原始标签
|
||||
return label
|
||||
}
|
||||
@@ -1,9 +1,3 @@
|
||||
import zhCN from '@/locales/zh-CN'
|
||||
|
||||
// 导出类型和常量,而不是作为语言消息文件
|
||||
export type MessageSchema = typeof zhCN
|
||||
export type LocaleKey = keyof typeof zhCN
|
||||
|
||||
export interface LocaleInfo {
|
||||
name: string
|
||||
title: string
|
||||
@@ -16,6 +10,11 @@ export const SUPPORTED_LOCALES: Record<string, LocaleInfo> = {
|
||||
title: '简体中文',
|
||||
flag: '🇨🇳',
|
||||
},
|
||||
'zh-TW': {
|
||||
name: 'zh-TW',
|
||||
title: '繁體中文',
|
||||
flag: '🇨🇳',
|
||||
},
|
||||
'en-US': {
|
||||
name: 'en-US',
|
||||
title: 'English',
|
||||
|
||||
Reference in New Issue
Block a user