From be41960c6b2fa1e7f83a670694895e8cba86a4ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Wed, 26 Mar 2008 17:46:13 +0000
Subject: [PATCH] Large upgrade on the multilanguage support. It is not
 complete. Have to commit in two steps, because i need to move a lot of files.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@426 44740490-163a-0410-bde0-09ae8108e29a
---
 config-templates/config.php                 |   8 +-
 dictionaries/attributes.php                 | 144 +++++++++++-----
 dictionaries/errors.php                     | 176 +++++++++++++-------
 dictionaries/frontpage.php                  |  67 ++++++++
 lib/SimpleSAML/XHTML/Template.php           | 106 ++++++++++--
 templates/default/en/admin-metadatalist.php |  32 ++--
 templates/default/en/consent.php            |   6 +-
 templates/default/en/error.php              |  31 ++--
 templates/default/en/frontpage.php          |  28 ++--
 templates/default/en/httpredirect-debug.php |   4 +-
 templates/default/en/login-ldapmulti.php    |  18 +-
 templates/default/en/login.php              |  14 +-
 templates/default/en/metadata.php           |  16 +-
 templates/default/en/openid-about.php       |  14 +-
 templates/default/en/openid-sites.php       |  10 +-
 templates/default/en/openid-trust.php       |  12 +-
 templates/default/en/post-debug.php         |   8 +-
 templates/default/en/post.php               |   6 +-
 templates/default/en/selectidp-dropdown.php |  12 +-
 templates/default/en/selectidp-links.php    |   8 +-
 templates/default/en/status-table.php       |   6 +-
 templates/default/en/status.php             |  19 ++-
 templates/default/includes/header.php       |  18 +-
 www/index.php                               |   8 +-
 www/resources/default.css                   |   8 +-
 25 files changed, 530 insertions(+), 249 deletions(-)
 create mode 100644 dictionaries/frontpage.php

