refactor(i18n): 移除 chrome.i18n 国际化,统一使用中文硬编码

移除 chromeI18n 工具、_locales 翻译文件和 manifest default_locale 配置,
将所有 UI 文案改为直接硬编码中文,并更新相关测试与文档。
This commit is contained in:
雨霖铃
2026-06-18 14:22:14 +00:00
parent 618f3c36f2
commit ec92afa294
68 changed files with 531 additions and 2148 deletions
+7 -7
View File
@@ -16,13 +16,13 @@ describe('features', () => {
it('should have all required properties for each feature', () => {
FEATURES.forEach((feature) => {
expect(feature).toHaveProperty('key');
expect(feature).toHaveProperty('labelKey');
expect(feature).toHaveProperty('descriptionKey');
expect(feature).toHaveProperty('label');
expect(feature).toHaveProperty('description');
expect(feature).toHaveProperty('defaultVisible');
expect(feature).toHaveProperty('components');
expect(typeof feature.key).toBe('string');
expect(typeof feature.labelKey).toBe('string');
expect(typeof feature.descriptionKey).toBe('string');
expect(typeof feature.label).toBe('string');
expect(typeof feature.description).toBe('string');
expect(typeof feature.defaultVisible).toBe('boolean');
expect(typeof feature.components).toBe('object');
expect(feature.components).toHaveProperty('popup');
@@ -50,14 +50,14 @@ describe('features', () => {
const feature = getFeatureByKey('dashboard');
expect(feature).toBeDefined();
expect(feature?.key).toBe('dashboard');
expect(feature?.labelKey).toBe('dashboard_title');
expect(feature?.label).toBe('仪表盘');
});
it('should return timestamp feature', () => {
const feature = getFeatureByKey('timestamp');
expect(feature).toBeDefined();
expect(feature?.key).toBe('timestamp');
expect(feature?.labelKey).toBe('timestamp_title');
expect(feature?.label).toBe('时间戳');
expect(feature?.themeColorKey).toBeDefined();
});
@@ -65,7 +65,7 @@ describe('features', () => {
const feature = getFeatureByKey('storageCleaner');
expect(feature).toBeDefined();
expect(feature?.key).toBe('storageCleaner');
expect(feature?.labelKey).toBe('storageCleaner_title');
expect(feature?.label).toBe('存储清理');
});
it('should return undefined for invalid key', () => {
+22 -22
View File
@@ -29,8 +29,8 @@ const TestDataGeneratorPage = lazy(() => import('@/pages/TestDataGenerator'));
export interface FeatureConfig {
key: PageType;
labelKey: string;
descriptionKey: string;
label: string;
description: string;
themeColorKey?: PaletteColorKey;
icon?: ComponentType<LucideProps>;
defaultVisible: boolean;
@@ -44,8 +44,8 @@ export interface FeatureConfig {
export const FEATURES: FeatureConfig[] = [
{
key: 'dashboard',
labelKey: 'dashboard_title',
descriptionKey: '',
label: '仪表盘',
description: '',
defaultVisible: true,
components: {
popup: DashboardPage,
@@ -55,8 +55,8 @@ export const FEATURES: FeatureConfig[] = [
},
{
key: 'timestamp',
labelKey: 'timestamp_title',
descriptionKey: 'timestamp_description',
label: '时间戳',
description: 'Unix 毫秒数转换与格式化',
themeColorKey: 'primary',
icon: Clock,
defaultVisible: true,
@@ -68,8 +68,8 @@ export const FEATURES: FeatureConfig[] = [
},
{
key: 'storageCleaner',
labelKey: 'storageCleaner_title',
descriptionKey: 'storageCleaner_description',
label: '存储清理',
description: '清理缓存、Cookies 及本地存储',
themeColorKey: 'warning',
icon: Database,
defaultVisible: true,
@@ -81,8 +81,8 @@ export const FEATURES: FeatureConfig[] = [
},
{
key: 'qrCode',
labelKey: 'qrCode_title',
descriptionKey: 'qrCode_description',
label: '二维码工具',
description: '生成当前选中的 URL 的二维码',
themeColorKey: 'success',
icon: QrCode,
defaultVisible: true,
@@ -94,8 +94,8 @@ export const FEATURES: FeatureConfig[] = [
},
{
key: 'textStatistics',
labelKey: 'textStatistics_title',
descriptionKey: 'textStatistics_description',
label: '文本统计',
description: '实时分析文本字符、单词及字节',
themeColorKey: 'secondary',
icon: FileText,
defaultVisible: true,
@@ -107,8 +107,8 @@ export const FEATURES: FeatureConfig[] = [
},
{
key: 'jwt',
labelKey: 'jwt_title',
descriptionKey: 'jwt_description',
label: 'JWT 解析',
description: 'JSON Web Token 解码与查看',
themeColorKey: 'info',
icon: Key,
defaultVisible: true,
@@ -120,8 +120,8 @@ export const FEATURES: FeatureConfig[] = [
},
{
key: 'jsonDiff',
labelKey: 'jsonDiff_title',
descriptionKey: 'jsonDiff_description',
label: 'JSON 工具',
description: '差异比较、格式化、YAML/TOML 转换及压缩',
themeColorKey: 'primary',
icon: GitCompareArrows,
defaultVisible: true,
@@ -133,8 +133,8 @@ export const FEATURES: FeatureConfig[] = [
},
{
key: 'base64Converter',
labelKey: 'base64Converter_title',
descriptionKey: 'base64Converter_description',
label: 'Base64 转换器',
description: '文本、文件与图像的 Base64 编码转换',
themeColorKey: 'info',
icon: ArrowLeftRight,
defaultVisible: true,
@@ -146,8 +146,8 @@ export const FEATURES: FeatureConfig[] = [
},
{
key: 'rightClickRestorer',
labelKey: 'rightClickRestorer_title',
descriptionKey: 'rightClickRestorer_description',
label: '右键恢复',
description: '检测并恢复被网站禁用的浏览器右键菜单',
themeColorKey: 'success',
icon: MousePointerClick,
defaultVisible: true,
@@ -159,8 +159,8 @@ export const FEATURES: FeatureConfig[] = [
},
{
key: 'testDataGenerator',
labelKey: 'testDataGenerator_title',
descriptionKey: 'testDataGenerator_description',
label: '测试数据生成器',
description: '自定义规则批量生成测试数据',
themeColorKey: 'warning',
icon: FileSpreadsheet,
defaultVisible: true,