From: Tom Hughes Date: Wed, 11 Jan 2023 10:57:04 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/3886' X-Git-Tag: live~1894 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/2ee5a63eaddc2917328bacf7feb90b0c8b1933b1?hp=b7887b049fa1aae17f8b7020fe43542fffde1260 Merge remote-tracking branch 'upstream/pull/3886' --- diff --git a/Gemfile.lock b/Gemfile.lock index d52a62360..622a55823 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 75c647802..7bd0891a3 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -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( $("
"), - 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 = $(""); diff --git a/app/views/errors/_contact.html.erb b/app/views/errors/_contact.html.erb new file mode 100644 index 000000000..4fe4e7968 --- /dev/null +++ b/app/views/errors/_contact.html.erb @@ -0,0 +1,3 @@ +

<%= t ".contact_the_community_html", + :contact_link => link_to(t(".contact"), t(".contact_url"), + :title => t(".contact_url_title")) %>

diff --git a/app/views/errors/forbidden.html.erb b/app/views/errors/forbidden.html.erb index 6901ec1d5..036517bdd 100644 --- a/app/views/errors/forbidden.html.erb +++ b/app/views/errors/forbidden.html.erb @@ -1,3 +1,3 @@ -

Forbidden

-

The operation you requested on the OpenStreetMap server is only available to administrators (HTTP 403)

-

Feel free to contact the OpenStreetMap community if you have found a broken link / bug. Make a note of the exact URL of your request.

+

<%= t ".title" %>

+

<%= t ".description" %>

+<%= render :partial => "contact" %> diff --git a/app/views/errors/internal_server_error.html.erb b/app/views/errors/internal_server_error.html.erb index a2b1ba6f7..036517bdd 100644 --- a/app/views/errors/internal_server_error.html.erb +++ b/app/views/errors/internal_server_error.html.erb @@ -1,4 +1,3 @@ -

Application error

-

The OpenStreetMap server encountered an unexpected condition that prevented it from fulfilling the request (HTTP 500)

-

Feel free to contact the OpenStreetMap community if your problem persists. Make a note of the exact URL / post data of your request.

-

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)

+

<%= t ".title" %>

+

<%= t ".description" %>

+<%= render :partial => "contact" %> diff --git a/app/views/errors/not_found.html.erb b/app/views/errors/not_found.html.erb index bf4744b5a..036517bdd 100644 --- a/app/views/errors/not_found.html.erb +++ b/app/views/errors/not_found.html.erb @@ -1,3 +1,3 @@ -

File not found

-

Couldn't find a file/directory/API operation by that name on the OpenStreetMap server (HTTP 404)

-

Feel free to contact the OpenStreetMap community if you have found a broken link / bug. Make a note of the exact URL of your request.

+

<%= t ".title" %>

+

<%= t ".description" %>

+<%= render :partial => "contact" %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 0d2da3a32..b1752834b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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}'."