添加国际化支持:引入 vue-i18n,更新多个组件以支持语言切换和文本翻译

This commit is contained in:
jxxghp
2025-04-27 17:44:09 +08:00
parent 80ae853582
commit d0b3bc8137
27 changed files with 973 additions and 374 deletions

149
src/locales/en-US.ts Normal file
View File

@@ -0,0 +1,149 @@
export default {
common: {
confirm: 'Confirm',
cancel: 'Cancel',
save: 'Save',
delete: 'Delete',
edit: 'Edit',
add: 'Add',
search: 'Search',
loading: 'Loading',
success: 'Success',
error: 'Error',
},
theme: {
light: 'Light',
dark: 'Dark',
auto: 'Auto',
transparent: 'Transparent',
purple: 'Purple',
custom: 'Custom',
},
app: {
moviepilot: 'MoviePilot',
recommend: 'Recommend',
subscribeMovie: 'Movie Subscription',
subscribeTv: 'TV Subscription',
settings: 'Settings',
language: 'Language',
selectLanguage: 'Select Language',
logout: 'Logout',
restarting: 'Restarting...',
confirmRestart: 'Confirm Restart?',
restartTip: 'After restarting, you will be logged out and need to log in again.',
},
login: {
wallpapers: 'wallpapers',
username: 'Username',
password: 'Password',
otpCode: 'OTP Code',
stayLoggedIn: 'Stay Logged In',
login: 'Login',
networkError: 'Login failed, please check your network connection!',
authFailure: 'Login failed, please check your username, password or OTP code!',
permissionDenied: 'Login failed, you do not have permission to access!',
serverError: 'Login failed, server error!',
loginFailed: 'Login Failed',
checkCredentials: 'Please check your username, password or OTP code!',
},
menu: {
start: 'Start',
discovery: 'Discovery',
subscribe: 'Subscribe',
organize: 'Organize',
system: 'System',
},
navItems: {
dashboard: 'Dashboard',
mediaInfo: 'Media Library',
recommend: 'Recommend',
site: 'Sites',
search: 'Search',
searchResult: 'Search Results',
download: 'Download',
movieSubscribe: 'Movie Subscription',
tvSubscribe: 'TV Subscription',
history: 'History',
transfer: 'Transfer',
rename: 'Rename',
statistic: 'Statistics',
setting: 'Settings',
plugin: 'Plugins',
user: 'Users',
about: 'About',
explore: 'Explore',
movie: 'Movies',
tv: 'TV Shows',
workflow: 'Workflow',
calendar: 'Calendar',
downloadManager: 'Download Manager',
mediaOrganize: 'Media Organizer',
fileManager: 'File Manager',
pluginManager: 'Plugins',
siteManager: 'Site Manager',
userManager: 'User Manager',
settings: 'Settings',
},
settingTabs: {
system: {
title: 'System',
description: 'Basic settings, downloaders (Qbittorrent, Transmission), media servers (Emby, Jellyfin, Plex)',
},
directory: {
title: 'Storage & Directories',
description: 'Download directories, media library directories, organization, metadata scraping',
},
site: {
title: 'Sites',
description: 'Site synchronization, site data refresh, site reset',
},
rule: {
title: 'Rules',
description: 'Custom rules, priority rule groups, download rules',
},
search: {
title: 'Search & Download',
description: 'Search data sources (TheMovieDb, Douban, Bangumi), download task labels, search sites',
},
subscribe: {
title: 'Subscription',
description: 'Subscription sites, subscription modes, subscription rules, upgrade rules',
},
scheduler: {
title: 'Services',
description: 'Scheduled tasks',
},
notification: {
title: 'Notifications',
description: 'Notification channels (WeChat, Telegram, Slack, SynologyChat, VoceChat, WebPush), message scope',
},
words: {
title: 'Word Lists',
description: 'Custom recognition words, custom groups, custom placeholders, file organization filter words',
},
about: {
title: 'About',
description: 'Software version',
},
},
subscribeTabs: {
movie: {
mysub: 'My Subscriptions',
popular: 'Popular',
},
tv: {
mysub: 'My Subscriptions',
popular: 'Popular',
share: 'Shared',
},
},
pluginTabs: {
installed: 'My Plugins',
market: 'Plugin Market',
},
discoverTabs: {
themoviedb: 'TheMovieDb',
douban: 'Douban',
bangumi: 'Bangumi',
},
}

25
src/locales/types.ts Normal file
View File

