feat(i18n): 完善多模块多语言适配与发版验证

扩展前后端多语言文案与共享词典。增加多模块 i18n 回归测试与 guard。收口外部 SQL 菜单和弹窗多语言文案。
This commit is contained in:
tianqijiuyun-latiao
2026-06-17 13:17:33 +08:00
parent 76b0163bd3
commit 9364c48ef0
135 changed files with 8401 additions and 1325 deletions

View File

@@ -1,32 +1,56 @@
import { describe, expect, it } from 'vitest';
import { readFileSync } from 'node:fs';
import { t as translate } from '../i18n';
import { resolveDataSyncEntryModePresentation } from './dataSyncEntryMode';
const en = (key: string) => translate(key, undefined, 'en-US');
const source = readFileSync(new URL('./dataSyncEntryMode.ts', import.meta.url), 'utf8');
describe('resolveDataSyncEntryModePresentation', () => {
it('marks schema compare as a read-only independent entry', () => {
const presentation = resolveDataSyncEntryModePresentation('schemaCompare');
const presentation = resolveDataSyncEntryModePresentation('schemaCompare', en);
expect(presentation.title).toBe('表结构比对');
expect(presentation.analyzeButtonText).toBe('开始比对');
expect(presentation.badgeText).toBe('结构比对');
expect(presentation.title).toBe('Schema Compare');
expect(presentation.analyzeButtonText).toBe('Start Comparison');
expect(presentation.badgeText).toBe('Schema Compare');
expect(presentation.readOnly).toBe(true);
});
it('marks data compare as a read-only independent entry', () => {
const presentation = resolveDataSyncEntryModePresentation('dataCompare');
const presentation = resolveDataSyncEntryModePresentation('dataCompare', en);
expect(presentation.title).toBe('数据比对');
expect(presentation.tableSelectLabel).toContain('比对数据');
expect(presentation.badgeText).toBe('数据比对');
expect(presentation.title).toBe('Data Compare');
expect(presentation.tableSelectLabel).toContain('compare data');
expect(presentation.badgeText).toBe('Data Compare');
expect(presentation.readOnly).toBe(true);
});
it('keeps the original sync entry writable', () => {
const presentation = resolveDataSyncEntryModePresentation('sync');
const presentation = resolveDataSyncEntryModePresentation('sync', en);
expect(presentation.title).toBe('数据同步工作台');
expect(presentation.analyzeButtonText).toBe('对比差异');
expect(presentation.badgeText).toBe('同步模式');
expect(presentation.title).toBe('Data Sync Workbench');
expect(presentation.analyzeButtonText).toBe('Analyze Differences');
expect(presentation.badgeText).toBe('Sync Mode');
expect(presentation.readOnly).toBe(false);
});
it('keeps entry mode presentation text out of source literals', () => {
[
'表结构比对',
'按源表与目标表生成结构差异',
'请选择需要比对结构的表',
'数据比对',
'请选择需要比对数据的表',
'数据同步工作台',
'请选择需要同步的表',
'执行结果',
].forEach((snippet) => {
expect(source).not.toContain(snippet);
});
expect(source).toContain('data_sync.entry_mode.schema_compare.title');
expect(source).toContain('data_sync.entry_mode.data_compare.title');
expect(source).toContain('data_sync.step.result');
});
});