Adjust language detection regex

This commit is contained in:
2022-12-29 23:05:02 +00:00
parent 1eb0bc4c2b
commit f7bdbc138e

View File

@@ -65,7 +65,7 @@ class GenericmessageCommand extends SystemCommand
}
$text_chara_count = count(preg_split('//u', $text, -1, PREG_SPLIT_NO_EMPTY));
$text_english_count = count(preg_split('~[^a-z]*~i', $text, 0, PREG_SPLIT_NO_EMPTY));
$text_english_count = count(preg_split('~[^a-z 0-9\'\",.]*~i', $text, 0, PREG_SPLIT_NO_EMPTY));
if ($text_english_count >= ($text_chara_count*2 /3)) {
$sourceLang = 'en';
$targetLang = 'zh';