Skip to content
Snippets Groups Projects
Commit 82a36523 authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Fix

parent 124719cc
No related branches found
No related tags found
No related merge requests found
...@@ -251,7 +251,7 @@ class Localization ...@@ -251,7 +251,7 @@ class Localization
$file = new File($langPath . $domain . '.po'); $file = new File($langPath . $domain . '.po');
if ($this->fileSystem->exists($file->getRealPath()) && $file->isReadable()) { if ($this->fileSystem->exists($file->getRealPath()) && $file->isReadable()) {
$translations = (new PoLoader())->loadFile($file); $translations = (new PoLoader())->loadFile($file->getRealPath());
$arrayGenerator = new ArrayGenerator(); $arrayGenerator = new ArrayGenerator();
$this->translator->addTranslations( $this->translator->addTranslations(
$arrayGenerator->generateArray($translations) $arrayGenerator->generateArray($translations)
......
...@@ -11,6 +11,7 @@ declare(strict_types=1); ...@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace SimpleSAML\Locale; namespace SimpleSAML\Locale;
use Gettext\Translator; use Gettext\Translator;
use Gettext\TranslatorFunctions;
use SimpleSAML\Assert\Assert; use SimpleSAML\Assert\Assert;
use SimpleSAML\Configuration; use SimpleSAML\Configuration;
use SimpleSAML\Logger; use SimpleSAML\Logger;
...@@ -81,8 +82,7 @@ class Translate ...@@ -81,8 +82,7 @@ class Translate
// This may happen if you forget to set a variable and then run undefinedVar through the trans-filter // This may happen if you forget to set a variable and then run undefinedVar through the trans-filter
$original = $original ?? 'undefined variable'; $original = $original ?? 'undefined variable';
$loc = new Localization(Configuration::getInstance()); $text = TranslatorFunctions::getTranslator()->gettext($original);
$text = $loc->getTranslator()->gettext($original);
if (func_num_args() === 1) { if (func_num_args() === 1) {
return $text; return $text;
...@@ -108,8 +108,7 @@ class Translate ...@@ -108,8 +108,7 @@ class Translate
// This may happen if you forget to set a variable and then run undefinedVar through the trans-filter // This may happen if you forget to set a variable and then run undefinedVar through the trans-filter
$original = $original ?? 'undefined variable'; $original = $original ?? 'undefined variable';
$loc = new Localization(Configuration::getInstance()); $text = TranslatorFunctions::getTranslator()->ngettext($original, $plural, $value);
$text = $loc->getTranslator()->ngettext($original, $plural, $value);
if (func_num_args() === 3) { if (func_num_args() === 3) {
return $text; return $text;
......
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