Manually add Persian to post body language detection

This commit is contained in:
Hypolite Petovan 2021-07-19 14:00:31 -04:00
parent 0eed813037
commit f3131c6277

View file

@ -1642,7 +1642,13 @@ class Item
return ''; return '';
} }
$ld = new Language(DI::l10n()->getAvailableLanguages()); $availableLanguages = DI::l10n()->getAvailableLanguages();
// See https://github.com/friendica/friendica/issues/10511
// Persian is manually added to language detection until a persian translation is provided for the interface, at
// which point it will be automatically available through `getAvailableLanguages()` and this should be removed.
$availableLanguages['fa'] = 'fa';
$ld = new Language($availableLanguages);
$languages = $ld->detect($naked_body)->limit(0, 3)->close(); $languages = $ld->detect($naked_body)->limit(0, 3)->close();
if (is_array($languages)) { if (is_array($languages)) {
return json_encode($languages); return json_encode($languages);