1.excel下面的sheet名称未被翻译
deploy-hxtesting / build-and-deploy (push) Successful in 1m15s

2.预览翻译文件时无法预览图片!
3.上传文件都要存到知识库中!可被问答
4.在SIP翻译专家agent下上传文件后默认给提示文案可直接发送
This commit is contained in:
runny committed 2026-12-01 06:26:12 +08:00
1 parent 8c3d0ee31c
commit 90b843b4e8
9 files changed
+308 -75

No files matched your search

+35
View File
@@ -148,6 +148,41 @@ func collapseWhitespace(s string) string {
return strings.Join(strings.Fields(s), " ")
}
// sanitizeSheetName enforces Excel worksheet name rules on a translated
// sheet name: no : \ / ? * [ ] (or apostrophes, which would break quoted
// formula references), at most 31 runes, unique within the workbook. An
// empty translation falls back to "Sheet".
func sanitizeSheetName(name string, used map[string]struct{}) string {
var b strings.Builder
for _, r := range name {
switch r {
case ':', '\\', '/', '?', '*', '[', ']', '\'', '\u0000':
continue
}
b.WriteRune(r)
}
out := collapseWhitespace(b.String())
if len(out) > 31 {
out = out[:31]
}
if strings.TrimSpace(out) == "" {
out = "Sheet"
}
base := out
for i := 2; ; i++ {
if _, exists := used[out]; !exists {
break
}
suffix := " " + itoa(i)
if len(base)+len(suffix) > 31 {
base = base[:31-len(suffix)]
}
out = base + suffix
}
used[out] = struct{}{}
return out
}
// itoa is a tiny helper so this file needs no strconv import noise.
func itoa(i int) string {
if i == 0 {