refactor(WeaselSetup): 支持按地区选择安装 profile(简/繁/港/澳/新) - #1911
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
本 PR 将 WeaselSetup/TSF 的安装 profile 从原先仅支持简/繁(hans/hant)扩展为按地区选择的 5 种 profile(简中大陆、繁中台湾、繁中香港、繁中澳门、简中新加坡),并确保安装/卸载流程能按所选 profile 正确注册与移除对应 TSF 语言配置,同时将所选 profile 持久化到注册表用于后续卸载。
Changes:
- GUI 安装选项从简/繁单选改为下拉框,支持 5 个地区 profile,并随系统 UI 语言显示中/英文文案。
- 命令行新增
/hk、/mc、/sg参数,并将安装入口改为传递profile字符串(替代原hantbool)。 - TSF 注册与 Setup 注册/卸载逻辑改为基于
profile计算 LANGID / TIP title,并持久化HKCU\Software\Rime\Weasel\Profile(保留Hant兼容键)。
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| WeaselTSF/Register.cpp | 根据 TEXTSERVICE_PROFILE 启用并注册港/澳/新 profile(以及原 hans/hant)。 |
| WeaselSetup/WeaselSetup.cpp | 安装流程从 hant 切换为 profile;新增 /hk /mc /sg;写入 Profile 注册表键并保留 Hant 兼容写入。 |
| WeaselSetup/resource.h | 新增错误提示字符串 ID 与 ComboBox 控件 ID。 |
| WeaselSetup/InstallOptionsDlg.h | 对话框状态从 hant 切换为 profile,控件从单选按钮切换为 ComboBox。 |
| WeaselSetup/InstallOptionsDlg.cpp | 初始化 ComboBox 5 个 profile 选项,并在确认时将选项映射回 profile 字符串;目录选择交互微调。 |
| WeaselSetup/imesetup.cpp | 新增 profile_to_lang_id()/profile_to_title() 并将安装/卸载、TSF enable/disable 全面改为基于 profile;安装时持久化 Profile 供卸载使用。 |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- pass profile to ime_register_func on the ARM32 uninstall path (was a leftover bool) - write HKCU Profile/Hant during install so /s /t /hk /mc /sg silent installs are uninstalled correctly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
WeaselSetup 安装时仅支持简体(/s)与繁体(/t)两种 profile,注册的 TSF 语言也仅
hans/hant。本次将其扩展为按地区选择的 5 种 profile:
简体中国、繁体台湾、繁体香港、繁体澳门、简体新加坡。
改动
按系统 UI 语言自动显示对应中英文文案,共 5 个地区选项。
/hk(香港)、/mc(澳门)、/sg(新加坡),与原有/s、/t一致。profile_to_lang_id()/profile_to_title(),将原宏定义的InstallLayoutOrTip字符串改为运行时生成,支持任意地区 LANGID(对 hans/hant 生成结果与旧宏完全一致)。
HKCU\Software\Rime\Weasel\Profile(保留 Hant 兼容),保证后续
/u卸载时能按正确的 profile 移除。false导致编译错误,改为传递当前 profile。兼容性
Hant键)自动回退解析为 hans/hant,行为不变。Hant键,卸载新装的港/澳/新 profile 时仍会按简体处理,属固有向后兼容局限。