feat: 中英双语化 ModifyPCRegistry.ps1 - #866
Merged
Merged
Conversation
- 所有 UI 提示 (Write-Host/Write-Warning/Read-Host/Write-Error) 改为中英双语格式 - 新增':presetLoop'标签让交互模式下输入 N 取消时返回分辨率选择 - Confirm 区在参数模式 (N 退出) 与交互模式 (N 重选) 行为分离 - 保留注册表值名/类型/技术值为英文,保留脚本作者注释为英文 - 保留 -Force / -Restore / -NoGameDefaults 等所有参数行为
Contributor
There was a problem hiding this comment.
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>帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈来改进后续的代码审查。
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
:presetLooplabel andcontinue presetLoopis 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>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
评审指出的 bug 风险:双引号里的 $imp.ExitCode 不会被 PowerShell 解析 为属性访问,需要用子表达式语法 $($imp.ExitCode)。
Collaborator
Author
|
@sourcery-ai review |
Contributor
There was a problem hiding this comment.
嗨,我已经审查了你的更改,看起来非常棒!
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈来改进后续的代码审查。
Original comment in English
Hey - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
改动说明
将
tools/registry/ModifyPCRegistry.ps1的所有 UI 提示改为中英双语格式,方便国际服 PC 端的中文/英文用户使用。主要变更
Write-Host/Write-Warning/Read-Host/Write-Error提示改为中英双语格式(用/分隔):presetLoop标签,让交互模式下输入N取消时返回分辨率选择(而非退出整个脚本)-Width等):N仍退出脚本N退回预设子菜单,Y进入主流程Screenmanager Fullscreen mode_h3630240806)、类型后缀((DWord)/(Binary, ASCII))、技术值为英文param块为英文(保证命令行互操作)-Force/-Restore/-NoGameDefaults/-Width/-Height/-Preset/-NewValue等所有参数行为测试场景
-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:
Enhancements:
新功能:
增强优化:
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:
Enhancements: