From 256686bbc4c1012940332eb042a722ac6d7511d2 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Wed, 2 Jul 2008 13:04:52 +0000 Subject: [PATCH] Status-template: update translations. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@756 44740490-163a-0410-bde0-09ae8108e29a --- dictionaries/status.php | 38 +++++++++++++++++++++++ templates/default/status.php | 44 ++++++++++++++++++--------- www/example-simple/hostnames.php | 2 +- www/example-simple/saml2-example.php | 6 ++-- www/example-simple/shib13-example.php | 2 +- www/example-simple/wsfed-example.php | 2 +- 6 files changed, 74 insertions(+), 20 deletions(-) create mode 100644 dictionaries/status.php diff --git a/dictionaries/status.php b/dictionaries/status.php new file mode 100644 index 000000000..045d8d4f3 --- /dev/null +++ b/dictionaries/status.php @@ -0,0 +1,38 @@ +<?php + +$lang = array( + 'header_saml20_sp' => array ( + 'en' => 'SAML 2.0 SP Demo Example', + ), + 'header_shib' => array ( + 'en' => 'Shibboleth demo', + ), + 'header_wsfed' => array ( + 'en' => 'WS-Fed SP Demo Example', + ), + 'header_diagnostics' => array ( + 'en' => 'SimpleSAMLphp Diagnostics', + ), + 'some_error_occured' => array ( + 'en' => 'Some error occured', + ), + 'intro' => array ( + 'en' => '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.', + ), + 'validfor' => array ( + 'en' => 'Your session is valid for %SECONDS% seconds from now.', + ), + 'sessionsize' => array ( + 'en' => 'Session size: %SIZE%', + ), + 'attributes_header' => array ( + 'en' => 'Your attributes', + ), + 'logout' => array ( + 'en' => 'Logout', + ), + +); + + +?> \ No newline at end of file diff --git a/templates/default/status.php b/templates/default/status.php index 17d562a92..92f83a03b 100644 --- a/templates/default/status.php +++ b/templates/default/status.php @@ -1,16 +1,28 @@ -<?php $this->includeAtTemplateBase('includes/header.php'); ?> +<?php +if(array_key_exists('header', $this->data)) { + if($this->getTag($this->data['header']) !== NULL) { + $this->data['header'] = $this->t($this->data['header']); + } +} + +$this->includeAtTemplateBase('includes/header.php'); +?> <div id="content"> - <h2><?php if (isset($this->data['header'])) { echo $this->data['header']; } else { echo "Some error occured"; } ?></h2> + <h2><?php if (isset($this->data['header'])) { echo($this->data['header']); } else { echo($this->t('{status: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><?php echo($this->t('{status:intro}')); ?></p> - <p>Your session is valid for <?php echo $this->data['remaining']; ?> seconds from now.</p> + <p><?php echo($this->t('{status:validfor}', array('%SECONDS%' => $this->data['remaining']))); ?></p> - <p>Session size: <?php echo isset($this->data['sessionsize']) ? $this->data['sessionsize'] : 'na'; ?> + <?php + if(isset($this->data['sessionsize'])) { + echo('<p>' . $this->t('{status:sessionsize}', array('%SIZE%' => $this->data['sessionsize'])) . '</p>'); + } + ?> - <h2>Your attributes</h2> + <h2><?php echo($this->t('{status:attributes_header}')); ?></h2> <table width="100%" class="attributes"> <?php @@ -37,15 +49,19 @@ ?> </table> - <?php if (isset($this->data['logout'])) { ?> - <h2>Logout</h2> +<?php +if (isset($this->data['logout'])) { + echo('<h2>' . $this->t('{status:logout}') . '</h2>'); + echo('<p>' . $this->data['logout'] . '</p>'); +} - <p><?php echo $this->data['logout']; ?></p> +if (isset($this->data['logouturl'])) { + echo('<h2>' . $this->t('{status:logout}') . '</h2>'); + echo('<p>[ <a href="' . htmlspecialchars($this->data['logouturl']) . '">' . $this->t('{status:logout}') . '</a> ]</p>'); +} +?> - <?php } ?> - - <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 simpleSAMLphp at <a href="http://rnd.feide.no">the Feide RnD blog</a> over at <a href="http://uninett.no">UNINETT</a>.</p> + <h2><?php echo $this->t('{frontpage:about_header}'); ?></h2> + <p><?php echo $this->t('{frontpage:about_text}'); ?></p> <?php $this->includeAtTemplateBase('includes/footer.php'); ?> \ No newline at end of file diff --git a/www/example-simple/hostnames.php b/www/example-simple/hostnames.php index 5c0e091fd..008d3188b 100644 --- a/www/example-simple/hostnames.php +++ b/www/example-simple/hostnames.php @@ -41,7 +41,7 @@ $attributes['Utilities_getRequestURI()'] = array(SimpleSAML_Utilities::getReques $et = new SimpleSAML_XHTML_Template($config, 'status.php'); -$et->data['header'] = 'SimpleSAMLphp Diagnostics'; +$et->data['header'] = '{status:header_diagnostics}'; $et->data['remaining'] = 'na'; $et->data['attributes'] = $attributes; $et->data['valid'] = 'na'; diff --git a/www/example-simple/saml2-example.php b/www/example-simple/saml2-example.php index 426be7b1f..b656e8399 100644 --- a/www/example-simple/saml2-example.php +++ b/www/example-simple/saml2-example.php @@ -50,13 +50,13 @@ $attributes = $session->getAttributes(); $t = new SimpleSAML_XHTML_Template($config, 'status.php', 'attributes'); -$t->data['header'] = 'SAML 2.0 SP Demo Example'; +$t->data['header'] = '{status:header_saml20_sp}'; $t->data['remaining'] = $session->remainingTime(); $t->data['sessionsize'] = $session->getSize(); $t->data['attributes'] = $attributes; $t->data['icon'] = 'bino.png'; -$t->data['logout'] = '[ <a href="/' . $config->getBaseURL() . 'saml2/sp/initSLO.php?RelayState=/' . - $config->getBaseURL() . 'logout.html">Logout</a> ]'; +$t->data['logouturl'] = '/' . $config->getBaseURL() . 'saml2/sp/initSLO.php?RelayState=/' . + $config->getBaseURL() . 'logout.html'; $t->show(); diff --git a/www/example-simple/shib13-example.php b/www/example-simple/shib13-example.php index ecdcafad5..d35d36e3b 100644 --- a/www/example-simple/shib13-example.php +++ b/www/example-simple/shib13-example.php @@ -38,7 +38,7 @@ if (!isset($session) || !$session->isValid('shib13') ) { $t = new SimpleSAML_XHTML_Template($config, 'status.php'); -$t->data['header'] = 'Shibboleth demo'; +$t->data['header'] = '{status:header_shib}'; $t->data['remaining'] = $session->remainingTime(); $t->data['attributes'] = $session->getAttributes(); $t->data['logout'] = null; diff --git a/www/example-simple/wsfed-example.php b/www/example-simple/wsfed-example.php index 0908962ef..883d45599 100644 --- a/www/example-simple/wsfed-example.php +++ b/www/example-simple/wsfed-example.php @@ -16,7 +16,7 @@ $attributes = $session->getAttributes(); $t = new SimpleSAML_XHTML_Template($config, 'status.php', 'attributes'); -$t->data['header'] = 'WS-Fed SP Demo Example'; +$t->data['header'] = '{status:header_wsfed}'; $t->data['remaining'] = $session->remainingTime(); $t->data['sessionsize'] = $session->getSize(); $t->data['attributes'] = $attributes; -- GitLab