Skip to content

feat: FixLocaleIssues #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

feat: FixLocaleIssues #43

wants to merge 8 commits into from

Conversation

beer-psi
Copy link

@beer-psi beer-psi commented May 29, 2025

Patches a few locale-dependent system functions to always use the Japanese locale, which is what the game expects. Also forces DateTime.Now to return UTC+9.

好的,这是翻译成中文的 pull request 总结:

Sourcery 总结

修复了依赖于区域设置的解析和格式化方法,以始终使用日语区域设置,并强制 DateTime.Now 使用东京(UTC+9)时间。

Bug 修复:

  • 修复了 int.Parse 和 float.Parse 以使用 ja-JP 区域设置。
  • 重写了 DateTime.Parse 和 ToShortDateString 以使用日语区域设置进行格式化。
  • 强制 DateTime.Now getter 通过东京标准时间返回 UTC+9 时间,如果不可用,则创建自定义时区。
Original summary in English

Summary by Sourcery

Patch locale-dependent parsing and formatting methods to consistently use the Japanese locale and force DateTime.Now to Tokyo (UTC+9) time.

Bug Fixes:

  • Patch int.Parse and float.Parse to use ja-JP locale.
  • Override DateTime.Parse and ToShortDateString to format with Japanese locale.
  • Force DateTime.Now getter to return UTC+9 time via Tokyo Standard Time, creating a custom timezone if unavailable.

Copy link

sourcery-ai bot commented May 29, 2025

审查者指南

添加了一个新的 Harmony 补丁类,该类强制所有数字和日期解析/格式化使用日语区域设置,并覆盖 DateTime.Now 以返回东京标准时间 (UTC+9),并为缺少的时区定义提供回退。

文件级别更改

变更 详情 文件
强制使用日语区域设置进行解析和格式化
  • 覆盖 int.Parse(string) 以使用 ja-JP CultureInfo
  • 覆盖 float.Parse(string) 以使用 ja-JP CultureInfo
  • 覆盖 DateTime.Parse(string) 以使用 ja-JP CultureInfo
  • 覆盖 DateTime.ToShortDateString() 以使用 ja-JP CultureInfo
AquaMai.Mods.Fix/FixLocaleIssues.cs
强制 DateTime.Now 为 UTC+9 东京标准时间
  • 修补 DateTime.get_Now 以返回转换为东京标准时间的 UtcNow
  • 缓存 TimeZoneInfo 并尝试查找系统“东京标准时间”,如果未找到,则回退以创建自定义时区
AquaMai.Mods.Fix/FixLocaleIssues.cs

提示和命令

与 Sourcery 交互

  • 触发新的审查: 在 pull request 上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub issue: 通过回复审查评论,要求 Sourcery 从审查评论创建一个 issue。您也可以回复审查评论并使用 @sourcery-ai issue 从其创建一个 issue。
  • 生成 pull request 标题: 在 pull request 标题中的任何位置写入 @sourcery-ai 以随时生成标题。您也可以在 pull request 上评论 @sourcery-ai title 以随时(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文中的任何位置写入 @sourcery-ai summary 以随时在您想要的位置生成 PR 摘要。您也可以在 pull request 上评论 @sourcery-ai summary 以随时(重新)生成摘要。
  • 生成审查者指南: 在 pull request 上评论 @sourcery-ai guide 以随时(重新)生成审查者指南。
  • 解决所有 Sourcery 评论: 在 pull request 上评论 @sourcery-ai resolve 以解决所有 Sourcery 评论。如果您已经解决了所有评论并且不想再看到它们,这将非常有用。
  • 驳回所有 Sourcery 审查: 在 pull request 上评论 @sourcery-ai dismiss 以驳回所有现有的 Sourcery 审查。如果您想重新开始新的审查,这将特别有用 - 不要忘记评论 @sourcery-ai review 以触发新的审查!

自定义您的体验

访问您的 仪表板 以:

  • 启用或禁用审查功能,例如 Sourcery 生成的 pull request 摘要、审查者指南等。
  • 更改审查语言。
  • 添加、删除或编辑自定义审查说明。
  • 调整其他审查设置。

获取帮助

Original review guide in English

Reviewer's Guide

Adds a new Harmony patch class that forces all numeric and date parsing/formatting to use the Japanese locale and overrides DateTime.Now to return Tokyo Standard Time (UTC+9), with a fallback for missing timezone definitions.

File-Level Changes

Change Details Files
Enforce Japanese locale for parsing and formatting
  • Override int.Parse(string) to use ja-JP CultureInfo
  • Override float.Parse(string) to use ja-JP CultureInfo
  • Override DateTime.Parse(string) to use ja-JP CultureInfo
  • Override DateTime.ToShortDateString() to format with ja-JP CultureInfo
AquaMai.Mods.Fix/FixLocaleIssues.cs
Force DateTime.Now to UTC+9 Tokyo Standard Time
  • Patch DateTime.get_Now to return UtcNow converted to Tokyo Standard Time
  • Cache TimeZoneInfo and attempt to find system 'Tokyo Standard Time', with fallback to create a custom timezone if not found
AquaMai.Mods.Fix/FixLocaleIssues.cs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

@beer-psi - 我已经查看了你的更改,它们看起来很棒!

这是我在审查期间查看的内容
  • 🟡 General issues: 发现了 3 个问题
  • 🟢 Security: 一切看起来都很好
  • 🟢 Testing: 一切看起来都很好
  • 🟡 Complexity: 发现了 1 个问题
  • 🟢 Documentation: 一切看起来都很好

Sourcery 对开源是免费的 - 如果你喜欢我们的评论,请考虑分享它们 ✨
帮助我更有用!请点击每个评论上的 👍 或 👎,我将使用反馈来改进你的评论。
Original comment in English

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

Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

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.

@clansty
Copy link
Contributor

clansty commented May 31, 2025

我想问一下,这个 patch 是修复了什么问题,比如说游戏如果不是以日语区域或者以 +9 时区运行会有什么影响呢

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