]> git.mxchange.org Git - friendica.git/commitdiff
Constant for undeterminded language
authorMichael <heluecht@pirati.ca>
Mon, 15 Jan 2024 06:20:49 +0000 (06:20 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 28 Jan 2024 15:37:43 +0000 (16:37 +0100)
src/Content/Conversation/Entity/Timeline.php
src/Core/L10n.php
src/Model/Item.php
src/Model/User.php
src/Protocol/Relay.php

index 914f3795c6913f1aaee54f7211ac6d70c03f0201..a27d9fb98f3076d10ecc9a904d9a7627d395f629 100644 (file)
@@ -35,7 +35,7 @@ namespace Friendica\Content\Conversation\Entity;
  * @property-read array  $languages      Channel languages
  * @property-read int    $circle         Circle or timeline this channel is based on
  * @property-read bool   $publish        Publish the channel
- * @property-read bool   $valid          Signalizes that the search condiions are valid
+ * @property-read bool   $valid          Indicates that the search conditions are valid
  */
 class Timeline extends \Friendica\BaseEntity
 {
index d00cd0df5ce018e87363e3445d4bdbe6791a8828..2b1e7b9e4bdf8defb142528f5075471de6a7768c 100644 (file)
@@ -65,6 +65,9 @@ class L10n
                'zh-cn' => '简体中文',
        ];
 
+       /** @var string Undetermined language */
+       const UNDETERMINED_LANGUAGE = 'un';
+
        /**
         * A string indicating the current language used for translation:
         * - Two-letter ISO 639-1 code.
@@ -438,7 +441,7 @@ class L10n
 
                // In ISO 639-2 undetermined languages have got the code "und".
                // There is no official code for ISO 639-1, but "un" is not assigned to any language.   
-               $languages = ['un' => $this->t('Undetermined')];
+               $languages = [self::UNDETERMINED_LANGUAGE => $this->t('Undetermined')];
 
                foreach ($this->getDetectableLanguages() as $code) {
                        $code     = $this->toISO6391($code);
index f3fab4d965359278960726d0e801bb08fd897121..91e7e8613e5195252f76acbf90fc3b1cd04391a2 100644 (file)
@@ -28,6 +28,7 @@ use Friendica\Content\Post\Entity\PostMedia;
 use Friendica\Content\Text\BBCode;
 use Friendica\Content\Text\HTML;
 use Friendica\Core\Hook;
+use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
@@ -2124,7 +2125,7 @@ class Item
         */
        public static function getLanguageArray(string $body, int $count, int $uri_id = 0, int $author_id = 0, array $default = []): array
        {
-               $default = $default ?: ['un' => 1];
+               $default = $default ?: [L10n::UNDETERMINED_LANGUAGE => 1];
 
                $searchtext = BBCode::toSearchText($body, $uri_id);
 
@@ -2274,7 +2275,7 @@ class Item
                foreach (json_decode($item['language'], true) as $language => $reliability) {
                        $code = DI::l10n()->toISO6391($language);
 
-                       if ($code == 'un') {
+                       if ($code == L10n::UNDETERMINED_LANGUAGE) {
                                $native = $language = DI::l10n()->t('Undetermined');
                        } else {
                                $native   = $iso639->nativeByCode1($code);
index c60f8d7b28ab25fc1adb6aadf64e28b64174e4d7..a13b45e23b4a5f3ba2e8901f76097ca306ab0c73 100644 (file)
@@ -645,7 +645,7 @@ class User
                }
 
                if (!DI::config()->get('system', 'relay_deny_undetected_language')) {
-                       $languages['un'] = 'un';
+                       $languages[L10n::UNDETERMINED_LANGUAGE] = L10n::UNDETERMINED_LANGUAGE;
                }
 
                ksort($languages);
index ae0ad949d043d059305d8915b3f1a627c0c53414..9b1911315acde62e8828a38fb4b5b0e0111c14f0 100644 (file)
@@ -23,7 +23,7 @@ namespace Friendica\Protocol;
 
 use Friendica\Content\Smilies;
 use Friendica\Content\Text\BBCode;
-use Friendica\Core\Cache\Enum\Duration;
+use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Database\DBA;
@@ -189,7 +189,7 @@ class Relay
                }
 
                if (empty($detected) && empty($languages)) {
-                       $detected = ['un'];
+                       $detected = [L10n::UNDETERMINED_LANGUAGE];
                }
 
                if (empty($body) || Smilies::isEmojiPost($body)) {