Skip to content
Snippets Groups Projects
Commit fbb25a03 authored by Jaime Pérez's avatar Jaime Pérez
Browse files

Keep the Translator object in SimpleSAML\Locale\Localization::loadGettextGettextFromPO().

parent 3ea78451
No related branches found
No related tags found
No related merge requests found
...@@ -130,9 +130,10 @@ class Localization ...@@ -130,9 +130,10 @@ class Localization
* *
* @param string $domain Name of domain * @param string $domain Name of domain
*/ */
private function loadGettextGettextFromPO($domain = self::DEFAULT_DOMAIN) { private function loadGettextGettextFromPO($domain = self::DEFAULT_DOMAIN)
$t = new Translator(); {
$t->register(); $this->translator = new Translator();
$this->translator->register();
try { try {
$langPath = $this->getLangPath($domain); $langPath = $this->getLangPath($domain);
} catch (\Exception $e) { } catch (\Exception $e) {
...@@ -143,7 +144,7 @@ class Localization ...@@ -143,7 +144,7 @@ class Localization
$poPath = $langPath.$poFile; $poPath = $langPath.$poFile;
if (file_exists($poPath) && is_readable($poPath)) { if (file_exists($poPath) && is_readable($poPath)) {
$translations = Translations::fromPoFile($poPath); $translations = Translations::fromPoFile($poPath);
$t->loadTranslations($translations); $this->translator->loadTranslations($translations);
} else { } else {
$error = "Localization file '$poFile' not found in '$langPath', falling back to default"; $error = "Localization file '$poFile' not found in '$langPath', falling back to default";
\SimpleSAML\Logger::error($_SERVER['PHP_SELF'].' - '.$error); \SimpleSAML\Logger::error($_SERVER['PHP_SELF'].' - '.$error);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment