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
*
* @param string $domain Name of domain
*/
private function loadGettextGettextFromPO($domain = self::DEFAULT_DOMAIN) {
$t = new Translator();
$t->register();
private function loadGettextGettextFromPO($domain = self::DEFAULT_DOMAIN)
{
$this->translator = new Translator();
$this->translator->register();
try {
$langPath = $this->getLangPath($domain);
} catch (\Exception $e) {
......@@ -143,7 +144,7 @@ class Localization
$poPath = $langPath.$poFile;
if (file_exists($poPath) && is_readable($poPath)) {
$translations = Translations::fromPoFile($poPath);
$t->loadTranslations($translations);
$this->translator->loadTranslations($translations);
} else {
$error = "Localization file '$poFile' not found in '$langPath', falling back to default";
\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