Skip to content

feat: bilingual i18n support + UI optimizations (help modal, per-page badge, fixed layout) - #8

Open
likesrt wants to merge 6 commits into
hellraiserrob:mainfrom
likesrt:main
Open

feat: bilingual i18n support + UI optimizations (help modal, per-page badge, fixed layout)#8
likesrt wants to merge 6 commits into
hellraiserrob:mainfrom
likesrt:main

Conversation

@likesrt

@likesrt likesrt commented Aug 21, 2026

Copy link
Copy Markdown

Changes

  • i18n: Added Chinese/English bilingual support with a language switcher in settings
  • Help modal: Now fills the popup viewport, height adapts to content with internal scrolling
  • Extension badge: Shows the number of rules matched on the current page (hidden when zero) instead of the global enabled count; no new permissions
  • Layout: Fixed-height layout — detail area scrolls internally while the sidebar stays visible
  • Tests: Added unit tests for the badge matcher, 144 tests passing

likesrt added 6 commits July 4, 2026 10:08
- 新增 locales 模块,包含中英文翻译字典、类型定义和工具函数
- 添加 useI18n composable,组件通过 provide/inject 获取翻译函数
- 语言默认跟随浏览器设置,支持在 Settings 面板手动切换并持久化
- 所有功能文案和技术术语均已翻译,品牌名 ModBox 保持原样
- 功能按钮(操作类型、拦截类型、规则标题等)增加 tooltip 悬停说明
- Settings 面板新增「使用帮助」弹窗,提供功能概述和使用指引
- 构建通过,118 个已有测试全部通过
- service worker 新增规则匹配器(urlFilter 通配语法 + requestDomains 域名后缀匹配),近似复刻 DNR 条件语义
- 监听 tabs.onActivated / tabs.onUpdated / windows.onFocusChanged / storage.onChanged,切换或刷新页面时重算角标
- 命中 0 条或特殊页面(chrome:// 等)时隐藏角标
- 移除 popup 内直接写角标的逻辑,角标写入收敛到 service worker 单独负责;面板顶部"启用规则总数"保持不变

Generated with Co-Authored-By: FuFu <fufu@ansss.de>
- .help-content 去掉 max-height:70vh 的过小限制,改为 max-height:100%,仅受弹窗遮罩内边距约束
- 弹窗内容补底色与圆角,视觉上与面板一致;宽度维持现状不动

Generated with Co-Authored-By: FuFu <fufu@ansss.de>
- .folders 锁定 calc(100vh - 20px),右侧 folders__detail 内部滚动(overflow-y:auto)
- 侧边栏常驻可见;列表过长时侧边栏自身内部滚动,底部 sticky 设置块随之自然生效
- 帮助弹窗样式同步迁移:.help-content 高度上限放宽为遮罩可用空间
- 兼容 compact 模式收窄侧边栏

Generated with Co-Authored-By: FuFu <fufu@ansss.de>
- 覆盖 parseDomains / hostMatchesDomain / urlFilterToRegExp(* 通配、| 与 || 锚点、转义、大小写)
- conditionMatchesPage:urlFilter 与域名 AND 关系、fallback 域名链、document:true 忽略 urlFilter
- countMatchedRules:四类规则计数、各级 active 开关、脏数据安全
- updateBadge 集成(chrome stub):命中显示数字、0 命中/特殊页面/无数据/坏 JSON 时隐藏、生命周期监听注册
- 通过 Vite ?raw 导入 service worker 源码并在注入 stub 的沙箱中执行,无需 Node 类型依赖

Generated with Co-Authored-By: FuFu <fufu@ansss.de>
根因:.panel__modal 是 absolute 定位,只能盖住所在的那张小卡片,
help-content 的 max-height:100% 因此被限制在卡片内,视觉上毫无变化。
新增 panel__modal--fullscreen(position:fixed)铺满整个 popup 视口,
帮助内容随之占满可用空间;其余确认类弹窗保持 absolute 不受影响。

Generated with Co-Authored-By: FuFu <fufu@ansss.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant