[gnome-maps/wip/mlundblad/photon-geocode: 10/11] mainWindow: Show Photon geocode attribution in About



commit b1831783e17e205dc59c257a5b24384fd6b81736
Author: Marcus Lundblad <ml update uu se>
Date:   Fri May 3 20:12:53 2019 +0200

    mainWindow: Show Photon geocode attribution in About
    
    Show attribution for the Photon geocode service in
    the About dialog if available in the service file.

 src/mainWindow.js | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index e2bafe7..d141afe 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -536,6 +536,7 @@ var MainWindow = GObject.registerClass({
 
     _getAttribution() {
         let tileProviderInfo = Service.getService().tileProviderInfo;
+        let photonGeocode = Service.getService().photonGeocode;
         let attribution = _("Map data by %s and contributors").format('<a 
href="https://www.openstreetmap.org";>OpenStreetMap</a>');
 
         if (tileProviderInfo) {
@@ -555,6 +556,31 @@ var MainWindow = GObject.registerClass({
             attribution += _("Map tiles provided by %s").format(tileProviderString);
         }
 
+        if (photonGeocode) {
+            let photonProviderString;
+            if (photonGeocode.attributionUrl) {
+                photonProviderString =
+                    '<a href="' + photonGeocode.attributionUrl + '">' +
+                    photonGeocode.attribution + '</a>';
+            } else {
+                photonProviderString = photonGeocode.attribution;
+            }
+
+            attribution += '\n';
+            /* Translators: this is an attribution string giving credit to the
+             * search provider where the first %s placeholder is replaced by either
+             * the bare name of the tile provider, or a linkified URL if one
+             * is available, and the second %s placeholder is replaced by the
+             * URL to the Photon geocoder project page. These placeholders
+             * can be swapped, if needed using the %n$s positional syntax
+             * (i.e. "%2$s ... %1$s ..." for positioning the project URL
+             * before the provider).
+             */
+            attribution += _("Search provided by %s using %s").
+                format(photonProviderString,
+                       '<a href="https://github.com/Komoot/photon";>Photon</a>');
+        }
+
         return attribution;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]