*/
public static function isWantedLanguage(string $body, int $uri_id = 0, int $author_id = 0, array $languages = [])
{
- if (empty($languages) && (empty($body) || Smilies::isEmojiPost($body))) {
- Logger::debug('Empty body or only emojis', ['body' => $body]);
- return true;
- }
-
$detected = [];
$quality = DI::config()->get('system', 'relay_language_quality');
foreach (Item::getLanguageArray($body, DI::config()->get('system', 'relay_languages'), $uri_id, $author_id) as $language => $reliability) {
}
}
+ if (empty($languages) && empty($detected) && (empty($body) || Smilies::isEmojiPost($body))) {
+ Logger::debug('Empty body or only emojis', ['body' => $body]);
+ return true;
+ }
+
if (!empty($languages) || !empty($detected)) {
$cachekey = 'relay:isWantedLanguage';
$user_languages = DI::cache()->get($cachekey);
// Deny undetected languages
'relay_deny_undetected_language' => false,
- // relay_language_quality (Integer)
- // Minimum value for the language detection quality for relay posts. The value must be betweeen 0 and 1.
+ // relay_language_quality (Float)
+ // Minimum value for the language detection quality for relay posts. The value must be between 0 and 1.
'relay_language_quality' => 0,
// relay_languages (Integer)