- if ($additional) {
- // 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.
- // Additionally some more languages are added to that list that are used in the Fediverse.
- $additional_langs = [
- 'af' => 'Afrikaans',
- 'az-Latn' => 'azərbaycan dili',
- 'bs-Latn' => 'bosanski jezik',
- 'be' => 'беларуская мова',
- 'bn' => 'বাংলা',
- 'cy' => 'Cymraeg',
- 'el-monoton' => 'ελληνικά',
- 'eu' => 'euskara, euskera',
- 'fa' => 'فارسی',
- 'ga' => 'Gaeilge',
- 'gl' => 'galego',
- 'he' => 'עברית',
- 'hi' => 'हिन्दी, हिंदी',
- 'hr' => 'hrvatski jezik',
- 'hy' => 'Հայերեն',
- 'id' => 'Bahasa Indonesia',
- 'jv' => 'basa Jawa',
- 'ka' => 'ქართული',
- 'ko' => '한국어, 조선어',
- 'lt' => 'lietuvių kalba',
- 'lv' => 'latviešu valoda',
- 'ms-Latn' => 'bahasa Melayu, بهاس ملايو',
- 'sr-Cyrl' => 'српски језик',
- 'sk' => 'slovenčina, slovenský jazyk',
- 'sl' => 'slovenski jezik, slovenščina',
- 'sq' => 'Shqip',
- 'sw' => 'Kiswahili',
- 'ta' => 'தமிழ்',
- 'th' => 'ไทย',
- 'tl' => 'Wikang Tagalog, ᜏᜒᜃᜅ᜔ ᜆᜄᜎᜓᜄ᜔',
- 'tr' => 'Türkçe',
- 'pt-PT' => 'português',
- 'uk' => 'українська мова',
- 'uz' => 'Oʻzbek, Ўзбек, أۇزبېك',
- 'vi' => 'Việt Nam',
- 'zh-hant' => '繁體',
- ];
- $langs = array_merge($additional_langs, $langs);
- ksort($langs);
- }
+ /**
+ * Get language codes that are detectable by our language detection routines.
+ * Languages are excluded that aren't used often and that tend to false detections.
+ * The listed codes are a collection of both the official ISO 639-1 codes and
+ * the codes that are used by our built-in language detection routine.
+ * When the detection is done, the result only consists of the official ISO 639-1 codes.
+ *
+ * @return array
+ */
+ public function getDetectableLanguages(): array
+ {
+ $additional_langs = [
+ 'af', 'az', 'az-Cyrl', 'az-Latn', 'be', 'bn', 'bs', 'bs-Cyrl', 'bs-Latn',
+ 'cy', 'da', 'el', 'el-monoton', 'el-polyton', 'en', 'eu', 'fa', 'fi',
+ 'ga', 'gl', 'gu', 'he', 'hi', 'hr', 'hy', 'id', 'in', 'iu', 'iw', 'jv', 'jw',
+ 'ka', 'km', 'ko', 'lt', 'lv', 'mo', 'ms', 'ms-Arab', 'ms-Latn', 'nb', 'nn', 'no',
+ 'pt', 'pt-PT', 'pt-BR', 'ro', 'sa', 'sk', 'sl', 'sq', 'sr', 'sr-Cyrl', 'sr-Latn', 'sw',
+ 'ta', 'th', 'tl', 'tr', 'ug', 'uk', 'uz', 'vi', 'zh', 'zh-Hant', 'zh-Hans',
+ ];
+
+ if (in_array('cld2', get_loaded_extensions())) {
+ $additional_langs = array_merge($additional_langs,
+ ['dv', 'kn', 'lo', 'ml', 'or', 'pa', 'sd', 'si', 'te', 'yi']);