@@ -0,0 +1,25 @@
import zhCN from './zh-CN'
export type MessageSchema = typeof zhCN
export type LocaleKey = keyof typeof zhCN
export interface LocaleInfo {
name: string
title: string
flag?: string
}
export const SUPPORTED_LOCALES: Record<string, LocaleInfo> = {
'zh-CN': {
name: 'zh-CN',
title: '简体中文',
flag: '🇨🇳',
},
'en-US': {
name: 'en-US',
title: 'English',
flag: '🇺🇸',
},
}
export type SupportedLocale = keyof typeof SUPPORTED_LOCALES

149
src/locales/zh-CN.ts Normal file
View File

@@ -0,0 +1,149 @@
export default {
common: {
confirm: '确认',
cancel: '取消',
save: '保存',
delete: '删除',
edit: '编辑',
add: '添加',
search: '搜索',
loading: '加载中',
success: '成功',
error: '错误',
},
theme: {
light: '浅色',
dark: '深色',
auto: '跟随系统',
transparent: '透明',
purple: '幻紫',
custom: '自定义主题',
},
app: {
moviepilot: 'MoviePilot',
recommend: '推荐',
subscribeMovie: '电影订阅',
subscribeTv: '电视剧订阅',
settings: '设置',
language: '语言设置',
selectLanguage: '选择语言',
logout: '退出登录',
restarting: '正在重启...',
confirmRestart: '确认重启系统吗?',
restartTip: '重启后,您将被注销并需要重新登录。',
},
login: {
wallpapers: '壁纸',
username: '用户名',
password: '密码',
otpCode: '双重验证码',
stayLoggedIn: '保持登录',
login: '登录',
networkError: '登录失败,请检查网络连接!',
authFailure: '登录失败,请检查用户名、密码或双重验证是否正确!',
permissionDenied: '登录失败,您没有权限访问!',
serverError: '登录失败,服务器错误!',
loginFailed: '登录失败',
checkCredentials: '请检查用户名、密码或双重验证码是否正确!',
},
menu: {
start: '开始',
discovery: '发现',
subscribe: '订阅',
organize: '整理',
system: '系统',
},
navItems: {
dashboard: '仪表盘',
mediaInfo: '媒体库',
recommend: '推荐',
site: '站点',
search: '搜索',
searchResult: '搜索结果',
download: '下载',
movieSubscribe: '电影订阅',
tvSubscribe: '电视剧订阅',
history: '历史记录',
transfer: '整理',
rename: '重命名',
statistic: '统计',
setting: '设置',
plugin: '插件',
user: '用户',
about: '关于',
explore: '探索',
movie: '电影',
tv: '电视剧',
workflow: '工作流',
calendar: '日历',
downloadManager: '下载管理',
mediaOrganize: '媒体整理',
fileManager: '文件管理',
pluginManager: '插件',
siteManager: '站点管理',
userManager: '用户管理',
settings: '设定',
},
settingTabs: {
system: {
title: '系统',
description: '基础设置、下载器Qbittorrent、Transmission、媒体服务器Emby、Jellyfin、Plex',
},
directory: {
title: '存储 & 目录',
description: '下载目录、媒体库目录、整理、刮削',
},
site: {
title: '站点',
description: '站点同步、站点数据刷新、站点重置',
},
rule: {
title: '规则',
description: '自定义规则、优先级规则组、下载规则',
},
search: {
title: '搜索 & 下载',
description: '搜索数据源TheMovieDb、豆瓣、Bangumi、下载任务标签、搜索站点',
},
subscribe: {
title: '订阅',
description: '订阅站点、订阅模式、订阅规则、洗版规则',
},
scheduler: {
title: '服务',
description: '定时作业',
},
notification: {
title: '通知',
description: '通知渠道微信、Telegram、Slack、SynologyChat、VoceChat、WebPush、消息发送范围',
},
words: {
title: '词表',
description: '自定义识别词、自定义制作组/字幕组、自定义占位符、文件整理屏蔽词',
},
about: {
title: '关于',
description: '软件版本',
},
},
subscribeTabs: {
movie: {
mysub: '我的订阅',
popular: '热门订阅',
},
tv: {
mysub: '我的订阅',
popular: '热门订阅',
share: '订阅分享',
},
},
pluginTabs: {
installed: '我的插件',
market: '插件市场',
},
discoverTabs: {
themoviedb: 'TheMovieDb',
douban: '豆瓣',
bangumi: 'Bangumi',
},
}