From d142e3f4ff3bbb9cec6274f0c1a311a6772b9a43 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 11 Jul 2018 14:10:20 -0400
Subject: [PATCH] Fix map tab i18n.

---
 languages/en.ini                               |  1 +
 themes/bootstrap3/js/map_tab_leaflet.js        | 18 +++++++++---------
 .../bootstrap3/templates/RecordTab/map.phtml   |  3 +++
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/languages/en.ini b/languages/en.ini
index 15a6a35a2d9..3ec6681eb8b 100644
--- a/languages/en.ini
+++ b/languages/en.ini
@@ -233,6 +233,7 @@ confirm_storage_retrieval_request_cancel_selected_text = "Do you wish to cancel
 Contents = "Contents"
 Contributing Source = "Contributing Source"
 Contributors = "Contributors"
+Coordinates = "Coordinates"
 Copies = "Copies"
 Copy = "Copy"
 Copyright = "Copyright"
diff --git a/themes/bootstrap3/js/map_tab_leaflet.js b/themes/bootstrap3/js/map_tab_leaflet.js
index 8453514f655..9d7087466b1 100644
--- a/themes/bootstrap3/js/map_tab_leaflet.js
+++ b/themes/bootstrap3/js/map_tab_leaflet.js
@@ -36,16 +36,16 @@ function loadMapTab(mapData, mapGraticule, basemap) {
         label_coords = split_coords[1] + "<br>" + split_coords[2];
       }
       // Construct the entire label string
-      if (label_coords && label_name) {
-        label = '<strong>' + label_name + '</strong>' + 
-          '<br>Coordinates:<br>' + label_coords;
-      } else if (label_name) {
-        label = '<strong>' + label_name + '</strong>';
-      } else if (label_coords) {
-        label = "Coordinates:<br>" + label_coords;
-      } else {
-        label = "No information available.";
+      var labelParts = [];
+      if (label_name) {
+        labelParts[labelParts.length] = '<strong>' + label_name + '</strong>';
       }
+      if (label_coords) {
+        labelParts[labelParts.length] = VuFind.translate('Coordinates') + ":<br>"
+          + label_coords;
+      }
+      label = labelParts.length > 0
+        ? labelParts.join('<br>') : VuFind.translate('no_description');
       // Get coordinate data
       var west = mapData[i][0];
       var south = mapData[i][1];
diff --git a/themes/bootstrap3/templates/RecordTab/map.phtml b/themes/bootstrap3/templates/RecordTab/map.phtml
index a69cd182c95..1126a4eedd5 100644
--- a/themes/bootstrap3/templates/RecordTab/map.phtml
+++ b/themes/bootstrap3/templates/RecordTab/map.phtml
@@ -3,6 +3,9 @@
   $this->headScript()->appendFile('vendor/leaflet/leaflet.latlng-graticule.js');
   $this->headScript()->appendFile('map_tab_leaflet.js');
   $this->headLink()->appendStylesheet('vendor/leaflet/leaflet.css');
+  $this->jsTranslations()->addStrings(
+    ['Coordinates' => 'Coordinates', 'no_description' => 'no_description']
+  );
   $mapTabData = $this->tab->getMapTabData();
   $mapGraticule = $this->tab->getMapGraticule();
   $basemap = $this->tab->getBasemap();
-- 
GitLab