This commit is contained in:
nettee
2026-05-13 12:04:29 +08:00
parent db414a1a79
commit 735fdd9c25
3 changed files with 14 additions and 6 deletions
+1 -1
View File
@@ -66,7 +66,7 @@
| SET-041 | 切换到 `fa` 等 RTL 语言后,会同步更新 `html[dir=rtl]`,且语言菜单支持 `Escape` 关闭 | `SettingsDialog.execution.test.tsx` |
| SET-042 | Language 页面不依赖全局保存按钮;语言切换即时生效,关闭 Settings 也不会回滚已应用 locale | `SettingsDialog.execution.test.tsx` |
| SET-043 | 多语言内容资源可通过翻译字典或英文 fallback 渲染为非空 skill、design system、prompt template 展示内容 | `localized-content.test.ts` |
| SET-044 | Prompt template category 和 tag 在缺少 locale 字典项时回退到源值,已有字典项仍可本地化 | `localized-content.test.ts` |
| SET-044 | Design system category、prompt template category 和 tag 在缺少 locale 字典项时回退到源值,已有字典项仍可本地化 | `localized-content.test.ts` |
| SET-045 | Notifications 默认以 `offline` 展示;开启 completion sound 后才会显示成功/失败音选择器,并立即试听默认成功音 | `SettingsDialog.execution.test.tsx` |
| SET-046 | Notifications 支持切换 success / failure sound,并把声音选择保存到通知配置 | `SettingsDialog.execution.test.tsx` |
| SET-047 | Desktop notification 在授权成功后会切为 `active`,支持发送测试通知并展示发送结果文案 | `SettingsDialog.execution.test.tsx` |
+12 -4
View File
@@ -11,6 +11,7 @@ declare global {
}
type LocalizedContentModule = {
localizeDesignSystemCategory: (locale: string, category: string) => string;
localizeDesignSystemSummary: (locale: string, system: DesignSystemResource) => string;
localizePromptTemplateSummary: (
locale: string,
@@ -34,8 +35,12 @@ if (localizedContentModule == null) {
throw new Error('Failed to load apps/web localized content ids');
}
const { localizeDesignSystemSummary, localizePromptTemplateSummary, localizeSkillDescription } =
localizedContentModule;
const {
localizeDesignSystemCategory,
localizeDesignSystemSummary,
localizePromptTemplateSummary,
localizeSkillDescription,
} = localizedContentModule;
const COVERAGE_LOCALES = ['de', 'fr', 'ru'] as const;
const RESOURCE_ID_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
@@ -364,7 +369,7 @@ describe('localized display content coverage', () => {
});
for (const locale of COVERAGE_LOCALES) {
it(`falls back to source prompt-template category and tags for ${locale} when dictionary entries are missing`, () => {
it(`falls back to source design-system and prompt-template metadata for ${locale} when dictionary entries are missing`, () => {
const localized = localizePromptTemplateSummary(locale, {
id: 'missing-template-translation',
category: 'Untranslated Category',
@@ -373,12 +378,15 @@ describe('localized display content coverage', () => {
summary: ' English summary from source ',
});
expect(localizeDesignSystemCategory(locale, 'Untranslated Category')).toBe(
'Untranslated Category',
);
expect(localized.title).toBe(' English title from source ');
expect(localized.summary).toBe(' English summary from source ');
expect(localized.category).toBe('Untranslated Category');
expect(localized.tags[0]).toBe('untranslated-tag');
expect(normalizeText(localized.tags[1] ?? ''), `${locale} should still localize known tags`).not.toEqual(
'',
'3d',
);
});
}
@@ -168,7 +168,7 @@ Flow:
### Implementation
- `e2e/tests/localized-content.test.ts` - removed the full coverage gate that compared discovered category / tag values against `LOCALIZED_CONTENT_IDS`, kept the real-resource displayability smoke test, and added direct assertions that prompt-template category / tag values fall back to source values when dictionary entries are missing.
- `e2e/tests/localized-content.test.ts` - removed the full coverage gate that compared discovered category / tag values against `LOCALIZED_CONTENT_IDS`, kept the real-resource displayability smoke test, and added direct assertions that design-system category plus prompt-template category / tag values fall back to source values when dictionary entries are missing.
- `apps/web/tests/i18n/content.test.ts` - strengthened the unit assertion for fallback behavior when a prompt-template category is unknown.
- `docs/skills-contributing.md` - changed localized display copy into an optional enhancement path for featured skills, and clarified that tests focus on displayable resources and fallback behavior.
- `docs/testing/e2e-coverage/settings.md` - rewrote SET-043 / SET-044 as fallback display integrity and optional translation behavior coverage.