diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index c08017e58e02a0b348c3a43f03ac561bc7c0ba52..a03dab446bedc6c57d7db32dd0f19a1bc731ea3f 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -11,6 +11,13 @@ class SimpleSAML_XHTML_Template { public $data = null; + /** + * A translator instance configured to work with this template. + * + * @var \SimpleSAML\Locale\Translate + */ + private $translator; + private $configuration = null; private $template = 'default.php'; @@ -31,6 +38,17 @@ class SimpleSAML_XHTML_Template } + /** + * Return the internal translator object used by this template. + * + * @return \SimpleSAML\Locale\Translate The translator that will be used with this template. + */ + public function getTranslator() + { + return $this->translator; + } + + /** * @deprecated This method will be removed in SSP 2.0. Please use * SimpleSAML\Locale\Translate::getPreferredTranslation() instead. diff --git a/modules/consent/templates/consentform.php b/modules/consent/templates/consentform.php index 198dd8d72e56439d63332bf3c18be70618fb587f..cb6eb4ff69a87fb1d38a0157a5990e82fda0732a 100644 --- a/modules/consent/templates/consentform.php +++ b/modules/consent/templates/consentform.php @@ -139,6 +139,8 @@ if ($this->data['sppp'] !== false) { */ function present_attributes($t, $attributes, $nameParent) { + $translator = $t->getTranslator(); + $alternate = array('odd', 'even'); $i = 0; $summary = 'summary="' . $t->t('{consent:consent:table_summary}') . '"'; @@ -155,7 +157,7 @@ function present_attributes($t, $attributes, $nameParent) foreach ($attributes as $name => $value) { $nameraw = $name; - $name = $t->getAttributeTranslation($parentStr . $nameraw); + $name = $translator->getAttributeTranslation($parentStr . $nameraw); if (preg_match('/^child_/', $nameraw)) { // insert child table diff --git a/modules/consentAdmin/www/consentAdmin.php b/modules/consentAdmin/www/consentAdmin.php index 5a9037e125f175ccc0f5b0bf0ed163b9196701ef..a6b3df9a2ede14f3a37bbfa65800835257151fd1 100644 --- a/modules/consentAdmin/www/consentAdmin.php +++ b/modules/consentAdmin/www/consentAdmin.php @@ -205,7 +205,7 @@ $template_sp_content = array(); // Init template $template = new SimpleSAML_XHTML_Template($config, 'consentAdmin:consentadmin.php', 'consentAdmin:consentadmin'); -$translator = new \SimpleSAML\Locale\Translate($config, 'consentAdmin:consentadmin'); +$translator = $template->getTranslator(); $sp_empty_name = $translator->getTag('sp_empty_name'); $sp_empty_description = $translator->getTag('sp_empty_description');