批量将代码注释和文档注释翻译为中文 - #126
Merged
Merged
Conversation
本次提交将项目中 Check、Guard、Helpers、DataConvert、RecordColumn、RecordTable、Ascii85、LzString、DimensionKind、UnitConverter、IPAddressExtensions、SingleInstanceManager 等多个类和文件的英文注释和 XML 文档注释翻译为中文,保留类型和参数名等英文关键字。仅修改注释文本,未更改任何代码逻辑。部分注释内容根据中文开发者习惯进行了优化和补充,所有文件均保持 UTF-8 编码,符合项目规范。
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates multiple files by translating existing inline comments and XML documentation comments from English to Chinese, without changing runtime logic.
Changes:
- Translated XML doc comments (e.g.,
<summary>,<remarks>,<param>,<returns>) to Chinese across several public/internal APIs. - Translated various inline implementation comments to Chinese in helpers/encoders/hashing and build scripts.
- Removed one commented-out line in
Crc32.cs(still a comment-only change).
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| src/LuYao.Common/Threading/SingleInstanceManager.cs | Translates class/member XML docs and a couple of inline comments to Chinese. |
| src/LuYao.Common/Net/IPAddressExtensions.cs | Translates the class summary XML doc to Chinese. |
| src/LuYao.Common/IO/Hashing/Murmur128.cs | Translates inline hashing comments to Chinese. |
| src/LuYao.Common/IO/Hashing/Crc32.cs | Removes a commented-out line and translates an inline comment to Chinese. |
| src/LuYao.Common/Guard.cs | Translates XML documentation across multiple Guard helper methods to Chinese. |
| src/LuYao.Common/Globalization/UnitConverter.cs | Translates a few inline “additional units” comments to Chinese. |
| src/LuYao.Common/Globalization/DimensionKind.cs | Translates the enum summary XML doc to Chinese. |
| src/LuYao.Common/Encoders/LzString.cs | Translates several inline compression/decompression comments to Chinese. |
| src/LuYao.Common/Encoders/Ascii85.cs | Translates remarks/author line and multiple inline comments to Chinese. |
| src/LuYao.Common/Data/RecordTable.cs | Translates multiple inline Unicode-range comments to Chinese. |
| src/LuYao.Common/Data/RecordColumn.T.cs | Translates one inline comment to Chinese. |
| src/LuYao.Common/Data/Internal/DataConvert.cs | Translates the class summary XML doc to Chinese. |
| src/LuYao.Common/Data/Helpers.cs | Translates XML summary and some inline mapping comments to Chinese. |
| src/LuYao.Common/Check.cs | Translates many XML doc blocks for argument-validation helpers to Chinese. |
| build/Build.cs | Translates header comments to Chinese and replaces a previously-garbled inline comment (but with Chinese text). |
Suppressed comments (1)
build/Build.cs:73
- Project guidance requires code comments to be written in English (see .github/copilot-instructions.md:4). This inline comment was changed to Chinese; please keep it in English. (Also, replacing the previously-garbled text is good, but the replacement should still be English.)
.SetVersion(PackageVersion) // 这里设置版本
.EnableNoBuild());
Comment on lines
11
to
14
| /// <summary> | ||
| /// Provides single-instance process management. Ensures only one instance of the | ||
| /// application runs at a time, and allows the new instance to signal the existing | ||
| /// one to activate its window via a named pipe. | ||
| /// 提供单实例进程管理,确保应用程序每次只有一个实例运行, | ||
| /// 并允许新实例通过命名管道通知现有实例激活窗口。 | ||
| /// </summary> |
Comment on lines
6
to
8
| /// <summary> | ||
| /// Provides extension methods for the <see cref="IPAddress"/> class. | ||
| /// 为 <see cref="IPAddress"/> 类提供扩展方法。 | ||
| /// </summary> |
Comment on lines
+99
to
+103
| // 创建我们的密钥并初始化为 0 | ||
| ulong k1 = 0, | ||
| k2 = 0; | ||
|
|
||
| // determine how many bytes we have left to work with based on length | ||
| // 根据长度确定我们还剩下多少字节可以使用 |
| public static uint reflect(uint crc, int bitnum) | ||
| { | ||
| // reflects the lower 'bitnum' bits of 'crc' | ||
| // 反映“crc”的较低“bitnum”位 |
Comment on lines
6
to
9
| /// <summary> | ||
| /// Provides guarded execution helpers to reduce try/catch boilerplate | ||
| /// while keeping behavior observable and configurable. | ||
| /// 提供受保护的执行帮助程序以减少 try/catch 样板文件 | ||
| /// 同时保持行为可观察和可配置。 | ||
| /// </summary> |
Comment on lines
+17
to
+21
| /// 可使用以下支持插件: | ||
| /// - JetBrains ReSharper https://nuke.build/resharper | ||
| /// - JetBrains Rider https://nuke.build/rider | ||
| /// - Microsoft Visual Studio https://nuke.build/visualstudio | ||
| /// - Microsoft VS Code https://nuke.build/vscode |
| static bool IsWide(char c) | ||
| { | ||
| // CJK Unified Ideographs, CJK Extension A, Compatibility Ideographs | ||
| // CJK 统一表意文字、CJK 扩展 A、兼容性表意文字 |
Comment on lines
11
to
13
| /// <remarks> | ||
| /// Jeff Atwood | ||
| /// 杰夫·阿特伍德 | ||
| /// http://www.codinghorror.com/blog/archives/000410.html |
Comment on lines
44
to
46
| /// <summary> | ||
| /// From CLR <see cref="Type"/> get its <see cref="RecordColumnType"/>. | ||
| /// 从 CLR <see cref="Type"/> 获取其 <see cref="RecordColumnType"/>。 | ||
| /// </summary> |
Comment on lines
7
to
10
| /// <summary> | ||
| /// Provides a collection of static methods for argument validation. | ||
| /// Validates arguments to reduce boilerplate parameter checking code. | ||
| /// 提供一组用于参数验证的静态方法。 | ||
| /// 验证参数以减少样板参数检查代码。 | ||
| /// </summary> |
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.
本次提交将项目中 Check、Guard、Helpers、DataConvert、RecordColumn、RecordTable、Ascii85、LzString、DimensionKind、UnitConverter、IPAddressExtensions、SingleInstanceManager 等多个类和文件的英文注释和 XML 文档注释翻译为中文,保留类型和参数名等英文关键字。仅修改注释文本,未更改任何代码逻辑。部分注释内容根据中文开发者习惯进行了优化和补充,所有文件均保持 UTF-8 编码,符合项目规范。