Opened 11 years ago

Closed 13 months ago

#2416 closed defect (wontfix)

Make amf_controller.rb error messages translatable

Reported by: avar Owned by: rails-dev@…
Priority: major Milestone:
Component: website Version:
Keywords: api_errors Cc:


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)]
   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 @@
       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}}"

Change History (3)

comment:1 Changed 9 years ago by Tom Hughes

Owner: changed from Tom Hughes to rails-dev@…

comment:2 Changed 9 years ago by stevens

Keywords: api_errors added

comment:3 Changed 13 months ago by Andy Allan

Resolution: wontfix
Status: newclosed

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.

Note: See TracTickets for help on using tickets.