Skip to content

feat: 中英双语化 ModifyPCRegistry.ps1 - #866

Merged
Windsland52 merged 2 commits into
MAA1999:mainfrom
APPLe-DF:feat/bilingual-registry-ps1
Aug 4, 2026
Merged

feat: 中英双语化 ModifyPCRegistry.ps1#866
Windsland52 merged 2 commits into
MAA1999:mainfrom
APPLe-DF:feat/bilingual-registry-ps1

Conversation

@APPLe-DF

@APPLe-DF APPLe-DF commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

改动说明

tools/registry/ModifyPCRegistry.ps1 的所有 UI 提示改为中英双语格式,方便国际服 PC 端的中文/英文用户使用。

主要变更

  • 所有 Write-Host / Write-Warning / Read-Host / Write-Error 提示改为中英双语格式(用 / 分隔)
  • 主菜单、预设选择、备份恢复、确认区、错误提示、Set-GameDefaults 函数全部覆盖
  • 新增 :presetLoop 标签,让交互模式下输入 N 取消时返回分辨率选择(而非退出整个脚本)
  • Confirm 区行为按调用入口分离:
    • 参数模式 (-Width 等):N 仍退出脚本
    • 交互模式N 退回预设子菜单,Y 进入主流程
  • 保留注册表值名(如 Screenmanager Fullscreen mode_h3630240806)、类型后缀((DWord)/(Binary, ASCII))、技术值为英文
  • 保留脚本作者注释、param 块为英文(保证命令行互操作)
  • 保留 -Force / -Restore / -NoGameDefaults / -Width / -Height / -Preset / -NewValue 等所有参数行为

测试场景

  • 无参数启动 → 中文菜单 (Windows zh-CN) / English menu
  • 主菜单 1) 选预设 → N 取消 → 退回预设子菜单
  • 主菜单 3) 切换游戏服务器 (EN ↔ JP)
  • 主菜单 4) 退出
  • -Width 1920 -Height 1080 参数模式 → 双语确认
  • -Restore -BackupFile xxx.reg 恢复模式
  • -Force 跳过所有确认

影响范围

tools/registry/ModifyPCRegistry.ps1 一个文件,91 insertions / 75 deletions。

不修改 tools/registry/游戏PC端注册表修改_ModifyPCRegistry.bat(包装脚本仍为英文)。

Summary by Sourcery

为 PC 注册表修改脚本添加中英文双语 UI 消息,并优化交互流程。

New Features:

  • ModifyPCRegistry.ps1 中,以中英双语显示所有交互式提示、菜单和状态消息。

Enhancements:

  • 调整交互式预设选择逻辑,使取消操作返回预设菜单,而不是直接退出脚本。
  • 区分参数模式和交互模式下的确认行为,同时保持现有参数模式的语义不变。
  • 改进备份、还原和错误消息,使用更加清晰、描述性更强的双语输出。
Original summary in English

Summary by Sourcery

Add bilingual Chinese/English UI messaging to the PC registry modification script and refine interactive flows.

New Features:

  • Display all interactive prompts, menus, and status messages in both Chinese and English in ModifyPCRegistry.ps1.

Enhancements:

  • Adjust interactive preset selection so cancelling returns to the preset menu instead of exiting the script.
  • Differentiate confirmation behavior between parameter mode and interactive mode while preserving existing parameter-mode semantics.
  • Improve backup, restore, and error messages with clearer, more descriptive bilingual output.

新功能:

  • 在交互模式和参数模式下,以中英双语显示所有脚本提示、菜单和状态消息。

增强优化:

  • 调整交互式预设选择逻辑,使取消操作返回预设菜单,而不是直接退出脚本。
  • 区分参数模式与交互模式下的确认行为:在交互模式中在预设流程内部进行确认,同时保持参数模式原有的语义和行为不变。
  • 明确并丰富备份/导出、恢复以及错误消息的内容,以更符合用户习惯的双语方式更好地描述操作过程和失败原因。
Original summary in English

Summary by Sourcery

为 PC 注册表修改脚本添加中英文双语 UI 消息,并优化交互流程。

New Features:

  • ModifyPCRegistry.ps1 中,以中英双语显示所有交互式提示、菜单和状态消息。

Enhancements:

  • 调整交互式预设选择逻辑,使取消操作返回预设菜单,而不是直接退出脚本。
  • 区分参数模式和交互模式下的确认行为,同时保持现有参数模式的语义不变。
  • 改进备份、还原和错误消息,使用更加清晰、描述性更强的双语输出。
Original summary in English

Summary by Sourcery

Add bilingual Chinese/English UI messaging to the PC registry modification script and refine interactive flows.

New Features:

  • Display all interactive prompts, menus, and status messages in both Chinese and English in ModifyPCRegistry.ps1.

Enhancements:

  • Adjust interactive preset selection so cancelling returns to the preset menu instead of exiting the script.
  • Differentiate confirmation behavior between parameter mode and interactive mode while preserving existing parameter-mode semantics.
  • Improve backup, restore, and error messages with clearer, more descriptive bilingual output.

