mirror of
https://github.com/octopusYan/dayz-mod-translator.git
synced 2025-01-31 11:16:43 +08:00
fix: 修复当前文本翻译完成后,再次加载pbo后,无法开始翻译任务的问题
This commit is contained in:
parent
0c9052216b
commit
c6f0268ff5
@ -518,7 +518,7 @@ public class PBOUtil {
|
|||||||
* @param str 需要判断的字符串
|
* @param str 需要判断的字符串
|
||||||
* @return 是否含有中文
|
* @return 是否含有中文
|
||||||
*/
|
*/
|
||||||
private static boolean containsChinese(String str) {
|
public static boolean containsChinese(String str) {
|
||||||
return Pattern.compile("[\u4e00-\u9fa5]").matcher(str).find();
|
return Pattern.compile("[\u4e00-\u9fa5]").matcher(str).find();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import cn.octopusyan.dmt.task.UnpackTask;
|
|||||||
import cn.octopusyan.dmt.task.listener.DefaultTaskListener;
|
import cn.octopusyan.dmt.task.listener.DefaultTaskListener;
|
||||||
import cn.octopusyan.dmt.translate.DelayWord;
|
import cn.octopusyan.dmt.translate.DelayWord;
|
||||||
import cn.octopusyan.dmt.translate.TranslateUtil;
|
import cn.octopusyan.dmt.translate.TranslateUtil;
|
||||||
|
import cn.octopusyan.dmt.utils.PBOUtil;
|
||||||
import cn.octopusyan.dmt.view.ConsoleLog;
|
import cn.octopusyan.dmt.view.ConsoleLog;
|
||||||
import cn.octopusyan.dmt.view.alert.AlertUtil;
|
import cn.octopusyan.dmt.view.alert.AlertUtil;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
@ -18,7 +19,6 @@ import javafx.beans.property.StringProperty;
|
|||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.concurrent.Worker;
|
import javafx.concurrent.Worker;
|
||||||
import javafx.scene.control.ProgressIndicator;
|
import javafx.scene.control.ProgressIndicator;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.kordamp.ikonli.feather.Feather;
|
import org.kordamp.ikonli.feather.Feather;
|
||||||
import org.kordamp.ikonli.javafx.FontIcon;
|
import org.kordamp.ikonli.javafx.FontIcon;
|
||||||
|
|
||||||
@ -107,9 +107,11 @@ public class MainViewModel extends BaseViewModel<MainController> {
|
|||||||
if (wordItems.isEmpty()) return;
|
if (wordItems.isEmpty()) return;
|
||||||
|
|
||||||
if (translateTask == null) {
|
if (translateTask == null) {
|
||||||
List<WordItem> words = wordItems.stream().filter(item -> StringUtils.isEmpty(item.getChinese())).toList();
|
List<WordItem> words = wordItems.stream().filter(item -> !PBOUtil.containsChinese(item.getChinese())).toList();
|
||||||
delayQueue = TranslateUtil.getDelayQueue(words);
|
delayQueue = TranslateUtil.getDelayQueue(words);
|
||||||
translateTask = createTask();
|
translateTask = createTask();
|
||||||
|
translateTask.execute();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!translateTask.isRunning()) {
|
if (!translateTask.isRunning()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user