diff --git a/config-templates/config.php b/config-templates/config.php
index 4e001c7b6..7fbb9b5fb 100644
--- a/config-templates/config.php
+++ b/config-templates/config.php
@@ -112,9 +112,15 @@ $config = array (
 	/*
 	 * Languages available and what language is default
 	 */
-	'language.available'	=> array('en', 'no'),
+	'language.available'	=> array('en', 'no', 'dk', 'es'),
 	'language.default'		=> 'en',
 	
+	/*
+	 * Which template directory should be used? The base is fallback (leave it to default).
+	 */
+	'template.use' 			=> 'default',
+	'template.base' 		=> 'default',
+	
 	/*
 	 * Default IdPs. If you do not enter an idpentityid in the SSO initialization endpoints,
 	 * the default IdP configured here will be used.
diff --git a/dictionaries/attributes.php b/dictionaries/attributes.php
index e5c49c1dc..f12028a16 100644
--- a/dictionaries/attributes.php
+++ b/dictionaries/attributes.php
@@ -1,41 +1,109 @@
 <?php
 
 $lang = array(
-	'en' =>	array(
-		'attribute_edupersonaffiliation' => 'Affiliation',
-		'attribute_title' => 'Title',
-		'attribute_uid' => 'User ID',
-		'attribute_sn' => 'Surname',
-		'attribute_gn' => 'Given name',
-		'attribute_cn' => 'Common name',
-		'attribute_mail' => 'Email address',
-		'attribute_preferredlanguage' => 'Preferred language',
-		'attribute_noredupersonnin' => 'Social security number',
-		'attribute_schachomeorganization' => 'Unique home organization ID',
-		'attribute_organisationname' => 'Organisation name',
-		'attribute_edupersonentitlement' => 'Entitlement regarding the service',
-		'attribute_edupersonscopedaffiliation' => 'Group membership',
-		'attribute_edupersontargetedid' => 'Persistent anonymous ID at the service',
-		'attribute_edupersonprincipalname' => 'Person principal name at home organization'
-	),
-	'no' =>	array(
-		'attribute_mail' => 'E-post',
-		'attribute_edupersonaffiliation' => 'Tilhørighet',
-		'attribute_title' => 'Tittel',
-		'attribute_uid' => 'BrukerID',
-	),
-	'dk' => array(
-		'attribute_sn' => 'Efternavn',
-		'attribute_gn' => 'Fornavne',
-		'attribute_cn' => 'Kaldenavn',
-		'attribute_mail' => 'Emailadresse',
-		'attribute_preferredlanguage' => 'Foretrukne sprog',
-		'attribute_noredupersonnin' => 'CPR nummer',
-		'attribute_schachomeorganization' => 'Hjemmeorganisationens entydige ID',
-		'attribute_organisationname' => 'Hjemmeorganisationens kaldenavn',
-		'attribute_edupersonentitlement' => 'Specifik rolle i forhold til tjenesten',
-		'attribute_edupersonscopedaffiliation' => 'Gruppemedlemskab',
-		'attribute_edupersontargetedid' => 'Vedholdende anonymt bruger-ID hos tjenesten',
-		'attribute_edupersonprincipalname' => 'Bruger-ID hos hjemmeorganisationen',
-	),
-);
\ No newline at end of file
+
+	'attribute_edupersonaffiliation' => array(
+		'en' => 'Affiliation',
+		'no' => 'Tilhørighet',
+	),
+	
+	'attribute_title' => array(
+		'en' => 'Affiliation',
+		'no' => 'Tilhørighet',
+	),
+	
+	'attribute_uid' => array(
+		'en' => 'User ID',
+		'no' => 'Bruker ID',
+	),
+	
+	'attribute_sn' => array(
+		'en' => 'Surname',
+		'no' => 'Etternavn',
+		'dk' => 'Efternavn',
+	),
+	
+	'attribute_gn' => array(
+		'en' => 'Given name',
+		'no' => 'Fornavn',
+		'dk' => 'Fornavne',
+	),
+
+	'attribute_cn' => array(
+		'en' => 'Common name',
+		'no' => 'Fullt navn',
+		'dk' => 'Kaldenavn',
+	),
+	
+	'attribute_mail' => array(
+		'en' => 'E-mail',
+		'no' => 'E-post',
+		'dk' => 'Emailadresse',
+	),
+
+	'attribute_mobile' => array(
+		'en' => 'Mobile',
+		'no' => 'Mobiltelefon',
+	),
+	
+	'attribute_preferredlanguage' => array(
+		'en' => 'Preferred language',
+		'no' => 'Foretrukket sprĂĄk',
+		'dk' => 'Foretrukne sprog',
+	),
+
+	'attribute_noredupersonnin' => array(
+		'en' => 'Social security number',
+		'no' => 'Personnummer',
+		'dk' => 'CPR nummer',
+	),
+	
+	'attribute_schachomeorganization' => array(
+		'en' => 'Unique home organization ID',
+		'no' => 'Unik ID for organisasjon',
+		'dk' => 'Hjemmeorganisationens entydige ID',
+	),
+	
+	'attribute_organisationname' => array(
+		'en' => 'Organisation name',
+		'no' => 'Navn pĂĄ organisasjon',
+		'dk' => 'Hjemmeorganisationens kaldenavn',
+	),
+	
+	'attribute_edupersonentitlement' => array(
+		'en' => 'Entitlement regarding the service',
+		'no' => 'Rettighet',
+		'dk' => 'Specifik rolle i forhold til tjenesten',
+	),
+
+	'attribute_edupersonscopedaffiliation' => array(
+		'en' => 'Group membership',
+		'no' => 'Gruppetilhørighet',
+		'dk' => 'Gruppemedlemskab',
+	),
+
+	'attribute_edupersonentitlement' => array(
+		'en' => 'Entitlement regarding the service',
+		'no' => 'Rettighet',
+	),
+
+	'attribute_edupersontargetedid' => array(
+		'en' => 'Persistent anonymous ID',
+		'no' => 'Persistent anonynm ID',
+		'dk' => 'Vedholdende anonymt bruger-ID hos tjenesten',
+	),
+
+	'attribute_edupersonentitlement' => array(
+		'en' => 'Entitlement regarding the service',
+		'no' => 'Rettighet',
+	),
+
+	'attribute_edupersonprincipalname' => array(
+		'en' => 'Person principal name at home organization',
+		'no' => 'Personlig ID hos organisasjonen',
+		'dk' => 'Bruger-ID hos hjemmeorganisationen',
+	),
+	
+);
+
+$lang['attribute_o'] = $lang['attribute_organisationname'];
diff --git a/dictionaries/errors.php b/dictionaries/errors.php
index dc5506859..0217dbb68 100644
--- a/dictionaries/errors.php
+++ b/dictionaries/errors.php
@@ -1,65 +1,127 @@
 <?php
 
 $lang = array(
-	'en'	=>	array(
-		'title_CACHEAUTHNREQUEST'	=>	'Error making single sign-on to service',
-		'descr_CACHEAUTHNREQUEST'	=>	'You can authenticated and are ready to be sent back to the service that requested authentication, but we could not find your cached authentication request. The request is only cached for a limited amount of time. If you leaved your browser open for hours before entering your username and password, this could be one possible explaination. If this could be the case in your situation, try to go back to the service you want to access, and start a new login process. If this issue continues, please report the problem.',
-		
-		'title_CREATEREQUEST' => 'Error creating request',
-		'descr_CREATEREQUEST' => 'An error occured when trying to create the SAML request.',
-		
-		'title_DISCOPARAMS' => 'Bad request to discovery service',
-		'descr_DISCOPARAMS' => 'The parameters sent to the discovery service were not following the specification.',
-		
-		'title_GENERATEAUTHNRESPONSE' => 'Could not create authentication response',
-		'descr_GENERATEAUTHNRESPONSE' => 'When this identity provider tried to create an authentication response, an error occured.',
 
-		'title_GENERATELOGOUTRESPONSE' => 'Could not create logout response',
-		'descr_GENERATELOGOUTRESPONSE' => 'When this SAML entity tried to create an logout response, an error occured.',
 
-		
-		'title_LDAPERROR' => 'LDAP Error',
-		'descr_LDAPERROR' => 'LDAP is the user database, and when you try to login, we need to contact an LDAP database. When we tried it this time an error occured.',
-		
-		'title_LOGOUTREQUEST' => 'Error processing Logout Request',
-		'descr_LOGOUTREQUEST' => 'An error occured when trying to process the Logout Request.',
-		
-		'title_GENERATELOGOUTREQUEST' => 'Could not create logout request',
-		'descr_GENERATELOGOUTREQUEST' => 'When this SAML entity tried to create an logout request, an error occured.',
-		
-		'title_LOGOUTRESPONSE' => 'Error processing Logout Response',
-		'descr_LOGOUTRESPONSE' => 'An error occured when trying to process the Logout Response.',
-		
-		'title_METADATA' => 'Error loading metadata',
-		'descr_METADATA' => 'There is some misconfiguration of your simpleSAMLphp installation. If you are the administrator of this service, you should make sure your metadata configuration is correctly setup.',
-		
-		'title_NOACCESS' => 'No access',
-		'descr_NOACCESS' => 'This endpoint is not enabled. Check the enable options in your configuration of simpleSAMLphp.',
-		
-		'title_NORELAYSTATE' => 'No RelayState',
-		'descr_NORELAYSTATE' => 'The initiator of this request did not provide an RelayState parameter, that tells where to go next.',
-		
-		'title_NOSESSION' => 'No session found',
-		'descr_NOSESSION' => 'Unfortuneately we could not get your session. This could be because your browser do not support cookies, or cookies is disabled. Or may be your session timed out because you let the browser open for a long time.',
-		
-		'title_PROCESSASSERTION' =>	'Error processing response from IdP',
-		'descr_PROCESSASSERTION' =>	'We did not accept the response sent from the Identity Provider.',
-		
-		'title_PROCESSAUTHNRESPONSE' =>	'Error processing request from Service Provider',
-		'descr_PROCESSAUTHNRESPONSE' =>	'This IdP received an authentication request from a service provider, but an error occured when trying to process the request.',
-		
-		'title_SSOSERVICEPARAMS' =>	'Wrong parameters provided',
-		'descr_SSOSERVICEPARAMS' =>	'You must either provide a SAML Request message or a RequestID on this interface.',
-		
-		'title_SLOSERVICEPARAMS' => 'No SAML message provided',
-		'descr_SLOSERVICEPARAMS' => 'You accessed the SingleLogoutService interface, but did not provide a SAML LogoutRequest or LogoutResponse.',
-		
-		'title_ACSPARAMS' => 'No SAML response provided',
-		'descr_ACSPARAMS' => 'You accessed the Assertion Consumer Service interface, but did not provide a SAML Authentication Response.',
-		
-		'title_CASERROR' => 'CAS Error',
-		'descr_CASERROR' => 'Error when communicating with the CAS server.'
+	'error_header' => array(
+		'en' => 'simpleSAMLphp error',
+		'no' => 'simpleSAMLphp feil',
+	),
+	
+	'report_trackid' => array(
+		'en' => 'If you report this error, please also report this tracking ID which makes it possible to locate your session in the logs which are available to the system administrator:',
+		'no' => 'Hvis du ønsker å rapportere denne feilen, send også med denne sporings-IDen. Den gjør det enklere for systemadministratorene og finne ut hva som gikk galt:',
+	),
+	
+	'debuginfo_header' => array(
+		'en' => 'Debug information',
+		'no' => 'Detaljer for feilsøking',
+	),
 
-	)
+	'debuginfo_text' => array(
+		'en' => 'The debug information below may be interesting for the administrator / help desk:',
+		'no' => 'Detaljene nedenunder kan være av interesse for administratoren / hjelpetjenesten',
+	),
+	
+	'report_header' => array(
+		'en' => 'Report errors',
+		'no' => 'Rapporter feil',
+	),
+
+	'report_text' => array(
+		'en' => 'Optionally enter your email address, for the administrators to be able contact you for further questions about your issue:',
+		'no' => 'Dersom du ønsker at hjelpetjenesten skal kunde kontakte deg igjen i forbindelse med denne feilen, må du oppgi e-post adressen din nedenunder:',
+	),
+	
+	'report_email' => array(
+		'en' => 'E-mail address: ',
+		'no' => 'E-post adresse:',
+	),
+	
+	'report_explain' => array(
+		'en' => 'Explain what you did to get this error...',
+		'no' => 'Forklar hva du gjorde og hvordan feilen oppsto...',
+	),
+	
+	'report_submit' => array(
+		'en' => 'Send error report',
+		'no' => 'Send feilrapport',
+	),
+	
+	'howto_header' => array(
+		'en' => 'Send error report',
+		'no' => 'Send feilrapport',
+	),
+	
+	'howto_text' => array(
+		'en' => 'This error probably is due to some unexpected behaviour or to misconfiguration of simpleSAMLphp. Contact the administrator of this login service, and send them the error message above.',
+		'no' => 'Denne feilen skyldes sannsynligvis en feilkonfigurasjon av simpleSAMLphp eller som en følge av en uforutsett hendelse. Kontakt administratoren av denne tjenesten og rapporter så mye som mulig angående feilen.',
+	),
+	
+	'title_CACHEAUTHNREQUEST' => array('en' => 'Error making single sign-on to service'),
+	'descr_CACHEAUTHNREQUEST' => array('en' => 'You can authenticated and are ready to be sent back to the service that requested authentication, but we could not find your cached authentication request. The request is only cached for a limited amount of time. If you leaved your browser open for hours before entering your username and password, this could be one possible explaination. If this could be the case in your situation, try to go back to the service you want to access, and start a new login process. If this issue continues, please report the problem.'),
+	
+	'title_CREATEREQUEST' => array('en' => 'Error creating request'),
+	'descr_CREATEREQUEST' => array('en' => 'An error occured when trying to create the SAML request.'),
+	
+	'title_DISCOPARAMS' => array('en' => 'Bad request to discovery service'),
+	'descr_DISCOPARAMS' => array('en' => 'The parameters sent to the discovery service were not following the specification.'),
+	
+	'title_GENERATEAUTHNRESPONSE' => array('en' => 'Could not create authentication response'),
+	'descr_GENERATEAUTHNRESPONSE' => array('en' => 'When this identity provider tried to create an authentication response, an error occured.'),
+
+	'title_GENERATELOGOUTRESPONSE' => array('en' => 'Could not create logout response'),
+	'descr_GENERATELOGOUTRESPONSE' => array('en' => 'When this SAML entity tried to create an logout response, an error occured.'),
+
+	
+	'title_LDAPERROR' => array('en' => 'LDAP Error'),
+	'descr_LDAPERROR' => array('en' => 'LDAP is the user database, and when you try to login, we need to contact an LDAP database. When we tried it this time an error occured.'),
+	
+	'title_LOGOUTREQUEST' => array('en' => 'Error processing Logout Request'),
+	'descr_LOGOUTREQUEST' => array('en' => 'An error occured when trying to process the Logout Request.'),
+	
+	'title_GENERATELOGOUTREQUEST' => array('en' => 'Could not create logout request'),
+	'descr_GENERATELOGOUTREQUEST' => array('en' => 'When this SAML entity tried to create an logout request, an error occured.'),
+	
+	'title_LOGOUTRESPONSE' => array('en' => 'Error processing Logout Response'),
+	'descr_LOGOUTRESPONSE' => array('en' => 'An error occured when trying to process the Logout Response.'),
+	
+	'title_METADATA' => array('en' => 'Error loading metadata'),
+	'descr_METADATA' => array('en' => 'There is some misconfiguration of your simpleSAMLphp installation. If you are the administrator of this service, you should make sure your metadata configuration is correctly setup.'),
+	
+	'title_NOACCESS' => array('en' => 'No access'),
+	'descr_NOACCESS' => array('en' => 'This endpoint is not enabled. Check the enable options in your configuration of simpleSAMLphp.'),
+	
+	'title_NORELAYSTATE' => array('en' => 'No RelayState'),
+	'descr_NORELAYSTATE' => array('en' => 'The initiator of this request did not provide an RelayState parameter, that tells where to go next.'),
+	
+	'title_NOSESSION' => array('en' => 'No session found'),
+	'descr_NOSESSION' => array('en' => 'Unfortuneately we could not get your session. This could be because your browser do not support cookies, or cookies is disabled. Or may be your session timed out because you let the browser open for a long time.'),
+	
+	'title_PROCESSASSERTION' =>	array('en' => 'Error processing response from IdP'),
+	'descr_PROCESSASSERTION' =>	array('en' => 'We did not accept the response sent from the Identity Provider.'),
+	
+	'title_PROCESSAUTHNRESPONSE' =>	array('en' => 'Error processing response from Identity Provider'),
+	'descr_PROCESSAUTHNRESPONSE' =>	array('en' => 'This IdP received an authentication response from a service provider, but an error occured when trying to process the response.'),
+	
+	'title_PROCESSAUTHNREQUEST' => array(
+		'en' => 'Error processing request from Service Provider',
+		'no' => 'Feil under prosessering av forespørsel fra SP'),
+	'descr_PROCESSAUTHNREQUEST' => array(
+		'en' => 'This IdP received an authentication request from a service provider, but an error occured when trying to process the request.',
+		'no' => 'Denne IdP-en mottok en autentiseringsforespørsel fra en SP, men en feil oppsto under prosessering av requesten.'),
+	
+	
+	'title_SSOSERVICEPARAMS' =>	array('en' => 'Wrong parameters provided'),
+	'descr_SSOSERVICEPARAMS' =>	array('en' => 'You must either provide a SAML Request message or a RequestID on this interface.'),
+	
+	'title_SLOSERVICEPARAMS' => array('en' => 'No SAML message provided'),
+	'descr_SLOSERVICEPARAMS' => array('en' => 'You accessed the SingleLogoutService interface, but did not provide a SAML LogoutRequest or LogoutResponse.'),
+	
+	'title_ACSPARAMS' => array('en' => 'No SAML response provided'),
+	'descr_ACSPARAMS' => array('en' => 'You accessed the Assertion Consumer Service interface, but did not provide a SAML Authentication Response.'),
+	
+	'title_CASERROR' => array('en' => 'CAS Error'),
+	'descr_CASERROR' => array('en' => 'Error when communicating with the CAS server.'),
 
 );
\ No newline at end of file
diff --git a/dictionaries/frontpage.php b/dictionaries/frontpage.php
new file mode 100644
index 000000000..8640710bf
--- /dev/null
+++ b/dictionaries/frontpage.php
@@ -0,0 +1,67 @@
+<?php
+
+$lang = array(
+
+
+	'intro' => array(
+		'en' => '<strong>Congratulations</strong>, you have successfully installed simpleSAMLphp. This is the start page of your installation, where you will find links to test examples, diagnostics, metadata and even links to relevant documentation.',
+		'no' => '<strong>Gratulerer</strong>, du har nĂĄ installert simpleSAMLphp. Dette er startsiden til din simpleSAMLphp installasjon, hvor du vil finne eksempler, diagnostikk, metadata og til og med lenker til relevant dokumentasjon.',
+	),
+	
+	'useful_links_header' => array(
+		'en' => 'Useful links for your installation',
+		'no' => 'Nyttige lenker for denne installasjonen',
+	),
+	'metadata_header' => array(
+		'en' => 'Metadata',
+		'no' => 'Metadata',
+	),
+	'doc_header' => array(
+		'en' => 'Documentation',
+		'no' => 'Dokumentasjon',
+	),
+	'checkphp' => array(
+		'en' => 'Checking your PHP installation',
+		'no' => 'Sjekker din PHP installasjon',
+	),
+	'about_header' => array(
+		'en' => 'About simpleSAMLphp',
+		'no' => 'Om simpleSAMLphp',
+	),
+	'about_text' => array(
+		'en' => 'This simpleSAMLphp thing is pretty cool, where can I read more about it? You can find more information about <a href="http://rnd.feide.no/simplesamlphp">simpleSAMLphp at the Feide RnD blog</a> over at <a href="http://uninett.no">UNINETT</a>.',
+		'no' => 'Yey! simpleSAMLphp virker jammen kult, hvor kan jeg finne ut mer om det? Du kan lese mer om simpleSAMLphp pĂĄ <a href="http://rnd.feide.no/simplesamlphp">simpleSAMLphp sin hjemmeside</a>.',
+	),
+	
+	'required' => array(
+		'en' => 'Required',
+		'no' => 'PĂĄkrevd',
+	),
+	'required_ldap' => array(
+		'en' => 'Required for LDAP',
+		'no' => 'PĂĄkrevd for LDAP',
+	),
+	'required_radius' => array(
+		'en' => 'Required for Radius',
+		'no' => 'PĂĄkrevd for Radius',
+	),
+	'optional' => array(
+		'en' => 'Optional',
+		'no' => 'Valgfritt',
+	),
+	'reccomended' => array(
+		'en' => 'Reccomended',
+		'no' => 'Anbefalt',
+	),	
+	
+	'warnings' => array(
+		'en' => 'Warnings',
+		'no' => 'Advarsler',
+	),
+	
+	'warnings_https' => array(
+		'en' => '<strong>You are not using HTTPS</strong> - encrypted communication with the user. Using simpleSAMLphp will works perfectly fine on HTTP for test purposes, but if you will be using simpleSAMLphp in a production environment, you should be running it on HTTPS. [ <a href="http://rnd.feide.no/content/simplesamlphp-maintenance-and-configuration">read more about simpleSAMLphp maintenance</a> ]',
+		'no' => '<strong>Du benytter ikke HTTPS</strong> - kryptert kommunikasjon med brukeren. Det vil fungere utmerket å benytte simpleSAMLphp uten HTTPS til testformål, men dersom du skal bruke simpleSAMLphp i et produksjonsmiljø, vil vi sterkt anbefale å skru på sikker kommunikasjon med HTTPS. [ <a href="http://rnd.feide.no/content/simplesamlphp-maintenance-and-configuration">les mer i dokumentet: simpleSAMLphp maintenance</a> ]',
+	),
+	
+);
\ No newline at end of file
diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php
index d9faf7f53..9e8fd50ca 100644
--- a/lib/SimpleSAML/XHTML/Template.php
+++ b/lib/SimpleSAML/XHTML/Template.php
@@ -6,7 +6,7 @@ require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSA
 /**
  * A minimalistic XHTML PHP based template system implemented for simpleSAMLphp.
  *
- * @author Andreas Ĺkre Solberg, UNINETT AS. <andreas.solberg@uninett.no>
+ * @author Andreas Ă…kre Solberg, UNINETT AS. <andreas.solberg@uninett.no>
  * @package simpleSAMLphp
  * @version $Id$
  */
@@ -52,11 +52,15 @@ class SimpleSAML_XHTML_Template {
 		
 		// Language is not set, and we get the default language from the configuration.
 		} else {
-			return $this->configuration->getValue('language.default');
+			return $this->getDefaultLanguage('language.default');
 		}
 		
 		return $this->language;
 	}
