feat(i18n): T15 full-stack language audit with coverage assertions

- viewer/admin 错误码→文案映射按契约 ErrorCodes 枚举全集登记(机器守护
  spec 遍历枚举断言无缺漏 + 映射键在 zh/en 词条均存在 + locale 键集
  递归相等);mobile 镜像补齐 DOWNLOAD_DISABLED(P4a 增补漏登)
- 漏译修复:viewer.photoRemoved en 侧缺失(审计测试捕获);
  DOWNLOAD_DISABLED 观众侧专属文案 + useDownload 专属提示接线;
  admin apiMsg 增 RATE_LIMITED/ALBUM_NOT_PUBLIC/DOWNLOAD_DISABLED/
  SYNC_AUTH_FAILED 四码词条
- 运行时抽查:admin 主旅程 en 版 e2e(登录→相册管理全英文 + 偏好
  持久);embed iframe lang=en 渲染与深链跟随 e2e(zh 侧既有用例覆盖)
- contracts 新增 ./errors 浏览器安全子路径(errors.ts 纯 TS);
  admin 增 @photo/contracts devDep(仅测试消费)

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-20 23:44:27 +08:00
parent 0238f505c4
commit 7385785504
17 changed files with 310 additions and 13 deletions
+6 -1
View File
@@ -2,7 +2,8 @@
///
/// 1:1 对照 `packages/contracts/src/errors.ts` 的 `ErrorCodes` 与
/// `packages/contracts/openapi.yaml` `components.schemas.Error` 的 enum
/// (17 项)。契约约定:客户端按 code 映射多语言文案(l10n 解析留在 UI
/// (18 项;P4a 增补 DOWNLOAD_DISABLED,P4b Task 6 语言验收时补齐镜像)。
/// 契约约定:客户端按 code 映射多语言文案(l10n 解析留在 UI
/// 层),`message` 仅供诊断。
///
/// 文件末尾的 [networkError] / [networkTimeout] / [cancelled] /
@@ -51,6 +52,10 @@ abstract final class ErrorCodes {
/// 照片不存在、未发布或不属于该相册(404,观众端)。
static const String photoNotPublic = 'PHOTO_NOT_PUBLIC';
/// 相册可见但未开放下载(403,P4a 下载两级开关;App 无下载面,
/// 仅为与 errors.ts 全量 1:1 对齐而镜像——文案走 errorGeneric 兜底)。
static const String downloadDisabled = 'DOWNLOAD_DISABLED';
/// 参数校验失败(400,经全局校验管道)。
static const String validationFailed = 'VALIDATION_FAILED';