From 24821ae6c692846bdeb6967eab9a36014eecc211 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Thu, 3 Jul 2008 09:51:32 +0000 Subject: [PATCH] Made the OpenID templates translateable. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@763 44740490-163a-0410-bde0-09ae8108e29a --- dictionaries/openid.php | 71 ++++++++++++++++++++++++++++++ templates/default/openid-about.php | 45 ++++++++++--------- templates/default/openid-sites.php | 34 +++++++------- templates/default/openid-trust.php | 32 +++++++++----- 4 files changed, 134 insertions(+), 48 deletions(-) create mode 100644 dictionaries/openid.php diff --git a/dictionaries/openid.php b/dictionaries/openid.php new file mode 100644 index 000000000..0b9b7af95 --- /dev/null +++ b/dictionaries/openid.php @@ -0,0 +1,71 @@ +<?php + +$lang = array( + 'list_trusted_sites' => array ( + 'en' => 'List of trusted sites', + ), + 'about_link' => array ( + 'en' => 'About simpleSAMLphp OpenID', + ), + 'welcome' => array ( + 'en' => 'Welcome to the simpleSAMLphp OpenID provider.', + ), + 'howtouse' => array ( + 'en' => 'To use this server, you will have to set up a URL to use as an identifier. Insert the following markup into the <code><head></code> of the HTML document at that URL:', + ), + 'loggedinas' => array ( + 'en' => 'You are now logged in as %USERID%', + ), + 'login' => array ( + 'en' => 'Login', + ), + 'howtouse_cont' => array ( + 'en' => 'Then configure this server so that you can log in with that URL. Once you have configured the server, and marked up your identity URL, you can verify that it is working by using the %SITE% %TOOL%:', + ), + 'checkup_tool' => array ( + 'en' => 'OpenID Checkup tool', + ), + 'openid_url' => array ( + 'en' => 'OpenID URL:', + ), + 'check' => array ( + 'en' => 'Check', + ), + 'confirm_question' => array ( + 'en' => 'Do you wish to confirm your identity URL (%OPENIDURL%) with %SITEURL%?', + ), + 'remember' => array ( + 'en' => 'Remember this decision', + ), + 'confirm' => array ( + 'en' => 'Confirm', + ), + 'notconfirm' => array ( + 'en' => 'Do not confirm', + ), + 'trustlist_desc' => array ( + 'en' => 'These decisions have been remembered for this session. All decisions will be forgotten when the session ends.', + ), + 'trustlist_trustedsites' => array ( + 'en' => 'Trusted Sites', + ), + 'trustlist_untrustedsites' => array ( + 'en' => 'Untrusted Sites', + ), + 'trustlist_remove' => array ( + 'en' => 'Remove Selected', + ), + 'trustlist_refresh' => array ( + 'en' => 'Refresh List', + ), + 'trustlist_forget' => array ( + 'en' => 'Forget All', + ), + 'trustlist_nosites' => array ( + 'en' => 'No sites are remembered for this session. When you authenticate with a site, you can choose to add it to this list by choosing <q>Remember this decision</q>.', + ), + +); + + +?> \ No newline at end of file diff --git a/templates/default/openid-about.php b/templates/default/openid-about.php index c1bd39aa2..424856899 100644 --- a/templates/default/openid-about.php +++ b/templates/default/openid-about.php @@ -1,22 +1,24 @@ -<?php $this->includeAtTemplateBase('includes/header.php'); ?> +<?php +if (isset($this->data['header']) && $this->getTag($this->data['header']) !== NULL) { + $this->data['header'] = $this->t($this->data['header']); +} + +$this->includeAtTemplateBase('includes/header.php'); +?> <div id="content"> <?php if (isset($this->data['header'])) { echo '<h2>' . $this->data['header'] . '</h2>'; } ?> - <p>[ <a href="/<?php echo $this->data['baseurlpath']; ?>/openid/provider/server.php/sites">List of trusted sites</a> | - About simpleSAMLphp OpenID ]</p> + <p>[ <a href="/<?php echo $this->data['baseurlpath']; ?>/openid/provider/server.php/sites"><?php echo($this->t('{openid:list_trusted_sites}')); ?></a> | + <?php echo($this->t('{openid:about_link}')); ?> ]</p> - <p>Welcome to the simpleSAMLphp OpenID provider.</p> + <p><?php echo($this->t('{openid:welcome}')); ?></p> - <p> - To use this server, you will have to set up a URL to use as an identifier. - Insert the following markup into the <code><head></code> of the HTML - document at that URL: - </p> + <p><?php echo($this->t('{openid:howtouse}')); ?></p> <pre><link rel="openid.server" href="<?php echo htmlspecialchars($this->data['openidserver']); ?>" /> <link rel="openid.delegation" href="<?php echo htmlspecialchars($this->data['openiddelegation']); ?>" /> @@ -26,31 +28,32 @@ <p><?php if (isset($this->data['userid'])) { - echo 'You are now logged in as ' . htmlspecialchars($this->data['userid']); + echo($this->t('{openid:loggedinas}', array('%USERID%' => htmlspecialchars($this->data['userid'])))); } else { - echo '<a href="' . htmlspecialchars($this->data['initssourl']) . '">Login</a>'; + echo('<a href="' . htmlspecialchars($this->data['initssourl']) . '">' . $this->t('{openid:login}') . '</a>'); } ?> <p> - Then configure this server so that you can log in with that URL. Once you - have configured the server, and marked up your identity URL, you can verify - that it is working by using the <a href="http://www.openidenabled.com/" - >openidenabled.com</a> - <a href="http://www.openidenabled.com/resources/openid-test/checkup">OpenID Checkup tool</a>: +<?php +$param = array( + '%SITE%' => '<a href="http://www.openidenabled.com/">openidenabled.com</a>', + '%TOOL%' => '<a href="http://www.openidenabled.com/resources/openid-test/checkup">' . $this->t('{openid:checkup_tool}') . '</a>', + ); +echo($this->t('{openid:howtouse_cont}', $param)); +?> <form method="post" action="http://www.openidenabled.com/resources/openid-test/checkup/start"> - <label for="checkup">OpenID URL: + <label for="checkup"><?php echo($this->t('{openid:openid_url}')); ?> </label><input id="checkup" type="text" name="openid_url" /> - <input type="submit" value="Check" /> + <input type="submit" value="<?php echo($this->t('{openid:check}')); ?>" /> </form> </p> - <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'); ?> diff --git a/templates/default/openid-sites.php b/templates/default/openid-sites.php index a08cd7fe2..e1b6e88fb 100644 --- a/templates/default/openid-sites.php +++ b/templates/default/openid-sites.php @@ -1,4 +1,10 @@ -<?php $this->includeAtTemplateBase('includes/header.php'); ?> +<?php +if (isset($this->data['header']) && $this->getTag($this->data['header']) !== NULL) { + $this->data['header'] = $this->t($this->data['header']); +} + +$this->includeAtTemplateBase('includes/header.php'); +?> <div id="content"> @@ -6,11 +12,11 @@ <?php if (isset($this->data['header'])) { echo '<h2>' . $this->data['header'] . '</h2>'; } ?> - <p>[ List of trusted sites | - <a href="/<?php echo $this->data['baseurlpath']; ?>/openid/provider/server.php/about">About simpleSAMLphp OpenID</a> ]</p> + <p>[ <?php echo($this->t('{openid:list_trusted_sites}')); ?> | + <a href="/<?php echo $this->data['baseurlpath']; ?>/openid/provider/server.php/about"><?php echo($this->t('{openid:about_link}')); ?></a> ]</p> - <p>These decisions have been remembered for this session. All decisions will be forgotten when the session ends.</p> + <p><?php echo($this->t('{openid:trustlist_desc}')); ?></p> <?php if (isset($this->data['sites'])) { ?> @@ -32,8 +38,8 @@ } $i = 0; - foreach (array('Trusted Sites' => $trusted_sites, - 'Untrusted Sites' => $untrusted_sites) as + foreach (array($this->t('{openid:trustlist_trustedsites}') => $trusted_sites, + $this->t('{openid:trustlist_untrustedsites}') => $untrusted_sites) as $name => $sites) { if ($sites) { echo '<tr><th colspan="2">'. htmlspecialchars($name) . '</th></tr>'; @@ -53,25 +59,21 @@ ?> </tbody> </table> - <input type="submit" name="remove" value="Remove Selected" /> - <input type="submit" name="refresh" value="Refresh List" /> - <input type="submit" name="forget" value="Forget All" /> + <input type="submit" name="remove" value="<?php echo($this->t('{openid:trustlist_remove}')); ?>" /> + <input type="submit" name="refresh" value="<?php echo($this->t('{openid:trustlist_refresh}')); ?>" /> + <input type="submit" name="forget" value="<?php echo($this->t('{openid:trustlist_forget}')); ?>" /> </form> </div> <?php } else { ?> - <p>No sites are remembered for this session. When you authenticate with a site, - you can choose to add it to this list by choosing <q>Remember this decision</q>. - </p> + <p><?php echo($this->t('{openid:trustlist_nosites}')); ?></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'); ?> diff --git a/templates/default/openid-trust.php b/templates/default/openid-trust.php index 583416f07..8ac1205e9 100644 --- a/templates/default/openid-trust.php +++ b/templates/default/openid-trust.php @@ -1,4 +1,10 @@ -<?php $this->includeAtTemplateBase('includes/header.php'); ?> +<?php +if (isset($this->data['header']) && $this->getTag($this->data['header']) !== NULL) { + $this->data['header'] = $this->t($this->data['header']); +} + +$this->includeAtTemplateBase('includes/header.php'); +?> <div id="content"> @@ -6,24 +12,28 @@ <?php if (isset($this->data['header'])) { echo '<h2>' . $this->data['header'] . '</h2>'; } ?> - <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> + <p>[ <a href="/<?php echo $this->data['baseurlpath']; ?>/openid/provider/server.php/sites"><?php echo($this->t('{openid:list_trusted_sites}')); ?></a> | + <a href="/<?php echo $this->data['baseurlpath']; ?>/openid/provider/server.php/about"><?php echo($this->t('{openid:about_link}')); ?></a> ]</p> <div class="form"> - <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> +<?php +$params = array( + '%OPENIDURL%' => '<code>' . htmlspecialchars($this->data['openidurl']) . '</code>', + '%SITEURL%' => '<code>' . $this->data['siteurl'] . '</code>', + ); +echo('<p>' . $this->t('{openid:confirm_question}', $params) . '</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> + for="remember"><?php echo($this->t('{openid:remember}')); ?></label> <br /> - <input type="submit" name="trust" value="Confirm" /> - <input type="submit" value="Do not confirm" /> + <input type="submit" name="trust" value="<?php echo($this->t('{openid:confirm}')); ?>" /> + <input type="submit" value="<?php echo($this->t('{openid:notconfirm}')); ?>" /> </form> </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 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 -- GitLab