- Added useI18n hook to Sidebar and TitleBar components for translation support. - Updated sidebar navigation items to use translation keys instead of hardcoded labels. - Enhanced TitleBar buttons with localized titles for minimize, maximize, and close actions. - Expanded i18n constants to include new namespaces for sidebar and login. - Implemented translation messages for sidebar, settings, and login components in English, Chinese, and Japanese. - Refactored Knowledge and Skills pages to utilize useLocale for locale management. - Updated Login page to display localized text for form labels, placeholders, and error messages. - Enhanced Account and General settings panels with localized titles and descriptions. - Modified SettingMenu to use translation keys for menu items.
311 lines
10 KiB
TypeScript
311 lines
10 KiB
TypeScript
import type { LanguageCode } from '../types/runtime';
|
||
|
||
export interface MessageTree {
|
||
[key: string]: string | number | MessageTree;
|
||
}
|
||
|
||
export type I18nMessages = Record<LanguageCode, MessageTree>;
|
||
|
||
export const messages: I18nMessages = {
|
||
en: {
|
||
app: {
|
||
title: 'ZN-AI',
|
||
},
|
||
window: {
|
||
minimize: 'Minimize',
|
||
maximize: 'Maximize',
|
||
restore: 'Restore',
|
||
close: 'Close',
|
||
},
|
||
dialog: {
|
||
cancel: 'Cancel',
|
||
confirm: 'Confirm',
|
||
},
|
||
theme: {
|
||
light: 'Light',
|
||
dark: 'Dark',
|
||
system: 'System',
|
||
},
|
||
language: {
|
||
zh: 'Chinese',
|
||
en: 'English',
|
||
ja: 'Japanese',
|
||
},
|
||
common: {
|
||
loading: 'Loading...',
|
||
retry: 'Retry',
|
||
unknownError: 'Unknown error',
|
||
},
|
||
conversation: {
|
||
newConversation: 'New conversation',
|
||
emptyState: 'No messages yet',
|
||
},
|
||
sidebar: {
|
||
home: 'Home',
|
||
knowledge: 'Knowledge',
|
||
models: 'Models',
|
||
skills: 'Skills',
|
||
cron: 'Cron',
|
||
scripts: 'Scripts',
|
||
settings: 'Settings',
|
||
},
|
||
settings: {
|
||
menu: {
|
||
systemSettings: 'System Settings',
|
||
account: 'Account',
|
||
general: 'General',
|
||
},
|
||
account: {
|
||
title: 'Account Settings',
|
||
description: 'Manage your account details and sign-in security.',
|
||
accountLabel: 'Account',
|
||
passwordLabel: 'Login Password',
|
||
passwordHelp: 'Used for investor login operations, last login time: {time}',
|
||
configured: 'Configured',
|
||
changePassword: 'Change Password',
|
||
},
|
||
general: {
|
||
title: 'Basic Settings',
|
||
description: 'Customize the look and feel of the application.',
|
||
themeSection: 'Theme Settings',
|
||
languageSection: 'Language',
|
||
updatesTitle: 'Updates',
|
||
currentVersion: 'Current Version',
|
||
checkForUpdates: 'Check for Updates',
|
||
checkingForUpdates: 'Checking for updates...',
|
||
latestVersion: 'You have the latest version',
|
||
newVersionAvailable: 'New version available: v{version}',
|
||
downloadingVersion: 'Downloading new version... {percent}%',
|
||
downloadComplete: 'Download complete, ready to install',
|
||
updateError: 'Update error: {error}',
|
||
updateHint: 'Check for updates to get the latest features.',
|
||
downloadUpdate: 'Download Update',
|
||
restartAndInstall: 'Restart and Install',
|
||
autoCheckTitle: 'Auto check for updates',
|
||
autoCheckDescription: 'Check for updates on startup',
|
||
autoDownloadTitle: 'Auto download updates',
|
||
autoDownloadDescription: 'Automatically download and install updates',
|
||
autoUpdateHint: 'When auto-update is enabled, updates will be downloaded and installed automatically.',
|
||
},
|
||
},
|
||
login: {
|
||
title: 'Welcome Back',
|
||
subtitle: 'A digital teammate on duty 24/7, always ready to help.',
|
||
username: 'Username',
|
||
password: 'Password',
|
||
verificationCode: 'Verification Code',
|
||
usernamePlaceholder: 'Enter username',
|
||
passwordPlaceholder: 'Enter password',
|
||
verificationCodePlaceholder: 'Enter verification code',
|
||
usernameRequired: 'Please enter a username',
|
||
passwordRequired: 'Please enter a password',
|
||
codeRequired: 'Please enter the verification code',
|
||
submitFailed: 'Login failed, please try again later',
|
||
submit: 'Sign In',
|
||
submitting: 'Signing In...',
|
||
loadingCaptcha: 'Loading...',
|
||
captchaAlt: 'Verification code',
|
||
},
|
||
},
|
||
zh: {
|
||
app: {
|
||
title: 'ZN-AI',
|
||
},
|
||
window: {
|
||
minimize: '最小化',
|
||
maximize: '最大化',
|
||
restore: '还原',
|
||
close: '关闭',
|
||
},
|
||
dialog: {
|
||
cancel: '取消',
|
||
confirm: '确认',
|
||
},
|
||
theme: {
|
||
light: '浅色',
|
||
dark: '深色',
|
||
system: '跟随系统',
|
||
},
|
||
language: {
|
||
zh: '中文',
|
||
en: '英文',
|
||
ja: '日语',
|
||
},
|
||
common: {
|
||
loading: '加载中...',
|
||
retry: '重试',
|
||
unknownError: '未知错误',
|
||
},
|
||
conversation: {
|
||
newConversation: '新建对话',
|
||
emptyState: '暂无消息',
|
||
},
|
||
sidebar: {
|
||
home: '首页',
|
||
knowledge: '知识库',
|
||
models: '模型',
|
||
skills: '技能',
|
||
cron: '定时任务',
|
||
scripts: '脚本',
|
||
settings: '设置',
|
||
},
|
||
settings: {
|
||
menu: {
|
||
systemSettings: '系统设置',
|
||
account: '账号',
|
||
general: '通用',
|
||
},
|
||
account: {
|
||
title: '账号设置',
|
||
description: '管理账号信息与登录安全。',
|
||
accountLabel: '账号',
|
||
passwordLabel: '登录密码',
|
||
passwordHelp: '用于投资人登录操作,最近登录时间:{time}',
|
||
configured: '已配置',
|
||
changePassword: '修改密码',
|
||
},
|
||
general: {
|
||
title: '基础设置',
|
||
description: '自定义应用的外观与使用体验。',
|
||
themeSection: '主题设置',
|
||
languageSection: '语言',
|
||
updatesTitle: '版本更新',
|
||
currentVersion: '当前版本',
|
||
checkForUpdates: '检查更新',
|
||
checkingForUpdates: '正在检查更新...',
|
||
latestVersion: '当前已是最新版本',
|
||
newVersionAvailable: '发现新版本:v{version}',
|
||
downloadingVersion: '正在下载新版本... {percent}%',
|
||
downloadComplete: '下载完成,可立即安装',
|
||
updateError: '更新失败:{error}',
|
||
updateHint: '检查更新以获取最新功能。',
|
||
downloadUpdate: '下载更新',
|
||
restartAndInstall: '重启并安装',
|
||
autoCheckTitle: '自动检查更新',
|
||
autoCheckDescription: '应用启动时自动检查更新',
|
||
autoDownloadTitle: '自动下载更新',
|
||
autoDownloadDescription: '自动下载并安装更新',
|
||
autoUpdateHint: '开启自动更新后,更新包会自动下载并安装。',
|
||
},
|
||
},
|
||
login: {
|
||
title: '欢迎回来',
|
||
subtitle: '24 小时在岗,随时待命的数字员工。',
|
||
username: '账号',
|
||
password: '密码',
|
||
verificationCode: '验证码',
|
||
usernamePlaceholder: '请输入账号',
|
||
passwordPlaceholder: '请输入密码',
|
||
verificationCodePlaceholder: '请输入验证码',
|
||
usernameRequired: '请输入用户名',
|
||
passwordRequired: '请输入密码',
|
||
codeRequired: '请输入验证码',
|
||
submitFailed: '登录失败,请稍后重试',
|
||
submit: '登录',
|
||
submitting: '登录中...',
|
||
loadingCaptcha: '加载中...',
|
||
captchaAlt: '验证码',
|
||
},
|
||
},
|
||
ja: {
|
||
app: {
|
||
title: 'ZN-AI',
|
||
},
|
||
window: {
|
||
minimize: '最小化',
|
||
maximize: '最大化',
|
||
restore: '元に戻す',
|
||
close: '閉じる',
|
||
},
|
||
dialog: {
|
||
cancel: 'キャンセル',
|
||
confirm: '確認',
|
||
},
|
||
theme: {
|
||
light: 'ライト',
|
||
dark: 'ダーク',
|
||
system: 'システム',
|
||
},
|
||
language: {
|
||
zh: '中国語',
|
||
en: '英語',
|
||
ja: '日本語',
|
||
},
|
||
common: {
|
||
loading: '読み込み中...',
|
||
retry: '再試行',
|
||
unknownError: '不明なエラー',
|
||
},
|
||
conversation: {
|
||
newConversation: '新しい会話',
|
||
emptyState: 'まだメッセージがありません',
|
||
},
|
||
sidebar: {
|
||
home: 'ホーム',
|
||
knowledge: 'ナレッジ',
|
||
models: 'モデル',
|
||
skills: 'スキル',
|
||
cron: '定時タスク',
|
||
scripts: 'スクリプト',
|
||
settings: '設定',
|
||
},
|
||
settings: {
|
||
menu: {
|
||
systemSettings: 'システム設定',
|
||
account: 'アカウント',
|
||
general: '一般',
|
||
},
|
||
account: {
|
||
title: 'アカウント設定',
|
||
description: 'アカウント情報とサインインの安全性を管理します。',
|
||
accountLabel: 'アカウント',
|
||
passwordLabel: 'ログインパスワード',
|
||
passwordHelp: '投資家ログインに使用します。最終ログイン時刻:{time}',
|
||
configured: '設定済み',
|
||
changePassword: 'パスワードを変更',
|
||
},
|
||
general: {
|
||
title: '基本設定',
|
||
description: 'アプリの見た目と操作感をカスタマイズします。',
|
||
themeSection: 'テーマ設定',
|
||
languageSection: '言語',
|
||
updatesTitle: 'アップデート',
|
||
currentVersion: '現在のバージョン',
|
||
checkForUpdates: '更新を確認',
|
||
checkingForUpdates: '更新を確認しています...',
|
||
latestVersion: '最新バージョンを使用しています',
|
||
newVersionAvailable: '新しいバージョンがあります:v{version}',
|
||
downloadingVersion: '新しいバージョンをダウンロード中... {percent}%',
|
||
downloadComplete: 'ダウンロードが完了しました。インストールできます',
|
||
updateError: 'アップデートエラー:{error}',
|
||
updateHint: '最新機能を利用するには更新を確認してください。',
|
||
downloadUpdate: '更新をダウンロード',
|
||
restartAndInstall: '再起動してインストール',
|
||
autoCheckTitle: '更新を自動確認',
|
||
autoCheckDescription: '起動時に更新を確認します',
|
||
autoDownloadTitle: '更新を自動ダウンロード',
|
||
autoDownloadDescription: '更新を自動でダウンロードしてインストールします',
|
||
autoUpdateHint: '自動更新を有効にすると、更新が自動でダウンロードされてインストールされます。',
|
||
},
|
||
},
|
||
login: {
|
||
title: 'おかえりなさい',
|
||
subtitle: '24時間待機し、いつでも支援できるデジタルチームメイトです。',
|
||
username: 'アカウント',
|
||
password: 'パスワード',
|
||
verificationCode: '認証コード',
|
||
usernamePlaceholder: 'アカウントを入力してください',
|
||
passwordPlaceholder: 'パスワードを入力してください',
|
||
verificationCodePlaceholder: '認証コードを入力してください',
|
||
usernameRequired: 'ユーザー名を入力してください',
|
||
passwordRequired: 'パスワードを入力してください',
|
||
codeRequired: '認証コードを入力してください',
|
||
submitFailed: 'ログインに失敗しました。しばらくしてからもう一度お試しください',
|
||
submit: 'ログイン',
|
||
submitting: 'ログイン中...',
|
||
loadingCaptcha: '読み込み中...',
|
||
captchaAlt: '認証コード',
|
||
},
|
||
},
|
||
};
|