From 6c036d7b59e6c6b3b187828c7d7b5d696964f51c Mon Sep 17 00:00:00 2001 From: IanShaw027 <131567472+IanShaw027@users.noreply.github.com> Date: Sun, 4 Jan 2026 20:49:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E4=BC=98=E5=8C=96=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E7=BB=84=E4=BB=B6=E5=92=8C=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 Accept-Language 请求头支持后端翻译 - 优化账户状态指示器和测试模态框 - 简化用户属性表单和配置模态框 - 新增多个国际化翻译条目 - 重构管理视图代码,提升可维护性 --- frontend/src/api/client.ts | 7 ++ .../account/AccountStatusIndicator.vue | 13 +-- .../components/account/AccountTestModal.vue | 16 ++-- .../src/components/user/UserAttributeForm.vue | 13 +-- .../user/UserAttributesConfigModal.vue | 10 +-- frontend/src/i18n/locales/en.ts | 48 +++++++++++ frontend/src/i18n/locales/zh.ts | 35 +++++++- frontend/src/views/admin/DashboardView.vue | 2 +- frontend/src/views/admin/GroupsView.vue | 12 +-- frontend/src/views/admin/ProxiesView.vue | 18 ++-- frontend/src/views/admin/RedeemView.vue | 6 +- .../src/views/admin/SubscriptionsView.vue | 2 +- frontend/src/views/admin/UsersView.vue | 86 ++++++------------- frontend/src/views/setup/SetupWizardView.vue | 63 ++++++++------ 14 files changed, 189 insertions(+), 142 deletions(-) diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts index 3aac41a6..0aafd893 100644 --- a/frontend/src/api/client.ts +++ b/frontend/src/api/client.ts @@ -5,6 +5,7 @@ import axios, { AxiosInstance, AxiosError, InternalAxiosRequestConfig } from 'axios' import type { ApiResponse } from '@/types' +import { getLocale } from '@/i18n' // ==================== Axios Instance Configuration ==================== @@ -27,6 +28,12 @@ apiClient.interceptors.request.use( if (token && config.headers) { config.headers.Authorization = `Bearer ${token}` } + + // Attach locale for backend translations + if (config.headers) { + config.headers['Accept-Language'] = getLocale() + } + return config }, (error) => { diff --git a/frontend/src/components/account/AccountStatusIndicator.vue b/frontend/src/components/account/AccountStatusIndicator.vue index 914678a5..2783dbd9 100644 --- a/frontend/src/components/account/AccountStatusIndicator.vue +++ b/frontend/src/components/account/AccountStatusIndicator.vue @@ -52,7 +52,7 @@
- Rate limited until {{ formatTime(account.rate_limit_reset_at) }} + {{ t('admin.accounts.statuses.rateLimitedUntil', { time: formatTime(account.rate_limit_reset_at) }) }}
@@ -77,7 +77,7 @@
- Overloaded until {{ formatTime(account.overload_until) }} + {{ t('admin.accounts.statuses.overloadedUntil', { time: formatTime(account.overload_until) }) }}
@@ -96,9 +96,12 @@