Add checks for CLD2Detector ans CLD2Encoding classes

develop^2
Art4 2024-11-26 07:55:01 +00:00 committed by Hypolite Petovan
parent 72e7e2a5b7
commit 4527df602f
1 changed files with 10 additions and 0 deletions

View File

@ -22,6 +22,16 @@ function cld_detect_languages(array &$data)
return;
}
if (!class_exists('CLD2Detector')) {
Logger::warning('CLD2Detector class does not exist.');
return;
}
if (!class_exists('CLD2Encoding')) {
Logger::warning('CLD2Encoding class does not exist.');
return;
}
$cld2 = new \CLD2Detector();
$cld2->setEncodingHint(CLD2Encoding::UTF8); // optional, hints about text encoding