Skip to content
Snippets Groups Projects
Commit 8ff5e1f7 authored by Demian Katz's avatar Demian Katz
Browse files

Translator fixes: made language initialization a high-priority event; throw...

Translator fixes: made language initialization a high-priority event; throw Exception if translator not initialized.
parent eb8b7fb9
No related merge requests found
...@@ -217,7 +217,7 @@ class Bootstrap ...@@ -217,7 +217,7 @@ class Bootstrap
$viewModel->setVariable('userLang', $language); $viewModel->setVariable('userLang', $language);
$viewModel->setVariable('allLangs', $config->Languages); $viewModel->setVariable('allLangs', $config->Languages);
}; };
$this->events->attach('dispatch', $callback); $this->events->attach('dispatch', $callback, 9000);
} }
/** /**
......
...@@ -108,6 +108,10 @@ class Translator ...@@ -108,6 +108,10 @@ class Translator
*/ */
public static function translate($str) public static function translate($str)
{ {
return static::$translator->translate($str); if (is_object(static::$translator)) {
return static::$translator->translate($str);
} else {
throw new \Exception('Translator not initialized');
}
} }
} }
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment