-
Notifications
You must be signed in to change notification settings - Fork 445
表头国际化 #653
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
GGBOUNDBOY
wants to merge
22
commits into
apache:main
Choose a base branch
from
GGBOUNDBOY:feature-il8n-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
表头国际化 #653
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
6e57362
feat: head international
GGBOUNDBOY d285839
feat: head international
GGBOUNDBOY 628f70b
Merge branch 'main' into feature-il8n-2
delei ca5e74d
feat: head international
GGBOUNDBOY dee4d59
Merge remote-tracking branch 'origin/feature-il8n-2' into feature-il8n-2
GGBOUNDBOY 87a5779
feat: head international
GGBOUNDBOY cf030d3
feat: head international
GGBOUNDBOY c55b63f
feat: head international 增加license header
GGBOUNDBOY 6684619
Merge branch 'main' into feature-il8n-2
GGBOUNDBOY 2631579
Update fesod/src/main/java/org/apache/fesod/excel/util/ClassUtils.java
GGBOUNDBOY dd04b9b
Update fesod/src/main/java/org/apache/fesod/excel/util/ClassUtils.java
GGBOUNDBOY e28ca45
Update fesod/src/main/java/org/apache/fesod/excel/util/ClassUtils.java
GGBOUNDBOY 7101178
Update fesod/src/main/java/org/apache/fesod/excel/il8n/ExcelMessageSo…
GGBOUNDBOY 25b1ec1
Update fesod-examples/src/test/java/org/apache/fesod/excel/demo/write…
GGBOUNDBOY 17b1519
Update fesod/src/main/java/org/apache/fesod/excel/read/metadata/holde…
GGBOUNDBOY 442a727
Update fesod-examples/src/test/java/org/apache/fesod/excel/demo/write…
GGBOUNDBOY 494dd77
Update fesod-examples/src/test/java/org/apache/fesod/excel/demo/read/…
GGBOUNDBOY 09db594
Update fesod/src/main/java/org/apache/fesod/excel/metadata/GlobalConf…
GGBOUNDBOY fa9b6aa
Update fesod/src/main/java/org/apache/fesod/excel/util/ClassUtils.java
GGBOUNDBOY 2f143c7
feat: ai 修正代码后。再修正
GGBOUNDBOY d862ed0
feat: add file head
GGBOUNDBOY 41fe57a
feat: code style
GGBOUNDBOY File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
fesod-examples/src/test/java/org/apache/fesod/excel/demo/read/AutoMessageSource.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.fesod.excel.demo.read; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.Locale; | ||
| import java.util.Map; | ||
| import org.apache.fesod.excel.i18n.ExcelMessageSource; | ||
|
|
||
| /** | ||
| * AutoMessageSource | ||
| * | ||
| * @author GGBOUD | ||
| * @date 2025/10/20 | ||
| */ | ||
| public class AutoMessageSource implements ExcelMessageSource { | ||
| private static final Map<String, Map<Locale, String>> MESSAGE_MAP = new HashMap<>(); | ||
|
|
||
| @Override | ||
| public String resolveCode(String code, Locale locale) { | ||
| Map<Locale, String> localeMap = MESSAGE_MAP.get(code); | ||
| if (localeMap == null) { | ||
| return code; | ||
| } else { | ||
| String message = localeMap.get(locale); | ||
| return message == null ? code : message; | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void addMessage(String code, Locale locale, String msg) { | ||
| MESSAGE_MAP.computeIfAbsent(code, (key) -> new HashMap<>(4)).put(locale, msg); | ||
| } | ||
|
|
||
| public void addMessages(Map<String, String> messages, Locale locale) { | ||
| messages.forEach((code, msg) -> addMessage(code, locale, msg)); | ||
| } | ||
| } |
52 changes: 52 additions & 0 deletions
52
fesod-examples/src/test/java/org/apache/fesod/excel/demo/read/Il8nHeadDemoDataListener.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.fesod.excel.demo.read; | ||
|
|
||
| import com.alibaba.fastjson2.JSON; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.apache.fesod.excel.context.AnalysisContext; | ||
| import org.apache.fesod.excel.read.listener.ReadListener; | ||
|
|
||
| /** | ||
| * Il8nHeadDemoDataListener | ||
| * | ||
| * @author GGBOUD | ||
| * @date 2025/10/20 | ||
| */ | ||
| @Slf4j | ||
| public class Il8nHeadDemoDataListener implements ReadListener<Il8nZhHeadDemoData> { | ||
|
|
||
| public Il8nHeadDemoDataListener() {} | ||
|
|
||
| @Override | ||
| public void invoke(Il8nZhHeadDemoData data, AnalysisContext context) { | ||
| log.info("Parsed one row of data: {}", JSON.toJSONString(data)); | ||
| } | ||
|
|
||
| /** | ||
| * doAfterAllAnalysed | ||
| * | ||
| * @param context | ||
| */ | ||
| @Override | ||
| public void doAfterAllAnalysed(AnalysisContext context) { | ||
| log.info("All data has been parsed!"); | ||
| } | ||
| } |
48 changes: 48 additions & 0 deletions
48
fesod-examples/src/test/java/org/apache/fesod/excel/demo/read/Il8nZhHeadDemoData.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.fesod.excel.demo.read; | ||
|
|
||
| import java.util.Date; | ||
| import lombok.EqualsAndHashCode; | ||
| import lombok.Getter; | ||
| import lombok.Setter; | ||
| import org.apache.fesod.excel.annotation.ExcelProperty; | ||
|
|
||
| /** | ||
| * 基础数据类.这里的排序和excel里面的排序一致 | ||
| * | ||
| * | ||
| **/ | ||
| @Getter | ||
| @Setter | ||
| @EqualsAndHashCode | ||
| public class Il8nZhHeadDemoData { | ||
| @ExcelProperty(value = {"head.str"}) | ||
| private String string; | ||
|
|
||
| @ExcelProperty(value = {"head.date"}) | ||
| private Date date; | ||
|
|
||
| @ExcelProperty(value = {"head.doubleData"}) | ||
| private Double doubleData; | ||
|
|
||
| @ExcelProperty(value = {"head.str1"}) | ||
| private String string1; | ||
| } |
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
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
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,9 +24,7 @@ | |||||||||||||||||||||||||
| import java.net.URL; | ||||||||||||||||||||||||||
| import java.util.ArrayList; | ||||||||||||||||||||||||||
| import java.util.Date; | ||||||||||||||||||||||||||
| import java.util.HashSet; | ||||||||||||||||||||||||||
| import java.util.List; | ||||||||||||||||||||||||||
| import java.util.Set; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.ExcelWriter; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.FastExcel; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.annotation.ExcelProperty; | ||||||||||||||||||||||||||
|
|
@@ -35,13 +33,10 @@ | |||||||||||||||||||||||||
| import org.apache.fesod.excel.annotation.write.style.ColumnWidth; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.annotation.write.style.ContentRowHeight; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.annotation.write.style.HeadRowHeight; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.demo.read.AutoMessageSource; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.demo.read.Il8nZhHeadDemoData; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.enums.CellDataTypeEnum; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.metadata.data.CommentData; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.metadata.data.FormulaData; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.metadata.data.HyperlinkData; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.metadata.data.ImageData; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.metadata.data.RichTextStringData; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.metadata.data.WriteCellData; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.metadata.data.*; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.util.BooleanUtils; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.util.FileUtils; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.util.ListUtils; | ||||||||||||||||||||||||||
|
|
@@ -58,12 +53,7 @@ | |||||||||||||||||||||||||
| import org.apache.fesod.excel.write.metadata.style.WriteFont; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.write.style.HorizontalCellStyleStrategy; | ||||||||||||||||||||||||||
| import org.apache.fesod.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; | ||||||||||||||||||||||||||
| import org.apache.poi.ss.usermodel.Cell; | ||||||||||||||||||||||||||
| import org.apache.poi.ss.usermodel.CellStyle; | ||||||||||||||||||||||||||
| import org.apache.poi.ss.usermodel.FillPatternType; | ||||||||||||||||||||||||||
| import org.apache.poi.ss.usermodel.IndexedColors; | ||||||||||||||||||||||||||
| import org.apache.poi.ss.usermodel.Sheet; | ||||||||||||||||||||||||||
| import org.apache.poi.ss.usermodel.Workbook; | ||||||||||||||||||||||||||
| import org.apache.poi.ss.usermodel.*; | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| import org.apache.poi.ss.usermodel.*; | |
| import org.apache.poi.ss.usermodel.Cell; | |
| import org.apache.poi.ss.usermodel.CellStyle; | |
| import org.apache.poi.ss.usermodel.CreationHelper; | |
| import org.apache.poi.ss.usermodel.DataFormat; | |
| import org.apache.poi.ss.usermodel.FillPatternType; | |
| import org.apache.poi.ss.usermodel.Font; | |
| import org.apache.poi.ss.usermodel.HorizontalAlignment; | |
| import org.apache.poi.ss.usermodel.IndexedColors; | |
| import org.apache.poi.ss.usermodel.Row; | |
| import org.apache.poi.ss.usermodel.Sheet; | |
| import org.apache.poi.ss.usermodel.Workbook; |
Binary file not shown.
Binary file not shown.
49 changes: 49 additions & 0 deletions
49
fesod/src/main/java/org/apache/fesod/excel/i18n/ExcelMessageSource.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.fesod.excel.i18n; | ||
|
|
||
| import java.util.Locale; | ||
|
|
||
| /** | ||
| * ExcelMessageSource | ||
| * | ||
| * @author GGBOUD | ||
| * @date 2025/10/20 | ||
| */ | ||
| public interface ExcelMessageSource { | ||
|
|
||
| /** | ||
| * resolveCode 转换code | ||
| * | ||
| * @param code | ||
| * @param locale | ||
| * @return | ||
| */ | ||
| String resolveCode(String code, Locale locale); | ||
|
|
||
| /** | ||
| * addMessage 增加词条 | ||
| * | ||
| * @param code | ||
| * @param locale | ||
| * @param | ||
| */ | ||
| void addMessage(String code, Locale locale, String msg); | ||
| } |
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
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
Oops, something went wrong.
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.
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.
Replace wildcard import with explicit imports to improve code clarity and prevent potential naming conflicts.