- 所有 UI 提示 (Write-Host/Write-Warning/Read-Host/Write-Error) 改为中英双语格式
- 新增':presetLoop'标签让交互模式下输入 N 取消时返回分辨率选择
- Confirm 区在参数模式 (N 退出) 与交互模式 (N 重选) 行为分离
- 保留注册表值名/类型/技术值为英文,保留脚本作者注释为英文
- 保留 -Force / -Restore / -NoGameDefaults 等所有参数行为

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - 我发现了 1 个问题,并留下了一些整体性的反馈:

  • 建议将双语提示字符串提取成可复用的常量或辅助函数,以避免重复,并在脚本中需要修改文案时更容易统一维护。
  • 在 PowerShell 中使用 :presetLoop 标签和 continue presetLoop 有点非常规;你可以考虑用嵌套循环或函数来简化这段流程,从而提升可读性和可维护性。
  • 现在游戏默认使用 en/ja,建议再次检查所有面向用户的说明和消息,对语言行为的描述是否完全一致(例如:JP → ja,其他 → en),以免让中文用户感到困惑。
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider extracting the bilingual prompt strings into reusable constants or helper functions to avoid repetition and make future wording changes easier to manage across the script.
- The use of the `:presetLoop` label and `continue presetLoop` is somewhat unconventional in PowerShell; you might simplify this flow using nested loops or functions to improve readability and maintainability.
- Now that game defaults use `en/ja`, double-check that all user-facing notes and messages consistently describe the language behavior (e.g., JP → ja, others → en) to avoid confusion for CN users.

## Individual Comments

### Comment 1
<location path="tools/registry/ModifyPCRegistry.ps1" line_range="151" />
<code_context>
     $imp = Start-Process -FilePath reg -ArgumentList "import `"$BackupFile`"" -NoNewWindow -Wait -PassThru
     if ($imp.ExitCode -ne 0) {
-        Write-ErrAndExit "reg import failed (exit code $($imp.ExitCode))."
+        Write-ErrAndExit "reg import 失败 (退出码 $imp.ExitCode) / reg import failed (exit code $imp.ExitCode)"
     }
-    Write-Host "Restore completed."
</code_context>
<issue_to_address>
**issue (bug_risk):** Property access in interpolated string will not work as intended; `$imp.ExitCode` will not be expanded correctly.

In PowerShell, property access inside double-quoted strings requires subexpression syntax; otherwise `$imp.ExitCode` is parsed as a single variable name. Please change both occurrences to `$($imp.ExitCode)` to ensure the exit code is rendered correctly in the message.
</issue_to_address>

Sourcery 对开源项目免费使用——如果你觉得我们的代码审查有帮助,欢迎分享给更多人 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈来改进后续的代码审查。
Original comment in English

Hey - I've found 1 issue, and left some high level feedback:

  • Consider extracting the bilingual prompt strings into reusable constants or helper functions to avoid repetition and make future wording changes easier to manage across the script.
  • The use of the :presetLoop label and continue presetLoop is somewhat unconventional in PowerShell; you might simplify this flow using nested loops or functions to improve readability and maintainability.
  • Now that game defaults use en/ja, double-check that all user-facing notes and messages consistently describe the language behavior (e.g., JP → ja, others → en) to avoid confusion for CN users.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider extracting the bilingual prompt strings into reusable constants or helper functions to avoid repetition and make future wording changes easier to manage across the script.
- The use of the `:presetLoop` label and `continue presetLoop` is somewhat unconventional in PowerShell; you might simplify this flow using nested loops or functions to improve readability and maintainability.
- Now that game defaults use `en/ja`, double-check that all user-facing notes and messages consistently describe the language behavior (e.g., JP → ja, others → en) to avoid confusion for CN users.

## Individual Comments

### Comment 1
<location path="tools/registry/ModifyPCRegistry.ps1" line_range="151" />
<code_context>
     $imp = Start-Process -FilePath reg -ArgumentList "import `"$BackupFile`"" -NoNewWindow -Wait -PassThru
     if ($imp.ExitCode -ne 0) {
-        Write-ErrAndExit "reg import failed (exit code $($imp.ExitCode))."
+        Write-ErrAndExit "reg import 失败 (退出码 $imp.ExitCode) / reg import failed (exit code $imp.ExitCode)"
     }
-    Write-Host "Restore completed."
</code_context>
<issue_to_address>
**issue (bug_risk):** Property access in interpolated string will not work as intended; `$imp.ExitCode` will not be expanded correctly.

In PowerShell, property access inside double-quoted strings requires subexpression syntax; otherwise `$imp.ExitCode` is parsed as a single variable name. Please change both occurrences to `$($imp.ExitCode)` to ensure the exit code is rendered correctly in the message.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread tools/registry/ModifyPCRegistry.ps1 Outdated
评审指出的 bug 风险:双引号里的 $imp.ExitCode 不会被 PowerShell 解析
为属性访问,需要用子表达式语法 $($imp.ExitCode)。
@APPLe-DF APPLe-DF changed the title feat(registry): 中英双语化 ModifyPCRegistry.ps1 feat: 中英双语化 ModifyPCRegistry.ps1 Aug 3, 2026
@APPLe-DF

APPLe-DF commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

@sourcery-ai review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

嗨,我已经审查了你的更改,看起来非常棒!


Sourcery 对开源项目是免费的——如果你觉得我们的审查有帮助,欢迎分享给更多人 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈来改进后续的代码审查。
Original comment in English

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Windsland52
Windsland52 merged commit 363651b into MAA1999:main Aug 4, 2026
2 checks passed
@APPLe-DF
APPLe-DF deleted the feat/bilingual-registry-ps1 branch August 28, 2026 15:09
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