Adjust language detection regex
This commit is contained in:
@@ -65,7 +65,7 @@ class GenericmessageCommand extends SystemCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
$text_chara_count = count(preg_split('//u', $text, -1, PREG_SPLIT_NO_EMPTY));
|
$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)) {
|
if ($text_english_count >= ($text_chara_count*2 /3)) {
|
||||||
$sourceLang = 'en';
|
$sourceLang = 'en';
|
||||||
$targetLang = 'zh';
|
$targetLang = 'zh';
|
||||||
|
|||||||
Reference in New Issue
Block a user