59439 修改 文档翻译,计算翻译文本方法。

This commit is contained in:
wangzhijiang
2022-09-09 17:54:41 +08:00
parent bd152116cd
commit 38aba3cf8a
@@ -88,11 +88,15 @@ public class TranslationDocumentUtils {
if(i == 0){ if(i == 0){
translateFrontTextSplit = translateFrontText.substring(0,splitLength); translateFrontTextSplit = translateFrontText.substring(0,splitLength);
}else { }else {
//每一次截取开始的下标
int startSplitLength = i*(splitLength) + 1;
//如果长度不够根据splitLength再截取一次。 //如果长度不够根据splitLength再截取一次。
if(translateFrontText.length() < i*splitLength+(splitLength+1)){ if(translateFrontText.length() < i*splitLength+(splitLength)){
translateFrontTextSplit = translateFrontText.substring(i*(splitLength + 1),translateFrontText.length()); if(startSplitLength < translateFrontText.length()){
translateFrontTextSplit = translateFrontText.substring(startSplitLength,translateFrontText.length());
}
}else { }else {
translateFrontTextSplit = translateFrontText.substring(i*(splitLength + 1),i*splitLength+(splitLength+1)); translateFrontTextSplit = translateFrontText.substring(startSplitLength,i*splitLength+(splitLength));
} }
} }