From 394c6ce20ce33cd3edf43b33ac7c1f5b23cfe89a Mon Sep 17 00:00:00 2001 From: Sun <95302870@qq.com> Date: Sun, 7 Jan 2024 14:53:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E5=A4=9A=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=20Squashed=20commit=20of=20the=20following:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit 632f86c0228c68391c01865c7576f3aa0408c102 Author: Sun <95302870@qq.com> Date: Sun Jan 7 14:47:55 2024 +0800 退出的时候清除appstore commit b9d805e49a3c6b2ad38bc8d527cb12cc8709012e Author: Sun <95302870@qq.com> Date: Sun Jan 7 13:55:20 2024 +0800 系统状态监控适配国际化 commit daece99723ec96d210241d2ca4e5a85dc5ae69bd Author: Sun <95302870@qq.com> Date: Sun Jan 7 13:09:46 2024 +0800 适配添加项目页面的国际化配置还有时钟的星期* commit 8ea2b2fe951f6266415c96a197cb8d00faef4058 Author: Sun <95302870@qq.com> Date: Sun Jan 7 12:01:55 2024 +0800 完成适配所有apps国际化 commit 21ef54e0d4afb10f560c8cb7aff666374afe0f87 Author: Sun <95302870@qq.com> Date: Sat Jan 6 21:36:07 2024 +0800 增加读取默认浏览器语言 commit 6f710bbebe63ab2800193f27c71e5c0034f11978 Author: Sun <95302870@qq.com> Date: Sat Jan 6 21:09:58 2024 +0800 登录页面增加语言选择选项 commit cb7c4a89a160ed3ef91ad566ec98e75325e7601f Author: Sun <95302870@qq.com> Date: Sat Jan 6 20:37:16 2024 +0800 首次尝试增加英文语言,并在我的信息设置 commit fb996e17cd11611d30c0e12feee00ddf7b225e32 Author: Sun <95302870@qq.com> Date: Sat Jan 6 18:22:40 2024 +0800 完成基础设置页面的语言国际化适配 --- src/assets/svg-icons/ion-language.svg | 1 + src/components/apps/About/index.vue | 10 +- src/components/apps/ImportExport/index.vue | 54 ++-- src/components/apps/ItemGroupManage/index.vue | 29 +- src/components/apps/Style/index.vue | 65 ++-- src/components/apps/UserInfo/index.vue | 26 +- src/components/deskModule/Clock/index.vue | 15 +- .../111index.vue} | 0 .../SystemMonitor/Edit/DiskEditor/index.vue | 10 +- .../Edit/GenericProgressStyleEditor/index.vue | 8 +- .../deskModule/SystemMonitor/Edit/index.vue | 30 +- .../deskModule/SystemMonitor/index copy.vue | 171 ----------- .../deskModule/SystemMonitor/index.vue | 16 +- src/locales/en-US.ts | 286 +++++++++++++----- src/locales/zh-CN.ts | 165 ++++++++-- src/store/modules/app/helper.ts | 11 +- src/store/modules/app/index.ts | 7 +- src/utils/defaultData/index.ts | 7 + .../home/components/AppStarter/index.vue | 18 +- .../home/components/EditItem/IconEditor.vue | 25 +- src/views/home/components/EditItem/index.vue | 52 ++-- src/views/home/index.vue | 47 +-- src/views/login/index.vue | 23 +- 23 files changed, 609 insertions(+), 467 deletions(-) create mode 100644 src/assets/svg-icons/ion-language.svg rename src/components/deskModule/SystemMonitor/Edit/{ProgressStyleEditor/index.vue => 111ProgressStyleEditor/111index.vue} (100%) delete mode 100644 src/components/deskModule/SystemMonitor/index copy.vue diff --git a/src/assets/svg-icons/ion-language.svg b/src/assets/svg-icons/ion-language.svg new file mode 100644 index 0000000..0a25377 --- /dev/null +++ b/src/assets/svg-icons/ion-language.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/apps/About/index.vue b/src/components/apps/About/index.vue index 4de4cab..4afef6d 100644 --- a/src/components/apps/About/index.vue +++ b/src/components/apps/About/index.vue @@ -35,7 +35,7 @@ onMounted(() => {
- v{{ versionName }} + v{{ versionName }}
@@ -43,19 +43,19 @@ onMounted(() => {
- 建议反馈:Github Issues + {{ $t('apps.about.issue') }}Github Issues
- QQ交流群:276594668 + {{ $t('apps.about.QQGroup') }}276594668 | - 二维码(推荐) + {{ $t('apps.about.QR') }}
- 开发者:红烧猎人 | 🧧打赏 + {{ $t('apps.about.author') }}红烧猎人 | {{ $t('apps.about.donate') }}
diff --git a/src/components/apps/ImportExport/index.vue b/src/components/apps/ImportExport/index.vue index 47a17d5..f6433b2 100644 --- a/src/components/apps/ImportExport/index.vue +++ b/src/components/apps/ImportExport/index.vue @@ -91,9 +91,9 @@ async function importIcons(): Promise { } catch (error) { if (error instanceof Error) - return `发生错误: ${error.message}` + return `${t('common.failed')}: ${error.message}` else - return '发生未知错误' + return t('common.unknownError') } } @@ -162,7 +162,7 @@ function handleFileChange(options: { file: UploadFileInfo; fileList: Array
- 保存排序 + {{ $t('common.saveSort') }}
diff --git a/src/locales/en-US.ts b/src/locales/en-US.ts index d033be4..42cbe83 100644 --- a/src/locales/en-US.ts +++ b/src/locales/en-US.ts @@ -1,94 +1,232 @@ export default { common: { + appName: 'Sun-Panel', add: 'Add', - addSuccess: 'Add Success', + addSuccess: 'Added successfully', edit: 'Edit', - editSuccess: 'Edit Success', + editSuccess: 'Edited successfully', + editFail: 'Edit failed', delete: 'Delete', - deleteSuccess: 'Delete Success', + deleteSuccess: 'Deleted successfully', + deleteFail: 'Delete failed', save: 'Save', - saveSuccess: 'Save Success', + saveSuccess: 'Saved successfully', + saveFail: 'Save failed', reset: 'Reset', action: 'Action', export: 'Export', - exportSuccess: 'Export Success', + exportSuccess: 'Exported successfully', import: 'Import', - importSuccess: 'Import Success', - clear: 'Clear', - clearSuccess: 'Clear Success', + importSuccess: 'Imported successfully', yes: 'Yes', no: 'No', confirm: 'Confirm', + cancel: 'Cancel', + warning: 'Warning', download: 'Download', - noData: 'No Data', - wrong: 'Something went wrong, please try again later.', - success: 'Success', - failed: 'Failed', + noData: 'No data available', + success: 'Operation successful', + failed: 'Operation failed', + uploadFail: 'Upload failed', + repeatLater: 'Please try again later', verify: 'Verify', - unauthorizedTips: 'Unauthorized, please verify first.', - }, - chat: { - newChatButton: 'New Chat', - placeholder: 'Ask me anything...(Shift + Enter = line break, "/" to trigger prompts)', - placeholderMobile: 'Ask me anything...', - copy: 'Copy', - copied: 'Copied', - copyCode: 'Copy Code', - clearChat: 'Clear Chat', - clearChatConfirm: 'Are you sure to clear this chat?', - exportImage: 'Export Image', - exportImageConfirm: 'Are you sure to export this chat to png?', - exportSuccess: 'Export Success', - exportFailed: 'Export Failed', - usingContext: 'Context Mode', - turnOnContext: 'In the current mode, sending messages will carry previous chat records.', - turnOffContext: 'In the current mode, sending messages will not carry previous chat records.', - deleteMessage: 'Delete Message', - deleteMessageConfirm: 'Are you sure to delete this message?', - deleteHistoryConfirm: 'Are you sure to clear this history?', - clearHistoryConfirm: 'Are you sure to clear chat history?', - preview: 'Preview', - showRawText: 'Show as raw text', - }, - setting: { - setting: 'Setting', - general: 'General', - advanced: 'Advanced', - config: 'Config', - avatarLink: 'Avatar Link', - name: 'Name', - description: 'Description', - role: 'Role', - temperature: 'Temperature', - top_p: 'Top_p', - resetUserInfo: 'Reset UserInfo', - chatHistory: 'ChatHistory', - theme: 'Theme', + inputPlaceholder: 'Please enter', + inputPlaceholderByText: 'Please enter {text}', + deleteConfirm: 'Are you sure you want to delete?', + deleteConfirmByName: 'Are you sure you want to delete {name}?', + username: 'Username', + nikeName: 'Nickname', + password: 'Password', + serverError: 'Server error', + unknownError: 'Unknown error', + role: { + regularUser: 'Regular', + admin: 'Admin', + }, + leastOne: 'Please keep at least one', + icon: 'Icon', + style: 'Style', + show: 'Show', + text: 'Text', + textColor: 'Text color', + sort: 'Sort', + saveSort: 'Save sort', language: 'Language', - api: 'API', - reverseProxy: 'Reverse Proxy', - timeout: 'Timeout', - socks: 'Socks', - httpsProxy: 'HTTPS Proxy', - balance: 'API Balance', - monthlyUsage: 'Monthly Usage', - }, - store: { - siderButton: 'Prompt Store', - local: 'Local', - online: 'Online', + refreshPage: 'Please refresh the page', + continue: 'Continue', title: 'Title', + image: 'Image', + backgroundColor: 'Background color', description: 'Description', - clearStoreConfirm: 'Whether to clear the data?', - importPlaceholder: 'Please paste the JSON data here', - addRepeatTitleTips: 'Title duplicate, please re-enter', - addRepeatContentTips: 'Content duplicate: {msg}, please re-enter', - editRepeatTitleTips: 'Title conflict, please revise', - editRepeatContentTips: 'Content conflict {msg} , please re-modify', - importError: 'Key value mismatch', - importRepeatTitle: 'Title repeatedly skipped: {msg}', - importRepeatContent: 'Content is repeatedly skipped: {msg}', - onlineImportWarning: 'Note: Please check the JSON file source!', - downloadError: 'Please check the network status and JSON file validity', + }, + form: { + required: 'Required field', + }, + panelHome: { + openLanUrl: 'Open LAN URL', + openWanUrl: 'Open WAN URL', + changeToLanModel: 'Switch to LAN mode', + changeToWanModel: 'Switch to WAN mode', + goToLogin: 'Go to login', + changeToLanModelSuccess: 'Switched to LAN mode (mode status saved locally)', + changeToWanModelSuccess: 'Switched to WAN mode (mode status saved locally)', + }, + appLauncher: { + title: 'System Applications & Settings', + }, + login: { + loginButton: 'Login', + usernamePlaceholder: 'Enter username', + passwordPlaceholder: 'Enter password', + welcomeMessage: 'Welcome back!', + }, + settingUserInfo: { + updatePassword: 'Change password', + oldPassword: 'Old password', + newPassword: 'New password', + confirmPassword: 'Confirm new password', + confirmPasswordInconsistentMsg: 'Passwords do not match', + logout: 'Logout', + confirmLogoutText: 'Are you sure you want to logout?', + logoutSuccess: 'You have safely logged out. Looking forward to seeing you again!', + }, + adminSettingUsers: { + appName: 'User Management', + passwordPlaceholder: 'Enter password', + EditpasswordPlaceholder: 'Enter new password, leave blank to keep the current password', + role: 'Role', + formRules: { + usernameRequired: 'Enter username with at least 5 characters', + roleRequired: 'Please select a role', + passwordLimit: '6-20 characters', + }, + alertText: 'Data between accounts is not shared', + userCountText: 'Total {count} users', + deletePromptContent: 'Are you sure you want to delete {name} ({username})?', + currentUseUsername: 'Current username', + setOrUnsetPublicMode: 'Set/Unset public access', + pblicText: 'Public', + }, + deskModule: { + searchBox: { + openWithNewOpen: 'Open in new window', + inputPlaceholder: 'Enter search content', + }, + clock: { + mon: 'Monday', + tue: 'Tuesday', + wed: 'Wednesday', + thu: 'Thursday', + fri: 'Friday', + sat: 'Saturday', + sun: 'Sunday', + }, + systemMonitor: { + systemState: 'System status', + diskMountPoint: 'Mount point', + progressColor: 'Main color', + progressRailColor: 'Secondary color', + cpuState: 'CPU status', + memoryState: 'Memory status', + diskState: 'Disk status', + }, + }, + iconItem: { + add: 'Add item', + edit: 'Edit item', + url: 'URL', + lanUrl: 'LAN URL', + getIcon: 'Get icon', + geticonFail: 'Failed to get icon', + openMethod: 'Open method', + onlineIcon: 'Online icon', + onlineIconLibrary: 'Online icon library', + inputIconName: 'Enter icon name', + inputIconUrlOrUpload: 'Enter icon URL or upload', + selectUpload: 'Local upload', + currentPageOpen: 'Open in current page', + newWindowOpen: 'Open in new window', + currentPageLayerOpen: 'Open in current page as layer', + getGroupFail: 'Failed to get group information', + iconGroup: 'Group', + lanUrlInputPlaceholder: 'http(s):// (LAN mode, will redirect to this address)', + }, + apps: { + baseSettings: { + appName: 'Basic Settings', + configSaved: 'Configuration saved', + configFailed: 'Configuration save failed, {message}', + show: 'Show', + hideTitle: 'Hide title', + textContent: 'Text content', + clock: 'Clock component', + clockSecondShow: 'Show seconds', + searchBar: 'Search bar component', + searchBarShow: 'Configuration saved', + searchBarSearchItem: 'Allow search bar to search items', + systemMonitorStatus: 'System status component', + showTitle: 'Show title', + publicVisitModeShow: 'Allow public mode display', + hideDescription: 'Hide description information', + wallpaper: 'Wallpaper', + uploadOrDragText: 'Click to upload or drag and drop into the box to replace the image', + vague: 'Blur', + mask: 'Mask', + contentArea: 'Content area', + maxWidth: 'Max width', + leftRightMargin: 'Left-right margin', + topMargin: 'Top margin', + bottomMargin: 'Bottom margin', + customFooter: 'Custom footer', + resetWarnText: 'Are you sure you want to reset these styles?', + detailIcon: 'Detail icon', + smallIcon: 'Small icon', + }, + itemGroupManage: { + appName: 'Group Management', + deleteWarnText: 'Are you sure you want to delete this group [{name}]? The application icons in this group will be lost after deletion.', + groupName: 'Group name', + }, + exportImport: { + appName: 'Export/Import', + tip: 'Importing icon configuration data will not clear existing icon data', + export: 'Export configuration', + import: 'Import configuration', + selectImportData: 'Select the configuration data to import', + selectExportData: 'Select the configuration data to export', + fileModified: 'The file has been modified, import with caution', + warnConfigFileLow: 'The configuration file version is too low but compatible', + softwareVersionLow: 'The current software version may be too old and may not be compatible with this configuration file. It is recommended to update the software to the latest version before importing again.', + errorConfigFileLow: 'The configuration file version is too low and cannot be compatible', + errorConfigFileFormat: 'The configuration file format is incorrect and cannot be imported', + moduleIcon: 'Icon configuration', + moduleStyle: 'Style configuration', + }, + userInfo: { + appName: 'My Information', + }, + about: { + appName: 'About', + viewUpdateLog: 'Click here to view update log', + issue: 'Feedback:', + QQGroup: 'QQ Group:', + QR: 'QR Code (Recommended)', + author: 'Author:', + donate: '🧧 Donate', + }, + uploadsFileManager: { + appName: 'Uploads File Management', + copyLink: 'Copy link', + infoTitle: 'File details', + fileName: 'Original file name', + path: 'File path', + uploadTime: 'Upload time', + deleteWarningText: 'Cannot be recovered after deletion. Are you sure you want to continue?', + copySuccess: 'Link copied successfully. You can paste it in the address bar.', + copyFailed: 'Copy failed', + setWallpaper: 'Set as wallpaper', + alertText: 'Here you can manage wallpapers and icons you have uploaded.', + nothingText: 'You haven\'t uploaded any images yet.', + }, }, } diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 5bbd3a8..30dc42a 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -8,16 +8,16 @@ export default { editFail: '编辑失败', delete: '删除', deleteSuccess: '删除成功', + deleteFail: '删除失败', save: '保存', saveSuccess: '保存成功', + saveFail: '保存成功', reset: '重置', action: '操作', export: '导出', exportSuccess: '导出成功', import: '导入', importSuccess: '导入成功', - // clear: '清空', - // clearSuccess: '清空成功', yes: '是', no: '否', confirm: '确定', @@ -25,46 +25,54 @@ export default { warning: '警告', download: '下载', noData: '暂无数据', - // wrong: '好像出错了,请稍后再试。', success: '操作成功', failed: '操作失败', + uploadFail: '上传失败', + repeatLater: '请稍后重试', verify: '验证', - unauthorizedTips: '未经授权,请先进行验证。', inputPlaceholder: '请输入', inputPlaceholderByText: '请输入{text}', + deleteConfirm: '你确定要删除吗?', + deleteConfirmByName: '你确定要删除{name}吗?', username: '账号', nikeName: '昵称', password: '密码', serverError: '服务器错误', + unknownError: '未知错误', role: { regularUser: '普通', admin: '管理', }, leastOne: '请至少保留一项', - }, - setting: { - setting: '设置', - general: '总览', - advanced: '高级', - config: '配置', - avatarLink: '头像链接', - avatar: '头像', - name: '名称', - description: '描述', - role: '角色设定', - temperature: 'Temperature', - top_p: '回答多样性', - resetUserInfo: '重置用户信息', - chatHistory: '聊天记录', - theme: '主题', + icon: '图标', + style: '样式', + show: '显示', + text: '文字', + textColor: '文字颜色', + sort: '排序', + saveSort: '保存排序', language: '语言', - api: 'API', - reverseProxy: '反向代理', - timeout: '超时', - socks: 'Socks', - httpsProxy: 'HTTPS Proxy', - balance: 'API余额', - monthlyUsage: '本月使用量', + refreshPage: '请刷新页面', + continue: '继续', + title: '标题', + image: '图片', + backgroundColor: '背景颜色', + description: '描述信息', + }, + form: { + required: '必填项', + }, + panelHome: { + openLanUrl: '打开局域网地址', + openWanUrl: '打开公网地址', + changeToLanModel: '切换为内网模式', + changeToWanModel: '切换为公网模式', + goToLogin: '前往登录', + changeToLanModelSuccess: '已经切换到内网模式(模式状态仅保存在本地)', + changeToWanModelSuccess: '已经切换到公网模式(模式状态仅保存在本地)', + }, + appLauncher: { + title: '系统应用 & 设置', }, login: { loginButton: '登录', @@ -83,6 +91,7 @@ export default { logoutSuccess: '您已经安全退出,期待与你再次相见!', }, adminSettingUsers: { + appName: '用户管理', passwordPlaceholder: '请输入密码', EditpasswordPlaceholder: '请输入新密码,留空密码不变', role: '角色', @@ -103,9 +112,111 @@ export default { openWithNewOpen: '新窗口打开', inputPlaceholder: '请输入搜索内容', }, + clock: { + mon: '星期一', + tue: '星期二', + wed: '星期三', + thu: '星期四', + fri: '星期五', + sat: '星期六', + sun: '星期日', + }, + systemMonitor: { + systemState: '系统状态', + diskMountPoint: '挂载点', + progressColor: '主色', + progressRailColor: '副色', + cpuState: 'CPU状态', + memoryState: '内存状态', + diskState: '磁盘状态', + }, + }, + iconItem: { + add: '添加项目', + edit: '修改项目', + url: '地址', + lanUrl: '局域网地址', + getIcon: '获取图标', + geticonFail: '图标获取失败', + openMethod: '打开方式', + onlineIcon: '在线图标', + onlineIconLibrary: '在线图标库', + inputIconName: '请输入图标名称', + inputIconUrlOrUpload: '输入图标地址或上传', + selectUpload: '本地上传', + currentPageOpen: '当前页面打开', + newWindowOpen: '新窗口打开', + currentPageLayerOpen: '当前页面弹窗打开', + getGroupFail: '分组信息获取失败', + iconGroup: '分组', + lanUrlInputPlaceholder: 'http(s)://(局域网模式,会跳转该地址)', }, apps: { + baseSettings: { + appName: '基础设置', + configSaved: '配置已保存', + configFailed: '配置保存失败,{message}', + show: '显示', + hideTitle: '隐藏标题', + textContent: '文本内容', + clock: '时钟组件', + clockSecondShow: '显示秒', + searchBar: '搜索栏组件', + searchBarShow: '配置已保存', + searchBarSearchItem: '允许搜索栏搜索项目', + systemMonitorStatus: '系统状态组件', + showTitle: '显示标题', + publicVisitModeShow: '公开模式允许显示', + hideDescription: '隐藏描述信息', + wallpaper: '壁纸', + uploadOrDragText: '点击上传替换图片或拖拽到框内', + vague: '模糊', + mask: '遮罩', + contentArea: '内容区域', + maxWidth: '最大宽度', + leftRightMargin: '左右边距', + topMargin: '上边距', + bottomMargin: '下边距', + customFooter: '自定义footer', + resetWarnText: '确定要重置这些样式吗?', + detailIcon: '详情图标', + smallIcon: '小图标', + }, + itemGroupManage: { + appName: '分组管理', + deleteWarnText: '你确定删除此分组[{name}],删除后此分组应用图标将丢失?', + groupName: '分组名称', + }, + exportImport: { + appName: '导出导入', + tip: '导入图标配置数据不会清空现有图标数据', + export: '导出配置', + import: '导入配置', + selectImportData: '请选择要导入的配置数据', + selectExportData: '请选择要导出的配置数据', + fileModified: '文件被修改过,谨慎导入', + warnConfigFileLow: '配置文件版本过低,但是兼容', + softwareVersionLow: '当前软件版本可能过旧,很有可能无法兼容该配置文件,请谨慎导入。推荐将软件更新到新版后再次导入', + errorConfigFileLow: '配置文件版本过低,无法兼容', + errorConfigFileFormat: '配置文件格式不正确,无法导入', + moduleIcon: '图标配置', + moduleStyle: '样式配置', + + }, + userInfo: { + appName: '我的信息', + }, + about: { + appName: '关于', + viewUpdateLog: '点此查看更新说明', + issue: '建议反馈:', + QQGroup: 'QQ交流群:', + QR: '二维码(推荐)', + author: '作者:', + donate: '🧧打赏', + }, uploadsFileManager: { + appName: '上传文件管理', copyLink: '复制链接', infoTitle: '文件详情', fileName: '原文件名', diff --git a/src/store/modules/app/helper.ts b/src/store/modules/app/helper.ts index f94b6f6..9fb3e00 100644 --- a/src/store/modules/app/helper.ts +++ b/src/store/modules/app/helper.ts @@ -13,7 +13,12 @@ export interface AppState { } export function defaultSetting(): AppState { - return { siderCollapsed: false, theme: 'light', language: 'zh-CN' } + const lan = (navigator.language).toLowerCase() + let language: Language = 'en-US' + if (lan.includes('zh')) + language = 'zh-CN' + + return { siderCollapsed: false, theme: 'light', language } } export function getLocalSetting(): AppState { @@ -24,3 +29,7 @@ export function getLocalSetting(): AppState { export function setLocalSetting(setting: AppState): void { ss.set(LOCAL_NAME, setting) } + +export function removeLocalState() { + ss.remove(LOCAL_NAME) +} diff --git a/src/store/modules/app/index.ts b/src/store/modules/app/index.ts index 055d1f8..4efbdfd 100644 --- a/src/store/modules/app/index.ts +++ b/src/store/modules/app/index.ts @@ -1,6 +1,6 @@ import { defineStore } from 'pinia' import type { AppState, Language, Theme } from './helper' -import { getLocalSetting, setLocalSetting } from './helper' +import { defaultSetting, getLocalSetting, removeLocalState, setLocalSetting } from './helper' import { store } from '@/store' export const useAppStore = defineStore('app-store', { @@ -26,6 +26,11 @@ export const useAppStore = defineStore('app-store', { recordState() { setLocalSetting(this.$state) }, + + removeToken() { + this.$state = defaultSetting() + removeLocalState() + }, }, }) diff --git a/src/utils/defaultData/index.ts b/src/utils/defaultData/index.ts index 17b24f9..b238f0d 100644 --- a/src/utils/defaultData/index.ts +++ b/src/utils/defaultData/index.ts @@ -1,3 +1,5 @@ +import type { Language } from '@/store/modules/app/helper' + export const defautSwatchesBackground = [ '#00000000', '#000000', @@ -8,3 +10,8 @@ export const defautSwatchesBackground = [ 'rgba(208, 48, 80, 1)', '#C418D1FF', ] + +export const languageOptions: { label: string; key: Language; value: Language }[] = [ + { label: 'English', key: 'en-US', value: 'en-US' }, + { label: '简体中文', key: 'zh-CN', value: 'zh-CN' }, +] diff --git a/src/views/home/components/AppStarter/index.vue b/src/views/home/components/AppStarter/index.vue index 69a3aec..77a6a94 100644 --- a/src/views/home/components/AppStarter/index.vue +++ b/src/views/home/components/AppStarter/index.vue @@ -3,6 +3,7 @@ import { computed, onMounted, onUnmounted, ref } from 'vue' import { NLayout, NLayoutContent, NLayoutSider, NSpace } from 'naive-ui' import { useAuthStore } from '@/store' import { AppLoader, RoundCardModal, SvgIcon } from '@/components/common' +import { t } from '@/locales' interface App { name: string @@ -23,38 +24,38 @@ const componentName = ref('UserInfo') const collapsed = ref(false) const screenWidth = ref(0) const isSmallScreen = ref(false) -const defaultTitle = '系统应用 & 设置' +const defaultTitle = t('appLauncher.title') const title = ref('') const height = ref('500px') const apps = ref([ { - name: '用户信息', + name: t('apps.userInfo.appName'), componentName: 'UserInfo', icon: 'material-symbols-person-edit-outline-rounded', }, { - name: '基本设置', + name: t('apps.baseSettings.appName'), componentName: 'Style', icon: 'ep-setting', }, { - name: '分组管理', + name: t('apps.itemGroupManage.appName'), componentName: 'ItemGroupManage', icon: 'material-symbols-ad-group-outline-rounded', }, { - name: '导入导出', + name: t('apps.exportImport.appName'), componentName: 'ImportExport', icon: 'icon-park-outline-import-and-export', }, { - name: '上传文件管理', + name: t('apps.uploadsFileManager.appName'), componentName: 'UploadFileManager', icon: 'tabler:file-upload', }, { - name: '关于', + name: t('apps.about.appName'), componentName: 'About', icon: 'lucide-info', }, @@ -93,7 +94,7 @@ function handleResize() { onMounted(() => { const adminApp: App = { - name: '用户管理', + name: t('adminSettingUsers.appName'), componentName: 'Users', icon: 'lucide-users', auth: 1, @@ -116,7 +117,6 @@ onUnmounted(() => {