[gnome-maps] osmUtils: Also update native name when editing



commit 40bd497806bd5f636cae0abdf9d2bc08e8bd85ef
Author: Marcus Lundblad <ml update uu se>
Date:   Mon Apr 12 22:51:45 2021 +0200

    osmUtils: Also update native name when editing
    
    Update native name (which corresponds to the "name" tag).
    And also keep the displayed translated name in synch in
    case they were already equal.
    
    Fixes #360

 src/osmUtils.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/osmUtils.js b/src/osmUtils.js
index ad19c7c5..847c975c 100644
--- a/src/osmUtils.js
+++ b/src/osmUtils.js
@@ -53,8 +53,14 @@ function updatePlaceFromOSMObject(place, object) {
         /* only update the place's name from the OSM object if the OSM object
          * actually has a name set.
          * https://bugzilla.gnome.org/show_bug.cgi?id=762569
+         *
+         * also update the displayed localized name, if it was equal
+         * to the translated name to avoid the old name showing up as the
+         * native name in when editing places where they equal
          */
-        place.name = name;
+        if (place.name === place.nativeName)
+            place.name = name;
+        place.nativeName = name;
     }
     place.population = object.get_tag('population');
     place.website = object.get_tag('website');


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