[gnome-maps/wip/mlundblad/localized-population: 3/3] placeBubble: Use locale digits for printing population




commit 14628d9b51032e7fe77d7576b1b7ddc931e6ff86
Author: Marcus Lundblad <ml update uu se>
Date:   Tue Aug 25 23:27:40 2020 +0200

    placeBubble: Use locale digits for printing population

 src/placeBubble.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/placeBubble.js b/src/placeBubble.js
index 3b2163f1..a9adefd1 100644
--- a/src/placeBubble.js
+++ b/src/placeBubble.js
@@ -140,8 +140,14 @@ var PlaceBubble = GObject.registerClass({
         let expandedContent = [];
 
         if (place.population) {
+            /* TODO: this is a bit of a work-around to re-interpret the population,
+             * stored as a string into an integer to convert back to a locale-
+             * formatted string. Ideally it should be kept as an integer value
+             * in the Place class. But this will also need to be handled by the
+             * PlaceStore, possible in a backwards-compatible way
+             */
             expandedContent.push({ label: _("Population:"),
-                                   info: place.population });
+                                   info: parseInt(place.population).toLocaleString() });
         }
 
         if (place.location.altitude > 0) {


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