feat(i18n): integrate internationalization into sidebar, title bar, and settings components

- 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.
This commit is contained in:
DEV_DSW
2026-04-17 17:16:18 +08:00
parent bc3de923ed
commit eca70425cf
16 changed files with 533 additions and 141 deletions

View File

@@ -40,6 +40,72 @@ export const messages: I18nMessages = {
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: {
@@ -74,6 +140,72 @@ export const messages: I18nMessages = {
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: {
@@ -82,7 +214,7 @@ export const messages: I18nMessages = {
window: {
minimize: '最小化',
maximize: '最大化',
restore: '元',
restore: '元に戻す',
close: '閉じる',
},
dialog: {
@@ -92,7 +224,7 @@ export const messages: I18nMessages = {
theme: {
light: 'ライト',
dark: 'ダーク',
system: 'システムに従う',
system: 'システム',
},
language: {
zh: '中国語',
@@ -106,7 +238,73 @@ export const messages: I18nMessages = {
},
conversation: {
newConversation: '新しい会話',
emptyState: 'メッセージはまだありません',
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: '認証コード',
},
},
};