Files
dsh_shenxian/web/index.html
T
admin b617cdbaa7 feat(web): 平台多语言运行时(i18n,档案 81 · R5)
⚠️ 本提交是**另一执行会话**已完成、且**已上线**的源码侧改动,由本会话代为入库
   (线上 https://alotbuy.com/login.html 已引用 /i18n.js)。

- web/i18n.js(新增 276 行):词条表 + data-i18n / data-i18n-attr 就地替换。
  口径(用户定):**这个项目是全球化的 ⇒ 默认语言 = 英语**;
  优先级 ?lang= → cookie `dsh_lang` → navigator.language(**仅命中支持列表才用**)→ `en`;
  ⚠️ cookie 名不得含平台内部名(verify-static 的 BANNED 去痕迹约束会拦)。
- web/{index,login,register,wake}.html:接入 <script src="/i18n.js"> + 文案打标
  + 页脚语言下拉(中性样式、不新增页面)。
- scripts/verify-static.mjs:新增「**已迁移多语言的页面不得再出现裸中文文案**」
  —— I18N_PAGES 白名单(迁一页加一个,未迁页仍允许中文,不会误拦);
  判定前先剥掉 HTML/JS 注释(注释不算文案)。
- scripts/verify-platform-admin-section.mjs:随「偏好设置 = 语言切换(全角色)」新增分区数断言
  (admin 4 个分区 / 非 admin 3 个;切换走官方 ctx.locale.setLocale,语言 id 与官方 LOCALE_IDS 一致)。

验证:node scripts/verify-static.mjs ✓ | node scripts/verify-platform-admin-section.mjs ✓(本会话复核已跑通)
2026-09-15 18:54:02 +08:00

34 lines
977 B
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title data-i18n="index.title">Workspace</title>
<!-- 档案 81 · R5:平台多语言运行时(默认英语) -->
<script src="/i18n.js"></script>
</head>
<body>
<script>
;(async () => {
const res = await fetch('/api/auth/me')
if (!res.ok) {
location.href = '/login.html'
return
}
// 所有用户(admin/active)统一直达 DSH 会话窗口
try {
const r = await fetch('/api/dsh/enter', { method: 'POST' })
const b = await r.json().catch(() => ({}))
if (r.ok && b.kind === 'session' && b.url) {
location.href = b.url
return
}
} catch {
// fall through to desktop
}
location.href = '/portal.html'
})()
</script>
</body>
</html>