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

Use proper way to load po-file

parent 206148bd
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ declare(strict_types=1); ...@@ -10,6 +10,7 @@ declare(strict_types=1);
namespace SimpleSAML\Locale; namespace SimpleSAML\Locale;
use Gettext\Loader\PoLoader;
use Gettext\Translations; use Gettext\Translations;
use Gettext\Translator; use Gettext\Translator;
use Gettext\TranslatorFunctions; use Gettext\TranslatorFunctions;
...@@ -231,8 +232,9 @@ class Localization ...@@ -231,8 +232,9 @@ class Localization
$poFile = $domain . '.po'; $poFile = $domain . '.po';
$poPath = $langPath . $poFile; $poPath = $langPath . $poFile;
if (file_exists($poPath) && is_readable($poPath)) { if (file_exists($poPath) && is_readable($poPath)) {
$translations = Translations::fromPoFile($poPath); $poLoader = new PoLoader();
$this->translator->loadTranslations($translations); $translations = $poLoader->loadFile($poPath);
$this->translator->createFromTranslations($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";
Logger::debug($_SERVER['PHP_SELF'] . ' - ' . $error); Logger::debug($_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