From fbb25a0351c59cea52372a3fb9478cfc67f83f03 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaime=20Pe=CC=81rez?= <jaime.perez@uninett.no>
Date: Tue, 4 Oct 2016 16:33:51 +0200
Subject: [PATCH] Keep the Translator object in
 SimpleSAML\Locale\Localization::loadGettextGettextFromPO().

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

diff --git a/lib/SimpleSAML/Locale/Localization.php b/lib/SimpleSAML/Locale/Localization.php
index e5111d3bf..3afa95d48 100644
--- a/lib/SimpleSAML/Locale/Localization.php
+++ b/lib/SimpleSAML/Locale/Localization.php
@@ -130,9 +130,10 @@ class Localization
      *
      * @param string $domain Name of domain
      */
-    private function loadGettextGettextFromPO($domain = self::DEFAULT_DOMAIN) {
-        $t = new Translator();
-        $t->register();
+    private function loadGettextGettextFromPO($domain = self::DEFAULT_DOMAIN)
+    {
+        $this->translator = new Translator();
+        $this->translator->register();
         try {
             $langPath = $this->getLangPath($domain);
         } catch (\Exception $e) {
@@ -143,7 +144,7 @@ class Localization
         $poPath = $langPath.$poFile;
         if (file_exists($poPath) && is_readable($poPath)) {
             $translations = Translations::fromPoFile($poPath);
-            $t->loadTranslations($translations);
+            $this->translator->loadTranslations($translations);
         } else {
             $error = "Localization file '$poFile' not found in '$langPath', falling back to default";
             \SimpleSAML\Logger::error($_SERVER['PHP_SELF'].' - '.$error);
-- 
GitLab