]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/L10n.php
Merge pull request #11015 from MrPetovan/task/10979-frio-time-tooltip
[friendica.git] / src / Core / L10n.php
index 138fd8730b19efd3f5ec9860bf9be6966cd10dae..aca57793ca9711d1208c5e60f5c37231784f4a64 100644 (file)
@@ -21,8 +21,8 @@
 
 namespace Friendica\Core;
 
-use Friendica\Core\Config\IConfig;
-use Friendica\Core\Session\ISession;
+use Friendica\Core\Config\Capability\IManageConfigValues;
+use Friendica\Core\Session\Capability\IHandleSessions;
 use Friendica\Database\Database;
 use Friendica\Util\Strings;
 use Psr\Log\LoggerInterface;
@@ -62,7 +62,7 @@ class L10n
         */
        private $logger;
 
-       public function __construct(IConfig $config, Database $dba, LoggerInterface $logger, ISession $session, array $server, array $get)
+       public function __construct(IManageConfigValues $config, Database $dba, LoggerInterface $logger, IHandleSessions $session, array $server, array $get)
        {
                $this->dba    = $dba;
                $this->logger = $logger;
@@ -85,7 +85,7 @@ class L10n
        /**
         * Sets the language session variable
         */
-       private function setSessionVariable(ISession $session)
+       private function setSessionVariable(IHandleSessions $session)
        {
                if ($session->get('authenticated') && !$session->get('language')) {
                        $session->set('language', $this->lang);
@@ -103,7 +103,7 @@ class L10n
                }
        }
 
-       private function setLangFromSession(ISession $session)
+       private function setLangFromSession(IHandleSessions $session)
        {
                if ($session->get('language') !== $this->lang) {
                        $this->loadTranslationTable($session->get('language'));
@@ -304,9 +304,9 @@ class L10n
                                } elseif (count($t) > 0) {
                                        // for some languages there is only a single array item
                                        $s = $t[0];
-                               } else {
-                                       $this->logger->warning('Found empty strings array.', ['singular' => $singular, 'plural' => $plural, 'array' => $t]);
                                }
+                               // if $t is empty, skip it, because empty strings array are indended
+                               // to make string file smaller when there's no translation
                        } else {
                                $s = $t;
                        }
@@ -314,7 +314,7 @@ class L10n
 
                if (is_null($s) && $this->stringPluralSelectDefault($count)) {
                        $s = $plural;
-               } else {
+               } elseif (is_null($s)) {
                        $s = $singular;
                }