]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/L10n.php
Merge pull request #9039 from MrPetovan/task/frio-accent-scheme
[friendica.git] / src / Core / L10n.php
index 0238af3bd169d9d5d1e29b84553d25978f3b78e1..8e6ee171c86cca18c5e4d302b1a4ce95e4797857 100644 (file)
@@ -1,8 +1,27 @@
 <?php
+/**
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Core;
 
-use Friendica\Core\Config\IConfiguration;
+use Friendica\Core\Config\IConfig;
 use Friendica\Core\Session\ISession;
 use Friendica\Database\Database;
 use Friendica\Util\Strings;
@@ -14,6 +33,9 @@ use Psr\Log\LoggerInterface;
  */
 class L10n
 {
+       /** @var string The default language */
+       const DEFAULT = 'en';
+
        /**
         * A string indicating the current language used for translation:
         * - Two-letter ISO 639-1 code.
@@ -40,12 +62,12 @@ class L10n
         */
        private $logger;
 
-       public function __construct(IConfiguration $config, Database $dba, LoggerInterface $logger, ISession $session, array $server, array $get)
+       public function __construct(IConfig $config, Database $dba, LoggerInterface $logger, ISession $session, array $server, array $get)
        {
                $this->dba    = $dba;
                $this->logger = $logger;
 
-               $this->loadTranslationTable(L10n::detectLanguage($server, $get, $config->get('system', 'language', 'en')));
+               $this->loadTranslationTable(L10n::detectLanguage($server, $get, $config->get('system', 'language', self::DEFAULT)));
                $this->setSessionVariable($session);
                $this->setLangFromSession($session);
        }
@@ -131,7 +153,7 @@ class L10n
        }
 
        /**
-        * @brief Returns the preferred language from the HTTP_ACCEPT_LANGUAGE header
+        * Returns the preferred language from the HTTP_ACCEPT_LANGUAGE header
         *
         * @param string $sysLang The default fallback language
         * @param array  $server  The $_SERVER array
@@ -139,7 +161,7 @@ class L10n
         *
         * @return string The two-letter language code
         */
-       public static function detectLanguage(array $server, array $get, string $sysLang = 'en')
+       public static function detectLanguage(array $server, array $get, string $sysLang = self::DEFAULT)
        {
                $lang_variable = $server['HTTP_ACCEPT_LANGUAGE'] ?? null;