@AntonKhorev commented on this pull request.


> +  let distanceUnits = "km";
   let downloadURL = null;
 
-  function formatTotalDistance(m) {
-    if (m < 1000) {
-      return OSM.i18n.t("javascripts.directions.distance_m", { distance: 
Math.round(m) });
-    } else if (m < 10000) {
-      return OSM.i18n.t("javascripts.directions.distance_km", { distance: (m / 
1000.0).toFixed(1) });
+  function translateDistanceUnits(m) {
+    if (distanceUnits === "km") {
+      return [m, "m", m / 1000, "km"];
     } else {
-      return OSM.i18n.t("javascripts.directions.distance_km", { distance: 
Math.round(m / 1000) });
+      return [m / 0.3048, "ft", m / 1609.344, "mi"];
     }
   }
 
-  function formatStepDistance(m) {
-    if (m < 5) {
+  function formatTotalDistance(minorValue, minorName, majorValue, majorName) {
+    const scope = "javascripts.directions.distance_in_units";

If we ignore that what's called a *formatter* here doesn't format anything, I'm 
not going to do functions/objects as values of km/mi preference until I decide 
where I'm storing that preference. Let's suppose the preference is persisted in 
a cookie. Certainly I'm not going to store a function or an object there.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5915#discussion_r2051719175
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/5915/review/2780239...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to