feat(i18n): 安全批量转换 135 文件 — 覆盖率 34%→62%

使用 i18n.t() 全局方式(避免 hook 定位问题):
- 288 目标文件中 135 个成功转换
- 2228 处中文替换为 i18n.t() 调用
- 1006 个新翻译 key 添加到 zh-CN.json + en-US.json
- 词典总量: 3554 keys (22 namespaces)
- tsc 零错误 + Vite 构建成功
- 6 个含代码示例/数据字符串的文件安全回退
This commit is contained in:
attacker committed 2026-07-03 02:14:20 +08:00
1 parent 72bfb0e12d
commit 55f216cfbb
131 files changed
+4049 -1908

No files matched your search

+2 -1
View File
@@ -1,5 +1,6 @@
import { useUserStore } from '@/store';
import { getToken, clearToken } from './storage';
import i18n from '@/i18n';
const API_PREFIX = '/api/v1';
@@ -100,7 +101,7 @@ async function request<T = any>(
clearToken();
useUserStore.getState().logout();
window.location.href = '/login';
throw new Error('登录已过期,请重新登录');
throw new Error(i18n.t('common.requestts.sd3ab821c'));
}
let json: ApiResponse<T>;
+10 -9
View File
@@ -1,6 +1,7 @@
// 主题常量与持久化 — 主流主题 + 开发者主题 + 跟随系统 // Logan.Li
import { getItem, setItem, STORAGE_KEYS } from './storage';
import i18n from '@/i18n';
/** 用户选择的主题偏好(含跟随系统) */
export type ThemePreference =
@@ -31,22 +32,22 @@ export interface ThemeGroup {
/** 主流主题 — 默认推荐 */
const MAINSTREAM_THEMES: ThemeOption[] = [
{ id: 'system', name: '跟随系统', description: '自动匹配操作系统浅色/深色', isDark: false, primaryColor: 'linear-gradient(135deg, #2563eb 50%, #0d1117 50%)' },
{ id: 'ocean-deep', name: '深海蓝', description: 'GitHub 风格蓝黑专业暗色', isDark: true, primaryColor: '#0d1117' },
{ id: 'light-professional', name: '明亮白', description: '企业控制台清爽浅色', isDark: false, primaryColor: '#2563eb' },
{ id: 'system', name: i18n.t('common.lightDark'), description: i18n.t('common.themets.s17d84295'), isDark: false, primaryColor: 'linear-gradient(135deg, #2563eb 50%, #0d1117 50%)' },
{ id: 'ocean-deep', name: i18n.t('common.themets.s2f82cbb2'), description: i18n.t('common.themets.s29ee972b'), isDark: true, primaryColor: '#0d1117' },
{ id: 'light-professional', name: i18n.t('common.themets.s2d43cc04'), description: i18n.t('common.themets.s37e76182'), isDark: false, primaryColor: '#2563eb' },
];
/** 开发者主题 — 高辨识度扩展 */
const DEVELOPER_THEMES: ThemeOption[] = [
{ id: 'one-dark', name: 'One Dark', description: 'Atom 暖灰 IDE,紫绿语法渐变', isDark: true, primaryColor: '#c678dd' },
{ id: 'dracula', name: 'Dracula', description: '经典紫粉暗色,极高辨识度', isDark: true, primaryColor: '#bd93f9' },
{ id: 'tokyo-night', name: 'Tokyo Night', description: '东京霓虹深蓝紫,VS Code 热门', isDark: true, primaryColor: '#7aa2f7' },
{ id: 'catppuccin', name: 'Catppuccin', description: '马卡龙柔和暗色,护眼', isDark: true, primaryColor: '#89b4fa' },
{ id: 'one-dark', name: 'One Dark', description: i18n.t('common.themets.s02b08e05'), isDark: true, primaryColor: '#c678dd' },
{ id: 'dracula', name: 'Dracula', description: i18n.t('common.themets.s525ce260'), isDark: true, primaryColor: '#bd93f9' },
{ id: 'tokyo-night', name: 'Tokyo Night', description: i18n.t('common.themets.s6f40fb5e'), isDark: true, primaryColor: '#7aa2f7' },
{ id: 'catppuccin', name: 'Catppuccin', description: i18n.t('common.themets.s571aa09d'), isDark: true, primaryColor: '#89b4fa' },
];
export const THEME_GROUPS: ThemeGroup[] = [
{ label: '主流', options: MAINSTREAM_THEMES },
{ label: '开发者', options: DEVELOPER_THEMES },
{ label: i18n.t('common.themets.s8392cae7'), options: MAINSTREAM_THEMES },
{ label: i18n.t('common.themets.sc2e48855'), options: DEVELOPER_THEMES },
];
export const THEME_OPTIONS: ThemeOption[] = [