+	
+	private function getDefaultLanguage() {
+		return $this->configuration->getValue('language.default', 'en');
+	}
 
 	private function getLanguageList() {
 		$availableLanguages = $this->configuration->getValue('language.available');
@@ -92,11 +96,73 @@ class SimpleSAML_XHTML_Template {
 		include($filebase . $file);
 	}
 	
+	
+	/**
+	 * Include text in the current language.
+	 *
+	 * @param $tag				A name tag of the string that should be returned.
+	 * @param $fallbacktag		If set to true and string was not found in any languages, return the tag it self.
+	 * @param $fallbackdefault 	If not found in selected language fallback to default language.
+	 * @param $replacements		An associative array of keys that should be replaced with values in the translated string.
+	 * @param $striptags		Should HTML tags be stripped from the translation
+	 */
+	private function t($tag, $fallbacktag = true, $fallbackdefault = true, $replacements = null, $striptags = false) {
+		
+		if (empty($this->langtext) || !is_array($this->langtext)) {
+			SimpleSAML_Logger::error('Template: No language text loaded. Looking up [' . $tag . ']');
+			return $this->t_not_translated($tag, $fallbacktag);
+		}
+
+#		echo 'LANGTEXT: ';
+#		print_r($this->langtext);
+
+		$selected_language = $this->getLanguage();
+		$default_language  = $this->getDefaultLanguage();
+		
+		if (array_key_exists($tag, $this->langtext) ) {
+			
+			/**
+			 * Look up translation of tag in the selected language
+			 */
+			if (array_key_exists($selected_language, $this->langtext[$tag])) {
+				return $this->langtext[$tag][$selected_language];
+
+			/**
+			 * Look up translation of tag in the default language, only if fallbackdefault = true (method parameter)
+			 */				
+			} elseif($fallbackdefault && array_key_exists($default_language, $this->langtext[$tag])) {
+				SimpleSAML_Logger::error('Template: Looking up [' . $tag . ']: not found in language [' . $selected_language . '] using default [' . $default_language . '].');
+				return $this->langtext[$tag][$default_language];
+				
+			}
+		}
+		SimpleSAML_Logger::error('Template: Looking up [' . $tag . ']: not translated at all.');
+		return $this->t_not_translated($tag, $fallbacktag); 
+		
+	}
+	
+	/**
+	 * Return the string that should be used when no translation was found.
+	 *
+	 * @param $tag				A name tag of the string that should be returned.
+	 * @param $fallbacktag		If set to true and string was not found in any languages, return 
+	 * 					the tag it self. If false return null.
+	 */
+	private function t_not_translated($tag, $fallbacktag) {
+		if ($fallbacktag) {
+			return 'not translated (' . $tag . ')';
+		} else {
+			return null;
+		}
+	}
+	
+	
 	/**
 	 * Include language file from the dictionaries directory.
 	 */
 	private function includeLanguageFile($file) {
 		$filebase = $this->configuration->getPathValue('dictionarydir');
+		SimpleSAML_Logger::info('Template: Loading [' . $filebase . $file . ']');
 		
 		if (!file_exists($filebase . $file)) {
 			SimpleSAML_Logger::error($_SERVER['PHP_SELF'].' - Template: Could not find template file [' . $this->template . '] at [' . $filebase . $file . ']');
@@ -104,33 +170,37 @@ class SimpleSAML_XHTML_Template {
 		}
 		include($filebase . $file);
 		if (isset($lang)) {
-		
-			if (array_key_exists($this->getLanguage(), $lang) )  {
-				foreach ($lang[$this->getLanguage()] AS $key => $text) {
-					$this->data[$key] = $text;
-				}
-			} elseif (array_key_exists($this->configuration->getValue('language.default', 'en'), $lang) ) {
-				foreach ($lang[$this->configuration->getValue('language.default')] AS $key => $text) {
-					$this->data[$key] = $text;
-				}
+			if (is_array($this->langtext)) {
+				SimpleSAML_Logger::info('Template: Merging language array. Loading [' . $file . ']');
+				$this->langtext = array_merge($this->langtext, $lang);
+			} else {
+				SimpleSAML_Logger::info('Template: Setting new language array. Loading [' . $file . ']');
+				$this->langtext = $lang;
 			}
 		}
+		
+
+		
 	}
 
 	/**
 	 * Show the template to the user.
 	 */
 	public function show() {
-		$data = $this->data;
-		$filename = $this->configuration->getPathValue('templatedir') . $this->getLanguage() . '/' . 
-			$this->template;
+	
+		
 
-		if (!file_exists($filename)) {
-				
-			$filename = $this->configuration->getPathValue('templatedir') .  
-				$this->configuration->getValue('language.default') . '/' . $this->template;
+		$filename  = $this->configuration->getPathValue('templatedir') . 
+			$this->configuration->getPathValue('template.use') . '/' . $this->template;
 
 
+		if (!file_exists($filename)) {
+			SimpleSAML_Logger::warning($_SERVER['PHP_SELF'].' - Template: Could not find template file [' . $this->template . '] at [' . $filename . '] - now trying the base template');
+			
+			$filename = $this->configuration->getPathValue('templatedir') . 
+				$this->configuration->getPathValue('template.base') . '/' . $this->template;
+			
+
 			if (!file_exists($filename)) {
 				SimpleSAML_Logger::critical($_SERVER['PHP_SELF'].' - Template: Could not find template file [' . $this->template . '] at [' . $filename . ']');
 			
diff --git a/templates/default/en/admin-metadatalist.php b/templates/default/en/admin-metadatalist.php
index c02f4284c..ae58901a6 100644
--- a/templates/default/en/admin-metadatalist.php
+++ b/templates/default/en/admin-metadatalist.php
@@ -96,23 +96,23 @@
 		}
 		
 		
-		if (array_key_exists('metadata.saml20-sp-hosted', $data)) 
-			showEntry('SAML 2.0 Service Provider (Hosted)', $data['metadata.saml20-sp-hosted'], $this->data['baseurlpath']);
-		if (array_key_exists('metadata.saml20-sp-remote', $data)) 
-			showEntry('SAML 2.0 Service Provider (Remote)', $data['metadata.saml20-sp-remote'], $this->data['baseurlpath']);
-		if (array_key_exists('metadata.saml20-idp-hosted', $data)) 
-			showEntry('SAML 2.0 Identity Provider (Hosted)', $data['metadata.saml20-idp-hosted'], $this->data['baseurlpath']);
-		if (array_key_exists('metadata.saml20-idp-remote', $data)) 
-			showEntry('SAML 2.0 Identity Provider (Remote)', $data['metadata.saml20-idp-remote'], $this->data['baseurlpath']);
+		if (array_key_exists('metadata.saml20-sp-hosted', $this->data)) 
+			showEntry('SAML 2.0 Service Provider (Hosted)', $this->data['metadata.saml20-sp-hosted'], $this->data['baseurlpath']);
+		if (array_key_exists('metadata.saml20-sp-remote', $this->data)) 
+			showEntry('SAML 2.0 Service Provider (Remote)', $this->data['metadata.saml20-sp-remote'], $this->data['baseurlpath']);
+		if (array_key_exists('metadata.saml20-idp-hosted', $this->data)) 
+			showEntry('SAML 2.0 Identity Provider (Hosted)', $this->data['metadata.saml20-idp-hosted'], $this->data['baseurlpath']);
+		if (array_key_exists('metadata.saml20-idp-remote', $this->data)) 
+			showEntry('SAML 2.0 Identity Provider (Remote)', $this->data['metadata.saml20-idp-remote'], $this->data['baseurlpath']);
 
-		if (array_key_exists('metadata.shib13-sp-hosted', $data)) 
-			showEntry('Shib 1.3 Service Provider (Hosted)', $data['metadata.shib13-sp-hosted'], $this->data['baseurlpath']);
-		if (array_key_exists('metadata.shib13-sp-remote', $data)) 
-			showEntry('Shib 1.3 Service Provider (Remote)', $data['metadata.shib13-sp-remote'], $this->data['baseurlpath']);
-		if (array_key_exists('metadata.shib13-idp-hosted', $data)) 
-			showEntry('Shib 1.3 Identity Provider (Hosted)', $data['metadata.shib13-idp-hosted'], $this->data['baseurlpath']);
-		if (array_key_exists('metadata.shib13-idp-remote', $data)) 
-			showEntry('Shib 1.3 Identity Provider (Remote)', $data['metadata.shib13-idp-remote'], $this->data['baseurlpath']);
+		if (array_key_exists('metadata.shib13-sp-hosted', $this->data)) 
+			showEntry('Shib 1.3 Service Provider (Hosted)', $this->data['metadata.shib13-sp-hosted'], $this->data['baseurlpath']);
+		if (array_key_exists('metadata.shib13-sp-remote', $this->data)) 
+			showEntry('Shib 1.3 Service Provider (Remote)', $this->data['metadata.shib13-sp-remote'], $this->data['baseurlpath']);
+		if (array_key_exists('metadata.shib13-idp-hosted', $this->data)) 
+			showEntry('Shib 1.3 Identity Provider (Hosted)', $this->data['metadata.shib13-idp-hosted'], $this->data['baseurlpath']);
+		if (array_key_exists('metadata.shib13-idp-remote', $this->data)) 
+			showEntry('Shib 1.3 Identity Provider (Remote)', $this->data['metadata.shib13-idp-remote'], $this->data['baseurlpath']);
 
 		
 		?>
diff --git a/templates/default/en/consent.php b/templates/default/en/consent.php
index 716e12fd9..7e548321b 100644
--- a/templates/default/en/consent.php
+++ b/templates/default/en/consent.php
@@ -3,12 +3,12 @@
 
 	<div id="content">
 
-		<p>You are about to login to the service <strong><?php echo htmlspecialchars($data['sp_name']); ?></strong>. In the login proccess, the identity provider will send attributes containing information about your identity to this service. Do you accept this?</p>
+		<p>You are about to login to the service <strong><?php echo htmlspecialchars($this->data['sp_name']); ?></strong>. In the login proccess, the identity provider will send attributes containing information about your identity to this service. Do you accept this?</p>
 		
 
 
 
-		<form action="<?php echo htmlspecialchars($data['consenturl']); ?>">
+		<form action="<?php echo htmlspecialchars($this->data['consenturl']); ?>">
 			<input type="submit" value="Yes" />
 			<input type="hidden" name="consent" value="<?php echo htmlspecialchars($this->data['consent_cookie']); ?>" />
 			<input type="hidden" name="RequestID" value="<?php echo htmlspecialchars($this->data['requestid']); ?>" />
@@ -28,7 +28,7 @@
 <?php
 
 
-			$attributes = $data['attributes'];
+			$attributes = $this->data['attributes'];
 			foreach ($attributes AS $name => $value) {
 					
 				if (isset($this->data['attribute_' . htmlspecialchars(strtolower($name)) ])) {
diff --git a/templates/default/en/error.php b/templates/default/en/error.php
index 39a6c2709..d9691a48c 100644
--- a/templates/default/en/error.php
+++ b/templates/default/en/error.php
@@ -1,5 +1,5 @@
 <?php 
-	$this->data['header'] = 'simpleSAMLphp error';
+	$this->data['header'] = $this->t('error_header');
 	$this->data['icon'] = 'bomb_l.png';
 	$this->includeAtTemplateBase('includes/header.php'); 
 ?>
@@ -7,12 +7,12 @@
 <div id="content">
 
 	<h2><?php 
-		echo (isset($this->data['title_' . $this->data['errorcode']]) ? $this->data['title_' . $this->data['errorcode']] : 'simpleSAMLphp error'); 
+		echo $this->t('title_' . $this->data['errorcode']); 
 	?></h2>
 
 <?php
-if(array_key_exists('descr_'  . $this->data['errorcode'], $this->data)) {
-	echo '<p>' . $this->data['descr_' . $this->data['errorcode']] . '</p>';
+if($this->t('descr_' . $this->data['errorcode'])) {
+	echo $this->t('descr_' . $this->data['errorcode']);
 }
 ?>
 
@@ -21,8 +21,8 @@ if(array_key_exists('descr_'  . $this->data['errorcode'], $this->data)) {
 if(array_key_exists('trackid', $this->data)) {
 ?>
 	<div class="trackidtext">
-		If you report this error, please also report this tracking ID which makes it possible to locate your session in the logs which are available to the system administrator: 
-			<span class="trackid"><?php echo $this->data['trackid']; ?></span>
+		<?php echo $this->t('report_trackid'); ?>
+		<span class="trackid"><?php echo $this->data['trackid']; ?></span>
 	</div>
 <?php
 }
@@ -33,8 +33,8 @@ if(array_key_exists('trackid', $this->data)) {
 /* Print out exception only if the exception is available. */
 if (array_key_exists('showerrors', $this->data) && $this->data['showerrors']) {
 ?>
-		<h2>Debug information</h2>
-		<p>The debug information below may be interesting for the administrator / help desk:</p>
+		<h2><?php echo $this->t('debuginfo_header'); ?></h2>
+		<p><?php echo $this->t('debuginfo_text'); ?></p>
 		
 		<div style="border: 1px solid #eee; padding: 1em; font-size: x-small">
 			<p style="margin: 1px"><?php echo htmlentities($this->data['exceptionmsg']); ?></p>
@@ -51,14 +51,14 @@ if (array_key_exists('showerrors', $this->data) && $this->data['showerrors']) {
 if (!empty($this->data['errorreportaddress'])) {
 ?>
 
-	<h2>Report errors</h2>		
+	<h2><?php echo $this->t('report_header'); ?></h2>
 	<form action="<?php echo $this->data['errorreportaddress']; ?>" method="post">
 	
-		<p>Optionally enter your email address, for the administrators to be able contact you for further questions about your issue:			</p>
-			<p>E-mail address: <input type="text" size="25" name="email" value="" />
+		<p><?php echo $this->t('report_text'); ?></p>
+			<p><?php echo $this->t('report_email'); ?> <input type="text" size="25" name="email" value="" />
 	
 		<p>
-		<textarea style="width: 300px; height: 100px" name="text">Explain what you did to get this error...</textarea>
+		<textarea style="width: 300px; height: 100px" name="text"><?php echo $this->t('report_explain'); ?></textarea>
 		</p><p>
 		<input type="hidden" name="action" value="error" />
 		<input type="hidden" name="techemail" value="<?php echo $this->data['email']; ?>" />
@@ -67,15 +67,16 @@ if (!empty($this->data['errorreportaddress'])) {
 		<input type="hidden" name="exceptionmsg" value="<?php echo urlencode(base64_encode($this->data['exceptionmsg'])); ?>" />
 		<input type="hidden" name="exceptiontrace" value="<?php echo urlencode(base64_encode($this->data['exceptiontrace'])); ?>" />
 		
-		<input type="submit" name="send" value="Send error report" />
+		<input type="submit" name="send" value="<?php echo $this->t('report_submit'); ?>" />
 		</p>
 	</form>
 <?php
 }
 ?>
 
-<h2 style="clear: both">How to get help</h2>
+<h2 style="clear: both"><?php echo $this->t('howto_header'); ?></h2>
+
+<p><?php echo $this->t('howto_text'); ?></p>
 
-<p>This error probably is due to some unexpected behaviour or to misconfiguration of simpleSAMLphp. Contact the administrator of this login service, and send them the error message above.</p>
 
 <?php $this->includeAtTemplateBase('includes/footer.php'); ?>
\ No newline at end of file
diff --git a/templates/default/en/frontpage.php b/templates/default/en/frontpage.php
index 1c1b1af9f..f02de97fc 100644
--- a/templates/default/en/frontpage.php
+++ b/templates/default/en/frontpage.php
@@ -10,8 +10,8 @@
 
 <?php
 
-$icon_enabled  = '<img src="/' . $data['baseurlpath'] . 'resources/icons/accept.png" alt="enabled" />';
-$icon_disabled = '<img src="/' . $data['baseurlpath'] . 'resources/icons/delete.png" alt="disabled" />';
+$icon_enabled  = '<img src="/' . $this->data['baseurlpath'] . 'resources/icons/accept.png" alt="enabled" />';
+$icon_disabled = '<img src="/' . $this->data['baseurlpath'] . 'resources/icons/delete.png" alt="disabled" />';
 ?>
 
 <tr class="<?php echo $this->data['enablematrix']['saml20-sp'] ? 'enabled' : 'disabled'; ?>"><td>SAML 2.0 SP</td>
@@ -30,9 +30,9 @@ $icon_disabled = '<img src="/' . $data['baseurlpath'] . 'resources/icons/delete.
 </div>
 
 
-		<p><strong>Congratulations</strong>, you have successfully installed simpleSAMLphp. This is the start page of your installation, where you will find links to test examples, diagnostics, metadata and even links to relevant documentation.</p>
+		<p><?php echo $this->t('intro'); ?></p>
 		
-		<h2>Useful links for your installation</h2>
+		<h2><?php echo $this->t('useful_links_header'); ?></h2>
 			<ul>
 			<?php
 			
@@ -43,7 +43,7 @@ $icon_disabled = '<img src="/' . $data['baseurlpath'] . 'resources/icons/delete.
 			</ul>
 
 		
-		<h2>Metadata</h2>
+		<h2><?php echo $this->t('metadata_header'); ?></h2>
 			<ul>
 			<?php
 			
@@ -53,7 +53,7 @@ $icon_disabled = '<img src="/' . $data['baseurlpath'] . 'resources/icons/delete.
 			?>
 			</ul>
 		
-		<h2>Documentation</h2>
+		<h2><?php echo $this->t('doc_header'); ?></h2>
 			<ul>
 			<?php
 			
@@ -66,15 +66,15 @@ $icon_disabled = '<img src="/' . $data['baseurlpath'] . 'resources/icons/delete.
 		<?php
 			if (array_key_exists('warnings', $this->data) && is_array($this->data['warnings']) && !empty($this->data['warnings'])) {
 
-				echo '<h2>Warnings</h2>';
+				echo '<h2>' . $this->t('warnings') . '</h2>';
 		
 				foreach($this->data['warnings'] AS $warning) {
-					echo '<div class="caution">' . $warning . '</div>';
+					echo '<div class="caution">' . $this->t($warning) . '</div>';
 				}
 			}
 		?>
 		
-		<h2>Checking your PHP installation</h2>
+		<h2><?php echo $this->t('checkphp'); ?></h2>
 		
 		
 		<div class="enablebox">
@@ -82,13 +82,13 @@ $icon_disabled = '<img src="/' . $data['baseurlpath'] . 'resources/icons/delete.
 		
 		<?php
 		
-		$icon_enabled  = '<img src="/' . $data['baseurlpath'] . 'resources/icons/accept.png" alt="enabled" />';
-		$icon_disabled = '<img src="/' . $data['baseurlpath'] . 'resources/icons/delete.png" alt="disabled" />';
+		$icon_enabled  = '<img src="/' . $this->data['baseurlpath'] . 'resources/icons/accept.png" alt="enabled" />';
+		$icon_disabled = '<img src="/' . $this->data['baseurlpath'] . 'resources/icons/delete.png" alt="disabled" />';
 		
 		
 		foreach ($this->data['funcmatrix'] AS $func) {
 			echo '<tr class="' . ($func['enabled'] ? 'enabled' : 'disabled') . '"><td>' . ($func['enabled'] ? $icon_enabled : $icon_disabled) . '</td>
-			<td>' . $func['required'] . '</td><td>' . $func['descr'] . '</td></tr>';
+			<td>' . $this->t($func['required']) . '</td><td>' . $func['descr'] . '</td></tr>';
 		}
 		
 		?>
@@ -97,7 +97,7 @@ $icon_disabled = '<img src="/' . $data['baseurlpath'] . 'resources/icons/delete.
 		</div>
 		
 
-	<h2>About simpleSAMLphp</h2>
-		<p>Hey! This simpleSAMLphp thing is pretty cool, where can I read more about it? You can find more information about <a href="http://rnd.feide.no/simplesamlphp">simpleSAMLphp at the Feide RnD blog</a> over at <a href="http://uninett.no">UNINETT</a>.</p>
+	<h2><?php echo $this->t('about_header'); ?></h2>
+		<p><?php echo $this->t('about_text'); ?></p>
 		
 <?php $this->includeAtTemplateBase('includes/footer.php'); ?>
\ No newline at end of file
diff --git a/templates/default/en/httpredirect-debug.php b/templates/default/en/httpredirect-debug.php
index c06111a8b..7b921779c 100644
--- a/templates/default/en/httpredirect-debug.php
+++ b/templates/default/en/httpredirect-debug.php
@@ -11,9 +11,9 @@
 	
 		<p>You are about to send a SAML message using HTTP REDIRECT. Here is the message:</p>
 		
-		<pre style="overflow: scroll; border: 1px solid #eee"><?php echo $data['message']; ?></pre>
+		<pre style="overflow: scroll; border: 1px solid #eee"><?php echo $this->data['message']; ?></pre>
 		
-		<p>[ <a id="sendlink" href="<?php echo htmlentities($data['url']); ?>">send SAML message</a> ]</p>
+		<p>[ <a id="sendlink" href="<?php echo htmlentities($this->data['url']); ?>">send SAML message</a> ]</p>
 		<script type="text/javascript">
 			document.getElementById('sendlink').focus();
 		</script>
diff --git a/templates/default/en/login-ldapmulti.php b/templates/default/en/login-ldapmulti.php
index 6f811f27c..478d9dd85 100644
--- a/templates/default/en/login-ldapmulti.php
+++ b/templates/default/en/login-ldapmulti.php
@@ -6,12 +6,12 @@
 	
 	<div id="content">
 	
-		<?php if (isset($data['error'])) { ?>
+		<?php if (isset($this->data['error'])) { ?>
 		<div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"
-		<img src="/<?php echo $data['baseurlpath']; ?>resources/icons/bomb.png" style="float: left; margin: 15px " />
+		<img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/bomb.png" style="float: left; margin: 15px " />
 		<h2>What you entered was not accepted!</h2>
 		
-		<p><?php echo htmlspecialchars($data['error']); ?> </p>
+		<p><?php echo htmlspecialchars($this->data['error']); ?> </p>
 		</div>
 		<?php } ?>
 	
@@ -25,17 +25,17 @@
 
 		<table>
 			<tr>
-				<td rowspan="3"><img src="/<?php echo $data['baseurlpath']; ?>resources/icons/pencil.png" /></td>
+				<td rowspan="3"><img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/pencil.png" /></td>
 				<td style="padding: .3em;">Username</td>
 				<td><input type="text" tabindex="1" name="username" 
-					<?php if (isset($data['username'])) {
-						echo 'value="' . htmlspecialchars($data['username']) . '"';
+					<?php if (isset($this->data['username'])) {
+						echo 'value="' . htmlspecialchars($this->data['username']) . '"';
 					} ?> /></td>
 
 					
 				<td style="padding: .4em;" rowspan="3">
 					<input type="submit" tabindex="3" value="Login" />
-					<input type="hidden" name="RelayState" value="<?php echo htmlspecialchars($data['relaystate']); ?>" />
+					<input type="hidden" name="RelayState" value="<?php echo htmlspecialchars($this->data['relaystate']); ?>" />
 				</td>
 			</tr>
 			
@@ -44,9 +44,9 @@
 				<td><select name="org" tabindex="2">
 					<?php
 					
-					foreach ($data['ldapconfig'] AS $key => $entry) {
+					foreach ($this->data['ldapconfig'] AS $key => $entry) {
 						echo '<option ' .
-							($key == $data['org'] ? 'selected="selected" ' : '')
+							($key == $this->data['org'] ? 'selected="selected" ' : '')
 							. 'value="' . htmlspecialchars($key) . '">' . htmlspecialchars($entry['description']) . '</option>';
 					}
 					
diff --git a/templates/default/en/login.php b/templates/default/en/login.php
index ef538a875..ff4ae8bae 100644
--- a/templates/default/en/login.php
+++ b/templates/default/en/login.php
@@ -5,12 +5,12 @@
 
 	<div id="content">
 	
-		<?php if (isset($data['error'])) { ?>
+		<?php if (isset($this->data['error'])) { ?>
 		<div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"
-		<img src="/<?php echo $data['baseurlpath']; ?>resources/icons/bomb.png" style="float: left; margin: 15px " />
+		<img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/bomb.png" style="float: left; margin: 15px " />
 		<h2>What you entered was not accepted!</h2>
 		
-		<p><?php echo htmlspecialchars($data['error']); ?> </p>
+		<p><?php echo htmlspecialchars($this->data['error']); ?> </p>
 		</div>
 		<?php } ?>
 	
@@ -24,15 +24,15 @@
 
 		<table>
 			<tr>
-				<td rowspan="2"><img src="/<?php echo $data['baseurlpath']; ?>resources/icons/pencil.png" /></td>
+				<td rowspan="2"><img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/pencil.png" /></td>
 				<td style="padding: .3em;">Username</td>
 				<td><input type="text" tabindex="1" name="username" 
-					<?php if (isset($data['username'])) {
-						echo 'value="' . htmlspecialchars($data['username']) . '"';
+					<?php if (isset($this->data['username'])) {
+						echo 'value="' . htmlspecialchars($this->data['username']) . '"';
 					} ?> /></td>
 				<td style="padding: .4em;" rowspan="2">
 					<input type="submit" tabindex="3" value="Login" />
-					<input type="hidden" name="RelayState" value="<?php echo htmlspecialchars($data['relaystate']); ?>" />
+					<input type="hidden" name="RelayState" value="<?php echo htmlspecialchars($this->data['relaystate']); ?>" />
 				</td>
 			</tr>
 			<tr>
diff --git a/templates/default/en/metadata.php b/templates/default/en/metadata.php
index 7b6ff67fb..f2911935b 100644
--- a/templates/default/en/metadata.php
+++ b/templates/default/en/metadata.php
@@ -2,24 +2,24 @@
 
 	<div id="content">
 
-		<h2><?php if (isset($data['header'])) { echo $data['header']; } else { echo "Some error occured"; } ?></h2>
+		<h2><?php if (isset($this->data['header'])) { echo $this->data['header']; } else { echo "Some error occured"; } ?></h2>
 		
 		<p>Here is SAML 2.0 metadata that simpleSAMLphp has generated for you. You may send this SAML 2.0 Metadata document to trusted partners to setup a trusted federation.</p>
 		
-		<?php if (isset($data['metaurl'])) { ?>
-			<p>You can <a href="<?php echo htmlspecialchars($data['metaurl']); ?>">get the metadata xml on a dedicated URL</a>:<br />
-			<input type="text" style="width: 90%" value="<?php echo htmlspecialchars($data['metaurl']); ?>" /></p>
+		<?php if (isset($this->data['metaurl'])) { ?>
+			<p>You can <a href="<?php echo htmlspecialchars($this->data['metaurl']); ?>">get the metadata xml on a dedicated URL</a>:<br />
+			<input type="text" style="width: 90%" value="<?php echo htmlspecialchars($this->data['metaurl']); ?>" /></p>
 		<?php } ?>
 		<h2>Metadata</h2>
 		
 		<p>In SAML 2.0 Meta data XML format:</p>
 		
-		<pre class="metadatabox"><?php echo $data['metadata']; ?></pre>
+		<pre class="metadatabox"><?php echo $this->data['metadata']; ?></pre>
 		
 		
 		<p>In simpleSAMLphp flat file format - use this if you are using a simpleSAMLphp entity on the other side:</p>
 		
-		<pre class="metadatabox"><?php echo $data['metadataflat']; ?></pre>
+		<pre class="metadatabox"><?php echo $this->data['metadataflat']; ?></pre>
 		
 		
 
@@ -44,10 +44,10 @@
 					</p>
 					
 					<input type="hidden" name="action" value="metadata" />
-					<input type="hidden" name="metadata" value="<?php echo urlencode(base64_encode($data['metadata'])); ?>" />
+					<input type="hidden" name="metadata" value="<?php echo urlencode(base64_encode($this->data['metadata'])); ?>" />
 					<input type="hidden" name="techemail" value="<?php echo $this->data['techemail']; ?>" />
 					<input type="hidden" name="version" value="<?php echo $this->data['version']; ?>" />
-					<input type="hidden" name="defaultidp" value="<?php echo htmlspecialchars($data['defaultidp']); ?>" />
+					<input type="hidden" name="defaultidp" value="<?php echo htmlspecialchars($this->data['defaultidp']); ?>" />
 					<input type="submit" name="send" value="Send my metadata to <?php echo $this->data['federationname']; ?>" />
 					
 				</form>
diff --git a/templates/default/en/openid-about.php b/templates/default/en/openid-about.php
index 7fc99432b..c1bd39aa2 100644
--- a/templates/default/en/openid-about.php
+++ b/templates/default/en/openid-about.php
@@ -3,9 +3,9 @@
 	
 	<div id="content">
 
-		<?php if (isset($data['header'])) { echo '<h2>' . $data['header'] . '</h2>'; } ?>
+		<?php if (isset($this->data['header'])) { echo '<h2>' . $this->data['header'] . '</h2>'; } ?>
 		
-		<p>[ <a href="/<?php echo $data['baseurlpath']; ?>/openid/provider/server.php/sites">List of trusted sites</a> |
+		<p>[ <a href="/<?php echo $this->data['baseurlpath']; ?>/openid/provider/server.php/sites">List of trusted sites</a> |
 		About simpleSAMLphp OpenID ]</p>
 
 		
@@ -17,18 +17,18 @@
 		  Insert the following markup into the <code>&lt;head&gt;</code> of the HTML
 		  document at that URL:
 		</p>
-<pre>&lt;link rel="openid.server" href="<?php echo htmlspecialchars($data['openidserver']); ?>" /&gt;
-&lt;link rel="openid.delegation" href="<?php echo htmlspecialchars($data['openiddelegation']); ?>" /&gt;
+<pre>&lt;link rel="openid.server" href="<?php echo htmlspecialchars($this->data['openidserver']); ?>" /&gt;
+&lt;link rel="openid.delegation" href="<?php echo htmlspecialchars($this->data['openiddelegation']); ?>" /&gt;
 		
 		</pre>
 		
 		
 		<p><?php
 			
-			if (isset($data['userid'])) {
-				echo 'You are now logged in as ' . htmlspecialchars($data['userid']);
+			if (isset($this->data['userid'])) {
+				echo 'You are now logged in as ' . htmlspecialchars($this->data['userid']);
 			} else {
-				echo '<a href="' . htmlspecialchars($data['initssourl']) . '">Login</a>';
+				echo '<a href="' . htmlspecialchars($this->data['initssourl']) . '">Login</a>';
 			}
 		
 		?>
diff --git a/templates/default/en/openid-sites.php b/templates/default/en/openid-sites.php
index 7a09d5f5e..a08cd7fe2 100644
--- a/templates/default/en/openid-sites.php
+++ b/templates/default/en/openid-sites.php
@@ -3,27 +3,27 @@
 	
 	<div id="content">
 
-		<?php if (isset($data['header'])) { echo '<h2>' . $data['header'] . '</h2>'; } ?>
+		<?php if (isset($this->data['header'])) { echo '<h2>' . $this->data['header'] . '</h2>'; } ?>
 		
 		
 		<p>[ List of trusted sites |
-		<a href="/<?php echo $data['baseurlpath']; ?>/openid/provider/server.php/about">About simpleSAMLphp OpenID</a> ]</p>
+		<a href="/<?php echo $this->data['baseurlpath']; ?>/openid/provider/server.php/about">About simpleSAMLphp OpenID</a> ]</p>
 
 		
 		<p>These decisions have been remembered for this session. All decisions will be forgotten when the session ends.</p>
 		
 		
-		<?php if (isset($data['sites'])) { ?>
+		<?php if (isset($this->data['sites'])) { ?>
 		
 			<div class="form">
-				<form method="post" action="<?php echo '/' . $data['baseurlpath'] . 'openid/provider/server.php/sites'; ?>">
+				<form method="post" action="<?php echo '/' . $this->data['baseurlpath'] . 'openid/provider/server.php/sites'; ?>">
 					<table>
 						<tbody>
 							<?php 
 							
 							    $trusted_sites = array();
 								$untrusted_sites = array();
-								foreach ($data['sites'] as $site => $trusted) {
+								foreach ($this->data['sites'] as $site => $trusted) {
 									if ($trusted) {
 										$trusted_sites[] = $site;
 									} else {
diff --git a/templates/default/en/openid-trust.php b/templates/default/en/openid-trust.php
index 92662c7b7..583416f07 100644
--- a/templates/default/en/openid-trust.php
+++ b/templates/default/en/openid-trust.php
@@ -3,16 +3,16 @@
 	
 	<div id="content">
 
-		<?php if (isset($data['header'])) { echo '<h2>' . $data['header'] . '</h2>'; } ?>
+		<?php if (isset($this->data['header'])) { echo '<h2>' . $this->data['header'] . '</h2>'; } ?>
 		
 		
-		<p>[ <a href="/<?php echo $data['baseurlpath']; ?>/openid/provider/server.php/sites">List of trusted sites</a> |
-		<a href="/<?php echo $data['baseurlpath']; ?>/openid/provider/server.php/about">About simpleSAMLphp OpenID</a> ]</p>
+		<p>[ <a href="/<?php echo $this->data['baseurlpath']; ?>/openid/provider/server.php/sites">List of trusted sites</a> |
+		<a href="/<?php echo $this->data['baseurlpath']; ?>/openid/provider/server.php/about">About simpleSAMLphp OpenID</a> ]</p>
 		
 		<div class="form">
-		  <p>Do you wish to confirm your identity URL (<code><?php echo htmlspecialchars($data['openidurl']); ?></code>)
-		  	with <code><?php echo $data['siteurl']; ?></code>?</p>
-		  <form method="post" action="<?php echo $data['trusturl']; ?>">
+		  <p>Do you wish to confirm your identity URL (<code><?php echo htmlspecialchars($this->data['openidurl']); ?></code>)
+		  	with <code><?php echo $this->data['siteurl']; ?></code>?</p>
+		  <form method="post" action="<?php echo $this->data['trusturl']; ?>">
 			<input type="checkbox" name="remember" value="on" id="remember"><label
 				for="remember">Remember this decision</label>
 			<br />
diff --git a/templates/default/en/post-debug.php b/templates/default/en/post-debug.php
index b76680d62..79d4cac72 100644
--- a/templates/default/en/post-debug.php
+++ b/templates/default/en/post-debug.php
@@ -13,9 +13,9 @@
 	
 		<p>You are about to send a SAML response back to the service. Hit the send response button to continue.</p>
 		
-		<form method="post" action="<?php echo htmlspecialchars($data['destination']); ?>">
-			<input type="hidden" name="SAMLResponse" value="<?php echo htmlspecialchars($data['response']); ?>" />
-			<input type="hidden" name="<?php echo htmlspecialchars($data['RelayStateName']); ?>" value="<?php echo htmlspecialchars($data['RelayState']); ?>" />
+		<form method="post" action="<?php echo htmlspecialchars($this->data['destination']); ?>">
+			<input type="hidden" name="SAMLResponse" value="<?php echo htmlspecialchars($this->data['response']); ?>" />
+			<input type="hidden" name="<?php echo htmlspecialchars($this->data['RelayStateName']); ?>" value="<?php echo htmlspecialchars($this->data['RelayState']); ?>" />
 			<input type="submit" value="Submit the response to the service" id="sendbutton" />
 		</form>
 
@@ -27,6 +27,6 @@
 		
 		<p>As you are in debug mode you are lucky to see the content of the response you are sending:</p>
 		
-		<pre style="overflow: scroll; border: 1px solid #eee"><?php echo $data['responseHTML']; ?></pre>
+		<pre style="overflow: scroll; border: 1px solid #eee"><?php echo $this->data['responseHTML']; ?></pre>
 
 <?php $this->includeAtTemplateBase('includes/footer.php'); ?>
\ No newline at end of file
diff --git a/templates/default/en/post.php b/templates/default/en/post.php
index c08bcd4ff..9512b0f74 100644
--- a/templates/default/en/post.php
+++ b/templates/default/en/post.php
@@ -11,9 +11,9 @@
 		<p><strong>Note:</strong> Since your browser does not support JavaScript, you must press the button below once to proceed.</p> 
 	</noscript> 
 	
-	<form method="post" action="<?php echo htmlspecialchars($data['destination']); ?>">
-		<input type="hidden" name="SAMLResponse" value="<?php echo htmlspecialchars($data['response']); ?>" />
-		<input type="hidden" name="<?php echo htmlspecialchars($data['RelayStateName']); ?>" value="<?php echo htmlspecialchars($data['RelayState']); ?>" />
+	<form method="post" action="<?php echo htmlspecialchars($this->data['destination']); ?>">
+		<input type="hidden" name="SAMLResponse" value="<?php echo htmlspecialchars($this->data['response']); ?>" />
+		<input type="hidden" name="<?php echo htmlspecialchars($this->data['RelayStateName']); ?>" value="<?php echo htmlspecialchars($this->data['RelayState']); ?>" />
 		
 		<noscript>
 			<input type="submit" value="Submit the response to the service" />
diff --git a/templates/default/en/selectidp-dropdown.php b/templates/default/en/selectidp-dropdown.php
index 3ba59d5bb..614b8e4d6 100644
--- a/templates/default/en/selectidp-dropdown.php
+++ b/templates/default/en/selectidp-dropdown.php
@@ -4,18 +4,18 @@
 	
 	<div id="content">
 
-		<h2><?php if (isset($data['header'])) { echo $data['header']; } else { echo "Select your IdP"; } ?></h2>
+		<h2><?php if (isset($this->data['header'])) { echo $this->data['header']; } else { echo "Select your IdP"; } ?></h2>
 		
 		<p>Please select the identity provider where you want to authenticate:</p>
 
-		<form method="get" action="<?php echo $data['urlpattern']; ?>">
-		<input type="hidden" name="entityID" value="<?php echo htmlspecialchars($data['entityID']); ?>" />
-		<input type="hidden" name="return" value="<?php echo htmlspecialchars($data['return']); ?>" />
-		<input type="hidden" name="returnIDParam" value="<?php echo htmlspecialchars($data['returnIDParam']); ?>" />
+		<form method="get" action="<?php echo $this->data['urlpattern']; ?>">
+		<input type="hidden" name="entityID" value="<?php echo htmlspecialchars($this->data['entityID']); ?>" />
+		<input type="hidden" name="return" value="<?php echo htmlspecialchars($this->data['return']); ?>" />
+		<input type="hidden" name="returnIDParam" value="<?php echo htmlspecialchars($this->data['returnIDParam']); ?>" />
 		<select name="idpentityid">
 		<?php
 			
-		foreach ($data['idplist'] AS $idpentry) {
+		foreach ($this->data['idplist'] AS $idpentry) {
 
 			echo '<option value="'.htmlspecialchars($idpentry['entityid']).'"';
 			if (isset($this->data['preferredidp']) && 
diff --git a/templates/default/en/selectidp-links.php b/templates/default/en/selectidp-links.php
index daab97926..db9e9cde8 100644
--- a/templates/default/en/selectidp-links.php
+++ b/templates/default/en/selectidp-links.php
@@ -3,7 +3,7 @@
 	
 	<div id="content">
 
-		<h2><?php if (isset($data['header'])) { echo $data['header']; } else { echo "Select your IdP"; } ?></h2>
+		<h2><?php if (isset($this->data['header'])) { echo $this->data['header']; } else { echo "Select your IdP"; } ?></h2>
 		
 		<p>Please select the identity provider where you want to authenticate:</p>
 		
@@ -17,16 +17,16 @@
 			echo '	<img src="/' . $this->data['baseurlpath'] .'resources/icons/star.png" style="float: right" />';
 			echo '	<h3>' . htmlspecialchars($idpentry['name']) . '</h3>';
 			echo '	<p>' . htmlspecialchars($idpentry['description']) . '<br />';
-			echo '	[ <a href="' . $data['urlpattern'] . htmlspecialchars($idpentry['entityid']) . '">Select this IdP</a>]</p>';
+			echo '	[ <a href="' . $this->data['urlpattern'] . htmlspecialchars($idpentry['entityid']) . '">Select this IdP</a>]</p>';
 			echo '</div>';
 		}
 		
 		
-		foreach ($data['idplist'] AS $idpentry) {
+		foreach ($this->data['idplist'] AS $idpentry) {
 			if ($idpentry['entityid'] != $this->data['preferredidp']) {
 				echo '<h3>' . htmlspecialchars($idpentry['name']) . '</h3>';
 				echo '<p>' . htmlspecialchars($idpentry['description']) . '<br />';
-				echo '[ <a href="' . $data['urlpattern'] . htmlspecialchars($idpentry['entityid']) . '">Select this IdP</a>]</p>';
+				echo '[ <a href="' . $this->data['urlpattern'] . htmlspecialchars($idpentry['entityid']) . '">Select this IdP</a>]</p>';
 			}
 		}
 		
diff --git a/templates/default/en/status-table.php b/templates/default/en/status-table.php
index 8d8612b50..85d8f5d22 100644
--- a/templates/default/en/status-table.php
+++ b/templates/default/en/status-table.php
@@ -1,13 +1,13 @@
 <?php
 $this->includeAtTemplateBase('includes/header.php');
 
-$title = $data['title'];
-$table = $data['table'];
+$title = $this->data['title'];
+$table = $this->data['table'];
 
 /* Identify column headings. */
 $column_titles = array();
 foreach($table as $row_title => $row_data) {
-	foreach($row_data as $ct => $data) {
+	foreach($row_data as $ct => $this->data) {
 		if(!in_array($ct, $column_titles)) {
 			$column_titles[] = $ct;
 		}
diff --git a/templates/default/en/status.php b/templates/default/en/status.php
index 7f6bb4a74..511e1f811 100644
--- a/templates/default/en/status.php
+++ b/templates/default/en/status.php
@@ -2,34 +2,35 @@
 
 <div id="content">
 
-	<h2><?php if (isset($data['header'])) { echo $data['header']; } else { echo "Some error occured"; } ?></h2>
+	<h2><?php if (isset($this->data['header'])) { echo $this->data['header']; } else { echo "Some error occured"; } ?></h2>
 	
 	<p>Hi, this is the status page of simpleSAMLphp. Here you can see if your session is timed out, how long it lasts until it times out and all the attributes that is attached to your session.</p>
 	
-	<p>Your session is valid for <?php echo $data['remaining']; ?> seconds from now.</p>
+	<p>Your session is valid for <?php echo $this->data['remaining']; ?> seconds from now.</p>
 	
-	<p>Session size: <?php echo isset($data['sessionsize']) ? $data['sessionsize'] : 'na'; ?>
+	<p>Session size: <?php echo isset($this->data['sessionsize']) ? $this->data['sessionsize'] : 'na'; ?>
 	
 	<h2>Your attributes</h2>
 	
-		<table>
+		<table width="100%" class="attributes">
 		<?php
 		
-		$attributes = $data['attributes'];
+		$attributes = $this->data['attributes'];
 		foreach ($attributes AS $name => $value) {
 			
-			if (isset($this->data['attribute_' . htmlspecialchars(strtolower($name)) ])) {
-				$name = $this->data['attribute_' . htmlspecialchars(strtolower($name))];
+			$txtname = '<code style="color: blue">' . $name . '</code>';
+			if ($this->t('attribute_' . htmlspecialchars(strtolower($name)), false)) {
+				$txtname = $this->t('attribute_' . htmlspecialchars(strtolower($name))) . '<br /><code style="color: blue">' . $name . '</code>';
 			}
 			
 			if (sizeof($value) > 1) {
-				echo '<tr><td>' . htmlspecialchars($name) . '</td><td><ul>';
+				echo '<tr><td>' . $txtname . '</td><td><ul>';
 				foreach ($value AS $v) {
 					echo '<li>' . htmlspecialchars($v) . '</li>';
 				}
 				echo '</ul></td></tr>';
 			} else {
-				echo '<tr><td>' . htmlspecialchars($name) . '</td><td>' . htmlspecialchars($value[0]) . '</td></tr>';
+				echo '<tr><td>' . $txtname . '</td><td>' . htmlspecialchars($value[0]) . '</td></tr>';
 			}
 		}
 		
diff --git a/templates/default/includes/header.php b/templates/default/includes/header.php
index 5bbcb02a1..cfff2a881 100644
--- a/templates/default/includes/header.php
+++ b/templates/default/includes/header.php
@@ -3,28 +3,28 @@
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title><?php
-if(array_key_exists('header', $data)) {
-	echo $data['header'];
+if(array_key_exists('header', $this->data)) {
+	echo $this->data['header'];
 } else {
 	echo 'simpleSAMLphp';
 }
 ?></title>
 
-	<link rel="stylesheet" type="text/css" href="/<?php echo $data['baseurlpath']; ?>resources/default.css" />
-	<link rel="icon" type="image/icon" href="/<?php echo $data['baseurlpath']; ?>resources/icons/favicon.ico" />
+	<link rel="stylesheet" type="text/css" href="/<?php echo $this->data['baseurlpath']; ?>resources/default.css" />
+	<link rel="icon" type="image/icon" href="/<?php echo $this->data['baseurlpath']; ?>resources/icons/favicon.ico" />
 </head>
 <body>
 
 <div id="wrap">
 	
 	<div id="header">
-		<h1><a style="text-decoration: none; color: white" href="/<?php echo $data['baseurlpath']; ?>"><?php 
-			echo (isset($data['header']) ? $data['header'] : 'simpleSAMLphp'); 
+		<h1><a style="text-decoration: none; color: white" href="/<?php echo $this->data['baseurlpath']; ?>"><?php 
+			echo (isset($this->data['header']) ? $this->data['header'] : 'simpleSAMLphp'); 
 		?></a></h1>
 		<div id="poweredby">
-			<a href="/<?php echo $data['baseurlpath']; ?>">
-			<img src="/<?php echo $data['baseurlpath']; ?>resources/icons/<?php 
-				echo (isset($data['icon']) ? $data['icon'] : 'compass_l.png'); 
+			<a href="/<?php echo $this->data['baseurlpath']; ?>">
+			<img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/<?php 
+				echo (isset($this->data['icon']) ? $this->data['icon'] : 'compass_l.png'); 
 			?>" alt="Header icon" /></a></div>
 	</div>
 	
diff --git a/www/index.php b/www/index.php
index 5116f70ec..aad1fe655 100644
--- a/www/index.php
+++ b/www/index.php
@@ -24,7 +24,7 @@ if ($config->getValue('admin.protectindexpage', false)) {
 $warnings = array();
 
 if (SimpleSAML_Utilities::getSelfProtocol() != 'https') {
-	$warnings[] = '<strong>You are not using HTTPS</strong> - encrypted communication with the user. Using simpleSAMLphp will works perfectly fine on HTTP for test purposes, but if you will be using simpleSAMLphp in a production environment, you should be running it on HTTPS. [ <a href="http://rnd.feide.no/content/simplesamlphp-maintenance-and-configuration">read more about simpleSAMLphp maintenance</a> ]';
+	$warnings[] = 'warnings_https';
 }
 
 	
@@ -142,8 +142,8 @@ $functionchecks = array(
 	'simplexml_import_dom' => array('required', 'SimpleXML'),
 	'dom_import_simplexml' => array('required', 'XML DOM'),
 	'preg_match'       => array('required',  'RegEx support'),
-	'ldap_bind'        => array('required for LDAP auth module',  'LDAP Extension'),
-	'radius_auth_open' => array('required for Radius auth module',  'Radius Extension'),
+	'ldap_bind'        => array('required_ldap',  'LDAP Extension'),
+	'radius_auth_open' => array('required_radius',  'Radius Extension'),
 	'mcrypt_module_open'=> array('optional',  'MCrypt'),
 );
 $funcmatrix = array();
@@ -160,7 +160,7 @@ foreach ($functionchecks AS $func => $descr) {
 }
 
 
-$t = new SimpleSAML_XHTML_Template($config, 'frontpage.php');
+$t = new SimpleSAML_XHTML_Template($config, 'frontpage.php', 'frontpage.php');
 $t->data['header'] = 'simpleSAMLphp installation page';
 $t->data['icon'] = 'compass_l.png';
 $t->data['warnings'] = $warnings;
diff --git a/www/resources/default.css b/www/resources/default.css
index 2ef216c16..559ea39d3 100644
--- a/www/resources/default.css
+++ b/www/resources/default.css
@@ -248,4 +248,10 @@ div.preferredidp {
 	border: 1px dashed #ccc;
 	background: #eee;
 	padding: 2px 2em 2px 2em;	
-}
\ No newline at end of file
+}
+
+table.attributes tr td {
+	border-bottom: 1px dashed #ccc;
+	padding-top: 5px;
+	vertical-align: top;
+}
-- 
GitLab