-
Notifications
You must be signed in to change notification settings - Fork 465
Refactor: Internationalize comments and test data in write demo package #753
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
Conversation
|
Since the Maven module has been changed, please resolve the conflicts first :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request internationalizes the fesod-sheet-examples module by translating Chinese comments, Javadocs, and string literals to English in the write demo package. This aligns the codebase with Apache Software Foundation's "English First" policy and improves accessibility for the global developer community.
Key Changes
- Translated all Javadocs and inline comments from Chinese to English
- Converted hardcoded Chinese strings to English (sheet names like "模板" → "Template", test data headers, dropdown values)
- Updated
@ExcelPropertyannotations with English headers across all data classes
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| WriteTest.java | Translated comprehensive Javadocs, inline comments explaining writing strategies, and string literals (sheet names, test data) |
| WriteCellDemoData.java | Translated field comments and added @SInCE tags for better documentation |
| WidthAndHeightData.java | Updated @ExcelProperty headers and class-level comments to English |
| LongestMatchColumnWidthData.java | Translated column headers and class documentation |
| IndexData.java | Converted @ExcelProperty headers and field comments to English |
| ImageDemoData.java | Translated class and field comments with version tags |
| DemoStyleData.java | Updated inline and annotation comments describing styling |
| DemoMergeData.java | Translated cell merging comments and headers |
| ConverterData.java | Converted field comments, headers, and date format patterns to English |
| ComplexHeadData.java | Translated complex header structure comments and values |
| ColorDemoData.java | Updated simple field name headers to English |
| CustomSheetWriteHandler.java | Translated handler comments and dropdown test values |
| CustomCellWriteHandler.java | Converted log messages and handler comments to English |
| CommentWriteHandler.java | Translated comment creation explanations and sample text |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // 2. 使用: https://github.com/coobird/thumbnailator 或者其他工具压缩图片 | ||
| // Note: All images will be loaded into memory. There is no good solution for now. For large numbers of images, | ||
| // it is recommended to: | ||
| // 1. Upload images to OSS or other storage sites: https://www.aliyun.com/product/oss, then verify the link |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The word "verify" should be used instead of "verify" in this context. The comment suggests uploading images and then "verify the link directly", but the intended meaning appears to be "use the link directly" or "reference the link directly".
| // 1. Upload images to OSS or other storage sites: https://www.aliyun.com/product/oss, then verify the link | |
| // 1. Upload images to OSS or other storage sites: https://www.aliyun.com/product/oss, then use the link |
| // First 3 characters are red | ||
| WriteFont writeFont = new WriteFont(); | ||
| writeFont.setColor(IndexedColors.RED.getIndex()); | ||
| richTextStringData.applyFont(0, 2, writeFont); | ||
| // 接下来2个字绿色 | ||
| richTextStringData.applyFont(0, 3, writeFont); | ||
| // Next 5 characters are green | ||
| writeFont = new WriteFont(); | ||
| writeFont.setColor(IndexedColors.GREEN.getIndex()); | ||
| richTextStringData.applyFont(2, 4, writeFont); | ||
| richTextStringData.applyFont(4, 9, writeFont); |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The translation describes the character positions incorrectly. The original Chinese text "前2个字红色" means "First 2 characters are red", but the comment was changed to say "First 3 characters are red" while the code still applies the font to positions 0-3 (which is 3 characters). However, the follow-up comment says "Next 5 characters are green" with code applying font to positions 4-9 (which is actually 5 characters). The original text was "接下来2个字绿色" (Next 2 characters green). There's an inconsistency: either the comments should match the original intent (2 red, 2 green) or the code should match the new comments (3 red, 5 green).
| * Dynamic header writing | ||
| * <p> | ||
| * 思路是这样子的,先创建List<String>头格式的sheet仅仅写入头,然后通过table 不写入头的方式 去写入数据 | ||
| * The idea is to first create a sheet with List<String> head format, writing only the head, then write data via table without writing head. |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The translation is grammatically awkward. The phrase "The idea is to first create a sheet with List head format, writing only the head, then write data via table without writing head" should be rephrased for clarity. Consider: "The approach is to first create a sheet with a List<String> header format and write only the header, then write data via table without writing the header again."
| * The idea is to first create a sheet with List<String> head format, writing only the head, then write data via table without writing head. | |
| * The approach is to first create a sheet with a List<String> header format and write only the header, then write data via table without writing the header again. |
| * <p> | ||
| * 这个目前不是很好用,比如有数字就会导致换行。而且长度也不是刚好和实际长度一致。 所以需要精确到刚好列宽的慎用。 当然也可以自己参照 {@link LongestMatchColumnWidthStyleStrategy} | ||
| * 重新实现. | ||
| * This is not very easy to use currently. For example, numbers will cause line breaks. And the length is not exactly consistent with actual length. Use with caution if precise column width is needed. You can also re-implement referencing {@link LongestMatchColumnWidthStyleStrategy}. |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is too long and poorly formatted for a single line. Consider breaking this into multiple lines or simplifying. The comment "This is not very easy to use currently. For example, numbers will cause line breaks. And the length is not exactly consistent with actual length. Use with caution if precise column width is needed. You can also re-implement referencing {@link LongestMatchColumnWidthStyleStrategy}." should be properly formatted with line breaks.
| * This is not very easy to use currently. For example, numbers will cause line breaks. And the length is not exactly consistent with actual length. Use with caution if precise column width is needed. You can also re-implement referencing {@link LongestMatchColumnWidthStyleStrategy}. | ||
| * <p> | ||
| * poi 自带{@link SXSSFSheet#autoSizeColumn(int)} 对中文支持也不太好。目前没找到很好的算法。 有的话可以推荐下。 | ||
| * POI's built-in {@link SXSSFSheet#autoSizeColumn(int)} also doesn't support Chinese very well. No good algorithm found yet. |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sentence structure is awkward. "POI's built-in {@link SXSSFSheet#autoSizeColumn(int)} also doesn't support Chinese very well. No good algorithm found yet." The second sentence is incomplete. Consider: "POI's built-in {@link SXSSFSheet#autoSizeColumn(int)} also doesn't support Chinese very well. No good algorithm has been found yet."
| * POI's built-in {@link SXSSFSheet#autoSizeColumn(int)} also doesn't support Chinese very well. No good algorithm found yet. | |
| * POI's built-in {@link SXSSFSheet#autoSizeColumn(int)} also doesn't support Chinese very well. No good algorithm has been found yet. |
| * Custom handlers for dropdowns, hyperlinks, etc. (Refer to this for operations that don't fit above points but need to manipulate cells) | ||
| * <p> | ||
| * demo这里实现2点。1. 对第一行第一列的头超链接到:https://github.com/fast-excel/fastexcel 2. 对第一列第一行和第二行的数据新增下拉框,显示 测试1 测试2 | ||
| * Demo implements 2 points: 1. Hyperlink the head of the first row and first column to URL. 2. Add dropdown box for data in the first column, first and second rows, displaying "Test1", "Test2". |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The translation is awkwardly phrased and could be clearer. "Demo implements 2 points: 1. Hyperlink the head of the first row and first column to URL. 2. Add dropdown box for data in the first column, first and second rows, displaying "Test1", "Test2"." should be rephrased for clarity. Consider: "This demo implements 2 features: 1. Adds a hyperlink to the header cell in the first row and first column. 2. Adds a dropdown box to the data cells in the first column (rows 1-2) with options "Test1" and "Test2"."
| * Demo implements 2 points: 1. Hyperlink the head of the first row and first column to URL. 2. Add dropdown box for data in the first column, first and second rows, displaying "Test1", "Test2". | |
| * This demo implements 2 features: 1. Adds a hyperlink to the header cell in the first row and first column. 2. Adds a dropdown box to the data cells in the first column (rows 1-2) with options "Test1" and "Test2". |
| private Date date; | ||
| /** | ||
| * 宽度为50 | ||
| * Width is 50 |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent comment style. The field comment says "Width is 50" while other similar comments in the codebase use complete sentences. For consistency with the class-level comment format, consider: "Width is 50."
| * Width is 50 | |
| * Width is 50. |
| private Date date; | ||
| /** | ||
| * 这里设置3 会导致第二列空的 | ||
| * Setting index to 3 will result in the second column being empty. |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states "Setting index to 3 will result in the second column being empty." This should clarify it's the "third" column (index 2) that will be empty, not the second. The index values are 0, 1, and 3, so column at index 2 is skipped.
| * Setting index to 3 will result in the second column being empty. | |
| * Setting index to 3 will result in the third column (index 2) being empty. |
delei
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Purpose of the pull request
This pull request addresses the internationalization (i18n) of the
fesod-sheet-examplesmodule. It translates legacy Chinese comments, Javadocs, and string literals (such as Excel headers and sheet names) into English within thewritedemo package.This ensures the codebase aligns with the Apache Software Foundation's "English First" policy and makes the examples accessible to the global developer community.
What's changed?
I have translated the contents of the
org.apache.fesod.sheet.demo.writepackage from Chinese to English, covering:Test Class (
WriteTest.java):Data Classes (POJOs):
@ExcelPropertyannotations to use English headers (e.g.,ColorDemoData,ComplexHeadData,ConverterData, etc.).Handlers:
CommentWriteHandler,CustomCellWriteHandler, etc.).No logic changes were made; this is purely a documentation and string literal refactoring.
Checklist