Skip to content

fix(preset): en 下 PTC 预设仍显示中文——展示层按 code 键桥接 ptc - #762

Open
heyimcy wants to merge 2 commits into
ccch1mneyyy:mainfrom
heyimcy:bugfix-fixPresetDisplay
Open

fix(preset): en 下 PTC 预设仍显示中文——展示层按 code 键桥接 ptc#762
heyimcy wants to merge 2 commits into
ccch1mneyyy:mainfrom
heyimcy:bugfix-fixPresetDisplay

Conversation

@heyimcy

@heyimcy heyimcy commented Sep 5, 2026

Copy link
Copy Markdown

/preset 选择器与补全在 en 下对 PTC 预设回退中文:官方预设 code→ptc 改名 (0.1.2 线),但 i18n 字典键仍用旧 id(preset-name-code / preset-desc-code)。 listPresets 按名册实际 id 拼键,0.1.2 下拼出 preset-name-ptc 查不到, tOr 回退名册中文文案;standard/minimal/cordis/liangshen 因 id 未改正常切英文。

  • preset-resolution.ts 新增 presetDisplayIdptc 桥回 code,其余 id 透传; 旧线 code 直接命中字典键,新线 ptc 桥接回旧键,双线兼容
  • channel.ts listPresets 拼字典键改用 presetDisplayId(preset.id)
  • verify-minimal-preset-tools 增加 en 下 ptc/standard/minimal 显示回归
  • verify-i18n 同步动态键拼接点注释

验证:全量 tsc 编译、verify-minimal-preset-tools、verify-i18n、verify:boundary 通过。

变更摘要 / Summary

关联 / Related

变更类型 / Type

  • fix — 修复缺陷
  • feat — 新增能力
  • docs — 仅文档
  • refactor / perf — 不改变外部行为
  • ci / chore — 构建、工作流、仓库维护

验证 / Verification

  • pnpm build(compile + 全部构建门禁)
  • 按改动面选的聚焦回归脚本(对照表见 docs/contributing.md
  • 终端可见改动:在 inline 与 fullscreen 两种模式、窄终端宽度下手动演练过
<!-- 命令与输出 -->

自查 / Checklist

  • 只改了 src/,没有手改或提交 lib/ 下的生成产物
  • 官方 @deepseek-ai/* 的 import 仍只出现在 src/dsh-adapter/
  • 行为、配置、快捷键与限制的改动已在 README.mdREADME_EN.md 双语同步
  • 改了 cordis.patch.yml 的话,patch-surface.snapshot.json 已同步
  • 只暂存了显式路径,没有用 git add . / git add -A

Summary by CodeRabbit

  • Bug Fixes

    • Corrected localized names and descriptions for the renamed ptc preset.
    • Preset rosters continue to use their current identifiers while displaying the appropriate translated text.
    • Improved English localization for standard, minimal, and ptc presets.
  • Tests

    • Added regression coverage to verify preset names and descriptions display correctly across English and Chinese localization settings.

`/preset` 选择器与补全在 en 下对 PTC 预设回退中文:官方预设 code→ptc 改名
(0.1.2 线),但 i18n 字典键仍用旧 id(`preset-name-code` / `preset-desc-code`)。
`listPresets` 按名册实际 id 拼键,0.1.2 下拼出 `preset-name-ptc` 查不到,
`tOr` 回退名册中文文案;standard/minimal/cordis/liangshen 因 id 未改正常切英文。

- `preset-resolution.ts` 新增 `presetDisplayId`:`ptc` 桥回 `code`,其余 id 透传;
  旧线 `code` 直接命中字典键,新线 `ptc` 桥接回旧键,双线兼容
- `channel.ts` `listPresets` 拼字典键改用 `presetDisplayId(preset.id)`
- `verify-minimal-preset-tools` 增加 en 下 ptc/standard/minimal 显示回归
- `verify-i18n` 同步动态键拼接点注释

验证:全量 tsc 编译、verify-minimal-preset-tools、verify-i18n、verify:boundary 通过。
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: d4c5c8e1-ffa1-4822-96f6-7af46a498a85

📥 Commits

Reviewing files that changed from the base of the PR and between 18e2bb0 and 017fbe6.

📒 Files selected for processing (4)
  • scripts/verify-i18n.ts
  • scripts/verify-minimal-preset-tools.mjs
  • src/dsh-adapter/channel.ts
  • src/dsh-adapter/preset-resolution.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change adds compatibility mapping for the renamed ptc preset, applies it to localized preset names and descriptions, updates related documentation, and adds English localization regression coverage.

Changes

Preset display localization

Layer / File(s) Summary
Display ID compatibility
src/dsh-adapter/preset-resolution.ts
Adds presetDisplayId, which maps ptc to code and leaves other preset IDs unchanged.
Channel localization and validation
src/dsh-adapter/channel.ts, scripts/verify-minimal-preset-tools.mjs, scripts/verify-i18n.ts
Preset listings use display IDs for localized text while preserving roster IDs and metadata. Regression coverage verifies English names and the ptc description. Documentation reflects the new key-generation source.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 42979

This change restores English display text for the PTC preset without changing preset identities or selection behavior. No current merge-blocking risk remains.

Suggested reviewers: nagi-ovo, ccch1mneyyy

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: fixing English PTC preset display by mapping the renamed ptc ID to the legacy code localization key.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@heyimcy

heyimcy commented Sep 5, 2026

Copy link
Copy Markdown
Author

修复 lang 切换为英文之后,Preset 中 PTC 模式依然是中文的情况。

image

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