From f3131c62778817a98db6f8812e1f322fee3ed0ce Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 19 Jul 2021 14:00:31 -0400 Subject: [PATCH] Manually add Persian to post body language detection --- src/Model/Item.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 4c2782f56..5a0c1066c 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);