]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/3886'
authorTom Hughes <tom@compton.nu>
Wed, 11 Jan 2023 10:57:04 +0000 (10:57 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 11 Jan 2023 10:57:04 +0000 (10:57 +0000)
Gemfile.lock
app/assets/javascripts/index/directions.js
app/views/errors/_contact.html.erb [new file with mode: 0644]
app/views/errors/forbidden.html.erb
app/views/errors/internal_server_error.html.erb
app/views/errors/not_found.html.erb
config/locales/en.yml

index d52a623609d6b39c789492f84c87f7dd42561e0a..622a55823f64804b1855f180b3abf8dca9d08807 100644 (file)
@@ -86,7 +86,7 @@ GEM
     autoprefixer-rails (10.4.7.0)
       execjs (~> 2)
     aws-eventstream (1.2.0)
-    aws-partitions (1.686.0)
+    aws-partitions (1.690.0)
     aws-sdk-core (3.168.4)
       aws-eventstream (~> 1, >= 1.0.2)
       aws-partitions (~> 1, >= 1.651.0)
@@ -267,7 +267,7 @@ GEM
     kramdown (2.4.0)
       rexml
     libxml-ruby (4.0.0)
-    listen (3.7.1)
+    listen (3.8.0)
       rb-fsevent (~> 0.10, >= 0.10.3)
       rb-inotify (~> 0.9, >= 0.9.10)
     logstasher (2.1.5)
@@ -415,16 +415,16 @@ GEM
     rexml (3.2.5)
     rinku (2.0.6)
     rotp (6.2.2)
-    rubocop (1.42.0)
+    rubocop (1.43.0)
       json (~> 2.3)
       parallel (~> 1.10)
-      parser (>= 3.1.2.1)
+      parser (>= 3.2.0.0)
       rainbow (>= 2.2.2, < 4.0)
       regexp_parser (>= 1.8, < 3.0)
       rexml (>= 3.2.5, < 4.0)
       rubocop-ast (>= 1.24.1, < 2.0)
       ruby-progressbar (~> 1.7)
-      unicode-display_width (>= 1.4.0, < 3.0)
+      unicode-display_width (>= 2.4.0, < 3.0)
     rubocop-ast (1.24.1)
       parser (>= 3.1.1.0)
     rubocop-minitest (0.25.1)
@@ -481,7 +481,7 @@ GEM
       actionpack (>= 5.2)
       activesupport (>= 5.2)
       sprockets (>= 3.0.0)
-    strong_migrations (1.4.0)
+    strong_migrations (1.4.1)
       activerecord (>= 5.2)
     terser (1.1.13)
       execjs (>= 0.3.0, < 3)
@@ -490,7 +490,7 @@ GEM
     timeout (0.3.1)
     tzinfo (2.0.5)
       concurrent-ruby (~> 1.0)
-    unicode-display_width (2.4.0)
+    unicode-display_width (2.4.2)
     validates_email_format_of (1.7.2)
       i18n
     vendorer (0.2.0)
index 75c647802b7a4ff42f3143a0e93f3ae3f535fdb3..7bd0891a34e920956f0e80c3ed12a0f59e4bd9f7 100644 (file)
@@ -169,14 +169,18 @@ OSM.Directions = function (map) {
 
   function formatDistance(m) {
     if (m < 1000) {
-      return Math.round(m) + "m";
+      return I18n.t("javascripts.directions.distance_m", { distance: Math.round(m) });
     } else if (m < 10000) {
-      return (m / 1000.0).toFixed(1) + "km";
+      return I18n.t("javascripts.directions.distance_km", { distance: (m / 1000.0).toFixed(1) });
     } else {
-      return Math.round(m / 1000) + "km";
+      return I18n.t("javascripts.directions.distance_km", { distance: Math.round(m / 1000) });
     }
   }
 
+  function formatHeight(m) {
+    return I18n.t("javascripts.directions.distance_m", { distance: Math.round(m) });
+  }
+
   function formatTime(s) {
     var m = Math.round(s / 60);
     var h = Math.floor(m / 60);
@@ -260,8 +264,8 @@ OSM.Directions = function (map) {
       if (typeof route.ascend !== "undefined" && typeof route.descend !== "undefined") {
         distanceText.append(
           $("<br>"),
-          I18n.t("javascripts.directions.ascend") + ": " + Math.round(route.ascend) + "m. " +
-          I18n.t("javascripts.directions.descend") + ": " + Math.round(route.descend) + "m.");
+          I18n.t("javascripts.directions.ascend") + ": " + formatHeight(route.ascend) + ". " +
+          I18n.t("javascripts.directions.descend") + ": " + formatHeight(route.descend) + ".");
       }
 
       var turnByTurnTable = $("<table class='mb-3'>");
diff --git a/app/views/errors/_contact.html.erb b/app/views/errors/_contact.html.erb
new file mode 100644 (file)
index 0000000..4fe4e79
--- /dev/null
@@ -0,0 +1,3 @@
+<p><%= t ".contact_the_community_html",
+         :contact_link => link_to(t(".contact"), t(".contact_url"),
+                                  :title => t(".contact_url_title")) %></p>
index 6901ec1d59fe2716693d60ae5e938f3f217a5df6..036517bddc65d90d570fefc4ba4df62f5af80391 100644 (file)
@@ -1,3 +1,3 @@
-<h1>Forbidden</h1>
-<p>The operation you requested on the OpenStreetMap server is only available to administrators (HTTP 403)</p>
-<p>Feel free to <a href="http://wiki.openstreetmap.org/wiki/Contact" title="Various contact channels explained">contact</a> the OpenStreetMap community if you have found a broken link / bug. Make a note of the exact URL of your request.</p>
+<h1><%= t ".title" %></h1>
+<p><%= t ".description" %></p>
+<%= render :partial => "contact" %>
index a2b1ba6f7d0f1fa198d7e5b24c8a9091824ce11e..036517bddc65d90d570fefc4ba4df62f5af80391 100644 (file)
@@ -1,4 +1,3 @@
-<h1>Application error</h1>
-<p>The OpenStreetMap server encountered an unexpected condition that prevented it from fulfilling the request (HTTP 500)</p>
-<p>Feel free to <a href="http://wiki.openstreetmap.org/wiki/Contact" title="Various contact channels explained">contact</a> the OpenStreetMap community if your problem persists. Make a note of the exact URL / post data of your request.</p>
-<p>This may be a problem in our Ruby On Rails code. 500 occurs with exceptions thrown outside of an action (like in Dispatcher setups or broken Ruby code)</p>
+<h1><%= t ".title" %></h1>
+<p><%= t ".description" %></p>
+<%= render :partial => "contact" %>
index bf4744b5aa88757461cced075df4061f84ab9d92..036517bddc65d90d570fefc4ba4df62f5af80391 100644 (file)
@@ -1,3 +1,3 @@
-<h1>File not found</h1>
-<p>Couldn't find a file/directory/API operation by that name on the OpenStreetMap server (HTTP 404)</p>
-<p>Feel free to <a href="http://wiki.openstreetmap.org/wiki/Contact" title="Various contact channels explained">contact</a> the OpenStreetMap community if you have found a broken link / bug. Make a note of the exact URL of your request.</p>
+<h1><%= t ".title" %></h1>
+<p><%= t ".description" %></p>
+<%= render :partial => "contact" %>
index 0d2da3a328a9e288088b4739d55e97cb041be506..b1752834be165044a47cc9d2f9c83e65d7cabc10 100644 (file)
@@ -573,6 +573,21 @@ en:
       applications:
         create:
           notice: Application Registered.
+  errors:
+    contact:
+      contact_url: https://wiki.openstreetmap.org/wiki/Contact
+      contact_url_title: Various contact channels explained
+      contact: contact
+      contact_the_community_html: Feel free to %{contact_link} the OpenStreetMap community if you have found a broken link / bug. Make a note of the exact URL of your request.
+    forbidden:
+      title: Forbidden
+      description: The operation you requested on the OpenStreetMap server is only available to administrators (HTTP 403)
+    internal_server_error:
+      title: Application error
+      description: The OpenStreetMap server encountered an unexpected condition that prevented it from fulfilling the request (HTTP 500)
+    not_found:
+      title: File not found
+      description: Couldn't find a file/directory/API operation by that name on the OpenStreetMap server (HTTP 404)
   friendships:
     make_friend:
       heading: "Add %{user} as a friend?"
@@ -2931,6 +2946,8 @@ en:
       descend: "Descend"
       directions: "Directions"
       distance: "Distance"
+      distance_m: "%{distance}m"
+      distance_km: "%{distance}km"
       errors:
         no_route: "Couldn't find a route between those two places."
         no_place: "Sorry - couldn't locate '%{place}'."