Skip to content

refactor(WeaselSetup): 支持按地区选择安装 profile(简/繁/港/澳/新) - #1911

Merged
fxliang merged 4 commits into
rime:masterfrom
fxliang:setup
Aug 15, 2026
Merged

refactor(WeaselSetup): 支持按地区选择安装 profile(简/繁/港/澳/新)#1911
fxliang merged 4 commits into
rime:masterfrom
fxliang:setup

Conversation

@fxliang

@fxliang fxliang commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

背景

WeaselSetup 安装时仅支持简体(/s)与繁体(/t)两种 profile,注册的 TSF 语言也仅
hans/hant。本次将其扩展为按地区选择的 5 种 profile:
简体中国、繁体台湾、繁体香港、繁体澳门、简体新加坡。

改动

  • GUI 安装对话框(InstallOptionsDlg):用下拉框(ComboBox)替换原有简/繁单选按钮,
    按系统 UI 语言自动显示对应中英文文案,共 5 个地区选项。
  • 命令行参数:新增 /hk(香港)、/mc(澳门)、/sg(新加坡),与原有 /s/t 一致。
  • 注册逻辑(WeaselSetup/imesetup.cpp):新增 profile_to_lang_id() /
    profile_to_title(),将原宏定义的 InstallLayoutOrTip 字符串改为运行时生成,
    支持任意地区 LANGID(对 hans/hant 生成结果与旧宏完全一致)。
  • TSF 注册(WeaselTSF/Register.cpp):为港/澳/新注册对应语言 profile,并在安装时启用。
  • 安装状态持久化:安装时写入 HKCU\Software\Rime\Weasel\Profile(保留 Hant 兼容),
    保证后续 /u 卸载时能按正确的 profile 移除。
  • 修复:ARM32 卸载路径误传 false 导致编译错误,改为传递当前 profile。

兼容性

  • 旧版配置(仅存在 Hant 键)自动回退解析为 hans/hant,行为不变。
  • 旧版 WeaselSetup 只认 Hant 键,卸载新装的港/澳/新 profile 时仍会按简体处理,
    属固有向后兼容局限。

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

本 PR 将 WeaselSetup/TSF 的安装 profile 从原先仅支持简/繁(hans/hant)扩展为按地区选择的 5 种 profile(简中大陆、繁中台湾、繁中香港、繁中澳门、简中新加坡),并确保安装/卸载流程能按所选 profile 正确注册与移除对应 TSF 语言配置,同时将所选 profile 持久化到注册表用于后续卸载。

Changes:

  • GUI 安装选项从简/繁单选改为下拉框,支持 5 个地区 profile,并随系统 UI 语言显示中/英文文案。
  • 命令行新增 /hk/mc/sg 参数,并将安装入口改为传递 profile 字符串(替代原 hant bool)。
  • 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.

Comment thread WeaselSetup/InstallOptionsDlg.cpp
- 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
@fxliang
fxliang merged commit 287ce64 into rime:master Aug 15, 2026
3 checks passed
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.

2 participants