fix: use underscore suffix in short name mapping

Replace the "~<n>" suffix with "_<n>" when generating unique short names in codex translators (Claude, Gemini, OpenAI chat).
This avoids using a special character in identifiers, improving compatibility with downstream APIs while preserving length constraints.
This commit is contained in:
hkfires
2025-11-18 16:57:28 +08:00
parent 23a7633e6d
commit 1ba057112a
3 changed files with 3 additions and 3 deletions

View File

@@ -289,7 +289,7 @@ func buildShortNameMap(names []string) map[string]string {
}
base := cand
for i := 1; ; i++ {
suffix := "~" + strconv.Itoa(i)
suffix := "_" + strconv.Itoa(i)
allowed := limit - len(suffix)
if allowed < 0 {
allowed = 0

View File

@@ -310,7 +310,7 @@ func buildShortNameMap(names []string) map[string]string {
}
base := cand
for i := 1; ; i++ {
suffix := "~" + strconv.Itoa(i)
suffix := "_" + strconv.Itoa(i)
allowed := limit - len(suffix)
if allowed < 0 {
allowed = 0

View File

@@ -361,7 +361,7 @@ func buildShortNameMap(names []string) map[string]string {
}
base := cand
for i := 1; ; i++ {
suffix := "~" + strconv.Itoa(i)
suffix := "_" + strconv.Itoa(i)
allowed := limit - len(suffix)
if allowed < 0 {
allowed = 0