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

Fix translations for included templates

parent d4dcd189
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ namespace SimpleSAML\Error; ...@@ -7,6 +7,7 @@ namespace SimpleSAML\Error;
use SimpleSAML\Assert\Assert; use SimpleSAML\Assert\Assert;
use SimpleSAML\Configuration; use SimpleSAML\Configuration;
use SimpleSAML\Logger; use SimpleSAML\Logger;
use SimpleSAML\Module;
use SimpleSAML\Session; use SimpleSAML\Session;
use SimpleSAML\Utils; use SimpleSAML\Utils;
use SimpleSAML\XHTML\Template; use SimpleSAML\XHTML\Template;
...@@ -269,6 +270,15 @@ class Error extends Exception ...@@ -269,6 +270,15 @@ class Error extends Exception
Assert::true(false); Assert::true(false);
} else { } else {
$t = new Template($config, 'error.twig', 'errors'); $t = new Template($config, 'error.twig', 'errors');
// Include translations for the module that holds the included template
if ($this->includeTemplate !== null) {
$module = explode(':', $this->includeTemplate, 2);
if (count($module) === 2 && Module::isModuleEnabled($module[0])) {
$t->getLocalization()->addModuleDomain($module[0]);
}
}
$t->setStatusCode($this->httpCode); $t->setStatusCode($this->httpCode);
$t->data = array_merge($t->data, $data); $t->data = array_merge($t->data, $data);
$t->send(); $t->send();
......
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