From 7cd598be8f900832cd0fcc6e9654c0bcb7924faa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Wed, 11 Jun 2008 11:29:01 +0000
Subject: [PATCH] Adding support for having name and description in multiple
 language in metadata to be shown at the disco service

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@632 44740490-163a-0410-bde0-09ae8108e29a
---
 templates/default/selectidp-dropdown.php | 10 +++++++++-
 templates/default/selectidp-links.php    | 16 ++++++++++++----
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/templates/default/selectidp-dropdown.php b/templates/default/selectidp-dropdown.php
index ff27869b6..930e175fc 100644
--- a/templates/default/selectidp-dropdown.php
+++ b/templates/default/selectidp-dropdown.php
@@ -7,6 +7,14 @@ $this->data['header'] = $this->t($this->data['header']);
 
 $this->includeAtTemplateBase('includes/header.php');
 
+foreach ($this->data['idplist'] AS $idpentry) {
+	if (isset($idpentry['name']))
+		$this->includeInlineTranslation('idpname_' . $idpentry['entityid'], $idpentry['name']);
+	if (isset($idpentry['description']))
+		$this->includeInlineTranslation('idpdesc_' . $idpentry['entityid'], $idpentry['description']);
+}
+
+
 ?>
 	<div id="content">
 
@@ -28,7 +36,7 @@ $this->includeAtTemplateBase('includes/header.php');
 				$idpentry['entityid'] == $this->data['preferredidp']) 
 				echo ' selected="selected"';
 				
-			echo '>'.htmlspecialchars($idpentry['name']).'</option>';
+			echo '>'.htmlspecialchars($this->t('idpname_' . $idpentry['entityid'])).'</option>';
 		
 		}
 		?>
diff --git a/templates/default/selectidp-links.php b/templates/default/selectidp-links.php
index c0a5a0ed7..1cbaa1842 100644
--- a/templates/default/selectidp-links.php
+++ b/templates/default/selectidp-links.php
@@ -7,6 +7,14 @@ $this->data['header'] = $this->t($this->data['header']);
 
 $this->includeAtTemplateBase('includes/header.php');
 
+foreach ($this->data['idplist'] AS $idpentry) {
+	if (isset($idpentry['name']))
+		$this->includeInlineTranslation('idpname_' . $idpentry['entityid'], $idpentry['name']);
+	if (isset($idpentry['description']))
+		$this->includeInlineTranslation('idpdesc_' . $idpentry['entityid'], $idpentry['description']);
+}
+
+
 ?>
 	<div id="content">
 
@@ -28,9 +36,9 @@ $this->includeAtTemplateBase('includes/header.php');
 				$iconUrl = SimpleSAML_Utilities::resolveURL($idpentry['icon']);
 				echo '<img style="display: inline" src="' . htmlspecialchars($iconUrl) . '" />';
 			}
-			echo htmlspecialchars($idpentry['name']) . '</h3>';
+			echo htmlspecialchars($this->t('idpname_' . $idpentry['entityid'])) . '</h3>';
 
-			echo '	<p>' . htmlspecialchars($idpentry['description']) . '<br />';
+			echo '	<p>' . htmlspecialchars($this->t('idpdesc_' . $idpentry['entityid'])) . '<br />';
 			echo '	[ <a href="' . $this->data['urlpattern'] . htmlspecialchars($idpentry['entityid']) . '">Select this IdP</a>]</p>';
 			echo '</div>';
 		}
@@ -43,9 +51,9 @@ $this->includeAtTemplateBase('includes/header.php');
 					$iconUrl = SimpleSAML_Utilities::resolveURL($idpentry['icon']);
 					echo '<img style="display: inline" src="' . htmlspecialchars($iconUrl) . '" />';
 				}
-				echo htmlspecialchars($idpentry['name']) . '</h3>';
+				echo htmlspecialchars($this->t('idpname_' . $idpentry['entityid'])) . '</h3>';
 
-				echo '<p>' . htmlspecialchars($idpentry['description']) . '<br />';
+				echo '	<p>' . htmlspecialchars($this->t('idpdesc_' . $idpentry['entityid'])) . '<br />';
 				echo '[ <a href="' . $this->data['urlpattern'] . htmlspecialchars($idpentry['entityid']) . '">Select this IdP</a>]</p>';
 			}
 		}
-- 
GitLab