Skip to content

Commit 9f21e76

Browse files
author
yihao03
committed
updated splitting logic to concat orphaned texts
1 parent 4922e98 commit 9f21e76

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

i18n/controllers/recurTranslate.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ async function recursivelyTranslate(
9090
if (subIsRecording) {
9191
subCurrentSegment += `${text}`;
9292
} else {
93-
if (text == "\n " || text == "\r\n " || text == ", \n" || text == ", \r\n") {
94-
subSegments.push([false, text]);
93+
if (subSegments.length > 0 && subSegments[subSegments.length - 1][1] != undefined) {
94+
subSegments[subSegments.length - 1][1] += text;
95+
subSegments[subSegments.length - 1][0] = true;
9596
} else {
9697
subSegments.push([true, text]);
9798
}

0 commit comments

Comments
 (0)