From 03bdf013075d8b1bbde293d57f394c94ab1deddc Mon Sep 17 00:00:00 2001
From: Thijs Kinkhorst <thijs@kinkhorst.com>
Date: Wed, 8 Sep 2021 12:52:37 +0000
Subject: [PATCH] Clean up some leftovers of switchable I18N backend

---
 lib/SimpleSAML/Locale/Localization.php | 44 --------------------------
 lib/SimpleSAML/XHTML/Template.php      |  1 -
 www/admin/sandbox.php                  |  1 -
 3 files changed, 46 deletions(-)

diff --git a/lib/SimpleSAML/Locale/Localization.php b/lib/SimpleSAML/Locale/Localization.php
index d49a57a28..06b4ccff4 100644
--- a/lib/SimpleSAML/Locale/Localization.php
+++ b/lib/SimpleSAML/Locale/Localization.php
@@ -31,20 +31,6 @@ class Localization
      */
     public const DEFAULT_DOMAIN = 'messages';
 
-    /**
-     * Old internationalization backend included in SimpleSAMLphp.
-     *
-     * @var string
-     */
-    public const SSP_I18N_BACKEND = 'SimpleSAMLphp';
-
-    /**
-     * An internationalization backend implemented purely in PHP.
-     *
-     * @var string
-     */
-    public const GETTEXT_I18N_BACKEND = 'gettext/gettext';
-
     /**
      * The default locale directory
      *
@@ -81,14 +67,6 @@ class Localization
     private string $langcode;
 
 
-    /**
-     * The language backend to use
-     *
-     * @var string
-     */
-    public string $i18nBackend;
-
-
     /**
      * Constructor
      *
@@ -102,7 +80,6 @@ class Localization
         $this->localeDir = $locales;
         $this->language = new Language($configuration);
         $this->langcode = $this->language->getPosixLanguage($this->language->getLanguage());
-        $this->i18nBackend = self::GETTEXT_I18N_BACKEND;
         $this->setupL10N();
     }
 
@@ -262,32 +239,11 @@ class Localization
     }
 
 
-    /**
-     * Test to check if backend is set to default
-     *
-     * (if false: backend unset/there's an error)
-     *
-     * @return bool
-     */
-    public function isI18NBackendDefault(): bool
-    {
-        if ($this->i18nBackend === $this::SSP_I18N_BACKEND) {
-            return true;
-        }
-        return false;
-    }
-
-
     /**
      * Set up L18N if configured or fallback to old system
      */
     private function setupL10N(): void
     {
-        if ($this->i18nBackend === self::SSP_I18N_BACKEND) {
-            Logger::debug("Localization: using old system");
-            return;
-        }
-
         $this->setupTranslator();
         // setup default domain
         $this->addDomain($this->localeDir, self::DEFAULT_DOMAIN);
diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php
index c490e08c6..35d29204d 100644
--- a/lib/SimpleSAML/XHTML/Template.php
+++ b/lib/SimpleSAML/XHTML/Template.php
@@ -302,7 +302,6 @@ class Template extends Response
         // initialize some basic context
         $langParam = $this->configuration->getString('language.parameter.name', 'language');
         $twig->addGlobal('languageParameterName', $langParam);
-        $twig->addGlobal('localeBackend', Localization::GETTEXT_I18N_BACKEND);
         $twig->addGlobal('currentLanguage', $this->translator->getLanguage()->getLanguage());
         $twig->addGlobal('isRTL', false); // language RTL configuration
         if ($this->translator->getLanguage()->isLanguageRTL()) {
diff --git a/www/admin/sandbox.php b/www/admin/sandbox.php
index 0cb855b27..07b3a245b 100644
--- a/www/admin/sandbox.php
+++ b/www/admin/sandbox.php
@@ -4,7 +4,6 @@ require_once('../_include.php');
 
 // Load SimpleSAMLphp configuration
 $config = \SimpleSAML\Configuration::getInstance()->toArray();
-$config['usenewui'] = true;
 $config = \SimpleSAML\Configuration::loadFromArray($config, '[ARRAY]', 'simplesaml');
 $session = \SimpleSAML\Session::getSessionFromRequest();
 
-- 
GitLab