From 2ca7fd6e1048faffef6b66c44cf32222792f33a8 Mon Sep 17 00:00:00 2001
From: Guy Halse <guy@tenet.ac.za>
Date: Wed, 28 Feb 2018 12:14:26 +0200
Subject: [PATCH] Fix missing translation for metarefresh

Metarefresh had an inadvertent dependency on the translation files for
the aggregator module that was removed in v1.15. Remove that dependency
and provide the basis for the rest of the module to be translated.
---
 .../dictionaries/metarefresh.definition.json         | 12 ++++++++++++
 .../dictionaries/metarefresh.translation.json        |  9 +++++++++
 modules/metarefresh/hooks/hook_frontpage.php         |  2 +-
 modules/metarefresh/templates/fetch.tpl.php          | 12 ++++++------
 4 files changed, 28 insertions(+), 7 deletions(-)
 create mode 100644 modules/metarefresh/dictionaries/metarefresh.definition.json
 create mode 100644 modules/metarefresh/dictionaries/metarefresh.translation.json

diff --git a/modules/metarefresh/dictionaries/metarefresh.definition.json b/modules/metarefresh/dictionaries/metarefresh.definition.json
new file mode 100644
index 000000000..8bfb51c4a
--- /dev/null
+++ b/modules/metarefresh/dictionaries/metarefresh.definition.json
@@ -0,0 +1,12 @@
+{
+    "frontpage_link": {
+        "en": "Metarefresh: fetch metadata"
+    },
+    "metarefresh_header": {
+        "en": "Metarefresh fetch"
+    },
+    "no_output": {
+        "en": "No output from metarefresh."
+    }
+}
+
diff --git a/modules/metarefresh/dictionaries/metarefresh.translation.json b/modules/metarefresh/dictionaries/metarefresh.translation.json
new file mode 100644
index 000000000..2023ecba4
--- /dev/null
+++ b/modules/metarefresh/dictionaries/metarefresh.translation.json
@@ -0,0 +1,9 @@
+{
+    "frontpage_link": {
+    },
+    "metarefresh_header": {
+    },
+    "no_output": {
+    }
+}
+
diff --git a/modules/metarefresh/hooks/hook_frontpage.php b/modules/metarefresh/hooks/hook_frontpage.php
index 60e7aef5e..0c5c2b175 100644
--- a/modules/metarefresh/hooks/hook_frontpage.php
+++ b/modules/metarefresh/hooks/hook_frontpage.php
@@ -10,7 +10,7 @@ function metarefresh_hook_frontpage(&$links) {
 
 	$links['federation'][] = array(
 		'href' => SimpleSAML\Module::getModuleURL('metarefresh/fetch.php'),
-		'text' => array('en' => 'Metarefresh: fetch metadata'),
+		'text' => '{metarefresh:metarefresh:frontpage_link}',
 	);
 
 }
diff --git a/modules/metarefresh/templates/fetch.tpl.php b/modules/metarefresh/templates/fetch.tpl.php
index 512f6f429..780e98c89 100644
--- a/modules/metarefresh/templates/fetch.tpl.php
+++ b/modules/metarefresh/templates/fetch.tpl.php
@@ -1,20 +1,20 @@
 <?php
-$this->data['header'] = $this->t('{aggregator:aggregator:aggregator_header}');
+$this->data['header'] = $this->t('{metarefresh:metarefresh:metarefresh_header}');
 $this->includeAtTemplateBase('includes/header.php');
 
-echo('<h1>Metarefresh fetch</h1>');
+echo('<h1>'.$this->data['header'].'</h1>');
 
 
 if (!empty($this->data['logentries'])) {
-	
+
 	echo '<pre style="border: 1px solid #aaa; padding: .5em; overflow: scroll">';
 	foreach($this->data['logentries'] AS $l) {
-		echo $l . "\n";		
+		echo $l . "\n";
 	}
 	echo '</pre>';
-	
+
 } else {
-	echo 'No output from metarefresh.';
+	echo $this->t('{metarefresh:metarefresh:no_output}');
 }
 
 
-- 
GitLab