Support forwarded sender name, Change EN/ZH chara count

This commit is contained in:
2022-12-29 22:47:22 +00:00
parent 21e7343a2f
commit a992fc6165

View File

@@ -67,7 +67,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));
if ($text_english_count >= ($text_chara_count / 2)) {
if ($text_english_count >= ($text_chara_count*2 /3)) {
$sourceLang = 'en';
$targetLang = 'zh';
$glossary = self::EN_TO_ZH;
@@ -92,7 +92,7 @@ class GenericmessageCommand extends SystemCommand
]);
}
$message_forwarded_from = $message->getForwardFrom()?->getFirstName();
$message_forwarded_from = $message->getForwardFrom()?->getFirstName() ?? $message->getForwardSenderName();
if ($message_forwarded_from !== null) {
$translated = $message_forwarded_from . ': ' . $translated;
}