summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@update.uu.se>2021-05-10 22:16:16 +0200
committerMarcus Lundblad <ml@update.uu.se>2021-05-15 23:42:09 +0200
commit3606de43e82807aefd6a0f1b2bdc9757e855d209 (patch)
treee8ff84c44b075761f255d4db2e06f5dddc7e6729
parent33de87db9cd8643097ca50b38742e03b6904b1a7 (diff)
downloadgnome-maps-wip/mlundblad/negative-altitudes.tar.gz
placeView: Format 0 and negative altitudes nicerwip/mlundblad/negative-altitudes
Instead of just showing 0 or a value with a - sign, show the altitudes as "At sea level" and "%s below sea level" which looks a bit less "techichal".
-rw-r--r--src/placeView.js22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/placeView.js b/src/placeView.js
index e623388b..41db0119 100644
--- a/src/placeView.js
+++ b/src/placeView.js
@@ -455,9 +455,29 @@ var PlaceView = GObject.registerClass({
* compare to an impossibly low altitude to see if one is set */
if (place.location.altitude > -1000000000.0) {
let alt = place.location.altitude;
+ let info;
+
+ if (alt > 0) {
+ info = Utils.prettyDistance(alt, true);
+ } else if (alt < 0) {
+ /**
+ * Translators: this is a label indicating an altitude below
+ * sea level, where the %s placeholder is the altitude relative
+ * to mean sea level in the "negative direction"
+ */
+ info = _("%s below sea level").
+ format(Utils.prettyDistance(-alt, true));
+ } else {
+ /**
+ * Translators: this indicates a place is located at (or very
+ * close to) mean sea level
+ */
+ info = _("At sea level");
+ }
+
content.push({ label: _("Altitude"),
icon: 'mountain-symbolic',
- info: Utils.prettyDistance(alt, true) });
+ info: info });
}
if (place.religion) {