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
Branches
Tags
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment