From: Hypolite Petovan Date: Mon, 19 Jul 2021 18:00:31 +0000 (-0400) Subject: Manually add Persian to post body language detection X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f3131c62778817a98db6f8812e1f322fee3ed0ce;p=friendica.git Manually add Persian to post body language detection --- diff --git a/src/Model/Item.php b/src/Model/Item.php index 4c2782f562..5a0c1066cb 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -1642,7 +1642,13 @@ class Item 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(); if (is_array($languages)) { return json_encode($languages);