Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Make amf_controller.rb error messages translatable #2416

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 1 comment
Closed

Make amf_controller.rb error messages translatable #2416

openstreetmap-trac opened this issue Jul 23, 2021 · 1 comment

Comments

@openstreetmap-trac
Copy link

Reporter: avarab[at]gmail.com
[Submitted to the original trac issue database at 12.34am, Wednesday, 4th November 2009]

amf_controller.rb includes a lot of error messages which may be served to the user. These need to be made translatable.

Here's a partial patch:

Index: app/controllers/amf_controller.rb
===================================================================
--- app/controllers/amf_controller.rb	(revision 18452)
+++ app/controllers/amf_controller.rb	(working copy)
@@ -161,11 +161,11 @
   rescue OSM::APIUserChangesetMismatchError => ex
     return [-2, ex.to_s]
   rescue OSM::APIBadBoundingBox => ex
-    return [-2, "Sorry - I can't get the map for that area. The server said: #{ex.to_s}"]
+    return [-2, t('potlatch.error.amf.api_bad_boundingbox', :server_error => ex.to_s)]
   rescue OSM::APIError => ex
     return [-1, ex.to_s]
   rescue Exception => ex
-    return [-2, "An unusual error happened (in #{call}). The server said: #{ex.to_s}"]
+    return [-2, t('potlatch.error.amf.api_bad_boundingbox', :call => call, :server_error => ex.to_s)]
   end
 
   def amf_handle_error_with_timeout(call,rootobj,rootid)
@@ -182,7 +182,7 @
   def startchangeset(usertoken, cstags, closeid, closecomment, opennew)
     amf_handle_error("'startchangeset'",nil,nil) do
       user = getuser(usertoken)
-      if !user then return -1,"You are not logged in, so Potlatch can't write any changes to the database." end
+      if !user then return -1,t('potlatch.error.start_changeset') end
       unless user.active_blocks.empty? then return -1,t('application.setup_user_auth.blocked') end
 
       # close previous changeset and add comment
Index: config/locales/en.yml
===================================================================
--- config/locales/en.yml	(revision 18452)
+++ config/locales/en.yml	(working copy)
@@ -1157,3 +1157,7 @
     site:
       edit_zoom_alert: You must zoom in to edit the map
       history_zoom_alert: You must zoom in to see the editing history
+  potlatch:
+    error:
+      amf:
+        api_bad_boundingbox: "Sorry - I can't get the map for that area. The server said: {{server_error}}"
@openstreetmap-trac
Copy link
Author

Author: osm[at]gravitystorm.co.uk
[Added to the original trac issue at 11.51am, Wednesday, 19th June 2019]

amf_controller is likely to be removed in the near future, and in any case potlatch1 is rarely used. So it's extremely unlikely anyone is going to put in the effort to translate these strings now, and realistically it's not worth the effort.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant