feat: 完成前端多语言支持和菜单优化
- 缩短菜单标题,解决显示不全问题 - 添加跟随系统语言选项,作为默认选项 - 移除语言切换时的页面刷新,实现无刷新切换 - 完成主要页面的多语言替换: * ConfigPage - 全局配置页面 * ResetPassword - 重置密码页面 * LeaderList - Leader 列表页面 * UserList - 用户列表页面 * Statistics - 统计信息页面 * OrderList - 订单列表页面 * TemplateList - 模板列表页面 * CopyTradingList - 跟单配置列表页面 - 添加简体中文、繁体中文和英文的完整翻译键 - 优化语言设置页面,支持跟随系统语言
This commit is contained in:
@@ -2,6 +2,7 @@ import axios, { AxiosInstance, AxiosError } from 'axios'
|
||||
import type { ApiResponse } from '../types'
|
||||
import { getToken, setToken, removeToken } from '../utils'
|
||||
import { wsManager } from './websocket'
|
||||
import i18n from '../i18n/config'
|
||||
|
||||
/**
|
||||
* API 基础配置
|
||||
@@ -36,6 +37,9 @@ apiClient.interceptors.request.use(
|
||||
if (token) {
|
||||
config.headers.Authorization = `Bearer ${token}`
|
||||
}
|
||||
// 添加语言 Header
|
||||
const language = i18n.language || 'en'
|
||||
config.headers['X-Language'] = language
|
||||
return config
|
||||
},
|
||||
(error) => {
|
||||
@@ -473,5 +477,5 @@ export const apiService = {
|
||||
}
|
||||
}
|
||||
|
||||
export default apiClient
|
||||
export default apiService
|
||||
|
||||
|
||||
Reference in New Issue
Block a user