From af31b53a4f0269ceb14d8e89601752238a9bfdec Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Tue, 24 Aug 2021 21:47:33 +0200
Subject: [PATCH] Use proper way to load po-file

---
 lib/SimpleSAML/Locale/Localization.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/SimpleSAML/Locale/Localization.php b/lib/SimpleSAML/Locale/Localization.php
index 88dad17e4..7596797ad 100644
--- a/lib/SimpleSAML/Locale/Localization.php
+++ b/lib/SimpleSAML/Locale/Localization.php
@@ -10,6 +10,7 @@ declare(strict_types=1);
 
 namespace SimpleSAML\Locale;
 
+use Gettext\Loader\PoLoader;
 use Gettext\Translations;
 use Gettext\Translator;
 use Gettext\TranslatorFunctions;
@@ -231,8 +232,9 @@ class Localization
         $poFile = $domain . '.po';
         $poPath = $langPath . $poFile;
         if (file_exists($poPath) && is_readable($poPath)) {
-            $translations = Translations::fromPoFile($poPath);
-            $this->translator->loadTranslations($translations);
+            $poLoader = new PoLoader();
+            $translations = $poLoader->loadFile($poPath);
+            $this->translator->createFromTranslations($translations);
         } else {
             $error = "Localization file '$poFile' not found in '$langPath', falling back to default";
             Logger::debug($_SERVER['PHP_SELF'] . ' - ' . $error);
-- 
GitLab