Skip to content

Commit

Permalink
i18n: when loading from po file the domain from the file has to be wiped
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyiq committed Mar 16, 2024
1 parent e69a33f commit 03ae601
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/SimpleSAML/Locale/Localization.php
Expand Up @@ -251,6 +251,22 @@ private function loadGettextGettextFromPO(
$file->getfileName(),
$langPath,
));
$file = new File($langPath . $domain . '.po', false);
if ($file->getRealPath() !== false && $file->isReadable()) {
$translations = (new PoLoader())->loadFile($file->getRealPath());
$translations->setDomain('');
$arrayGenerator = new ArrayGenerator();
$this->translator->addTranslations(
$arrayGenerator->generateArray($translations)
);
} else {
Logger::debug(sprintf(
"%s - Localization file '%s' not found or not readable in '%s', falling back to default",
$_SERVER['PHP_SELF'],
$file->getfileName(),
$langPath,
));
}
}
}

Expand Down

0 comments on commit 03ae601

Please sign in to comment.